DICE PACKS BUNDLE
Page 1 of 2 12 Last
  1. #1

    Drag and Drop abilities - Savage Rifts

    Good day!

    I'm working on trying to get the abilities in the Savage Rifts product (soon to be released) so that the abilities are automatically dropped on the character sheet when the iconic framework is selected. I've not had much luck with it, sadly. I'm still learning to code in Lua. What I have is this:

    Code:
    function onFrameworkDrop(nodeChar, draginfo)
        if nodeChar and draginfo.isType("shortcut") then
            local sClass, sRecord = draginfo.getShortcutData()
            local nodeFramework = draginfo.getDatabaseNode()
            if sClass == "sw_referenceframework" and nodeFramework then
                DB.setValue(nodeChar, "framework", "string", DB.getValue(nodeFramework, "name", ""))
                DB.setValue(nodeChar, "frameworklink", "windowreference", sClass, sRecord)
                local rActor = CharacterManager.getActorShortcut("pc", nodeChar)
                local nodeAbilities = DB.createChild(nodeChar, "special")
                    for _,nodeFrameworkAbility in pairs(NodeManager.getChildrenOrdered(nodeFramework, "abilities")) do
                    local nodeAbility = DB.createChild(nodeAbilities)
                    DB.setValue(nodeAbility, "name", "string", DB.getValue(nodeFrameworkAbility, "name", ""))
                    DB.setValue(nodeAbility, "description", "string", DB.getValue(nodeFrameworkAbility, "description", ""))
                    DB.setValue(nodeAbility, "link", "windowreference", "sw_referencefeat", nodeFrameworkAbility.getNodeName())
                    CharacterManager.importAbilityEffects(rActor, nodeAbility)
                    end
                return true
            end
        end
        return false
    end
    What am I doing wrong?

    Thanks,

    GBFF
    Ultimate Edition license holder - No License Needed to Play My Games (Need Demo Version of FG Downloaded)

    Timezone: Eastern Standard Time (EST) United States; GMT -5 hours

  2. #2
    You'd have to provide examples of what the framework record XML looks like to be able to have an idea what is going on since the framework is a new record type that doesn't exist in SW ruleset.

    Regards,
    JPG

  3. #3
    JPG,

    Thanks for the reply! See below.

    Code:
    ?xml version="1.0" encoding="iso-8859-1"?>
    
    <!-- 
        Please see the license.html file included with this distribution for 
        attribution and copyright information.
    -->
    
    <root>
        <windowclass name="sw_referenceframework">
            <frame>recordsheet</frame>
            <placement>
                <size width="350" height="350" />
            </placement>
            <sizelimits>
                <minimum width="350" height="350" />
                <dynamic />
            </sizelimits>
            <minimize>minimized_reference</minimize>
            <tooltip field="name" />
            <playercontrol />
            <sharable />
            <nodelete />
            <script file="campaign/scripts/framework.lua" />
            <sheetdata>
                <sub_record_header name="header">
                    <class>framework_header</class>
                </sub_record_header>
    
                <frame_record_content name="contentframe" />
    
                <subwindow_record name="content">
                    <class>framework_main</class>
                    <activate />
                </subwindow_record>
                <scrollbar_record>
                    <target>content</target>
                </scrollbar_record>
    
                <viewerlist_recordsheet />
    
                <resize_recordsheet />
                <close_recordsheet />
            </sheetdata>
        </windowclass>
        
        <windowclass name="framework_header">
            <margins control="0,0,0,7" />
            <script file="campaign/scripts/record_header.lua" />
            <sheetdata>
                <link_record_header>
                    <class>sw_referenceframework</class>
                </link_record_header>
    
                <anchor_record_header_right name="rightanchor" />
                <icon_record_locked />
                <button_record_locked />
    
                <string_record_name name="name">
                    <empty textres="library_recordtype_empty_race" />
                </string_record_name>
            </sheetdata>
        </windowclass>
        
        <windowclass name="framework_main">
            <margins control="0,0,0,2" />
            <script file="campaign/scripts/framework_main.lua" />
            <sheetdata>
                <anchor_column name="columnanchor" />
                
                <ft_columnh name="text" />
                
                <header_column name="abilities_header">
                    <static textres="race_header_abilities"/>
                    <center />
                </header_column>
                <button_iedit name="abilities_iedit">
                    <anchored to="abilities_header" position="righthigh" offset="-20,0" />
                    <target>abilities</target>
                </button_iedit>
                <button_iadd name="abilities_iadd">
                    <anchored to="abilities_iedit" position="lefthigh" offset="5,0" />
                    <target>abilities</target>
                </button_iadd>
                <list_column_sw name="abilities">
                    <datasource>.abilities</datasource>
                    <class>ref_race_ability</class>
                </list_column_sw>
            </sheetdata>
        </windowclass>
    
        <windowclass name="ref_framework_ability">
            <margins control="0,0,0,2" />
            <script file="campaign/scripts/framework_ability.lua" />
            <sheetdata>
                <anchor_listitem_column_right name="rightanchor" />
                <button_listitem_column_delete name="idelete">
                    <anchored>
                        <right relation="relative" />
                    </anchored>
                </button_listitem_column_delete>
                <link_listitem_column name="shortcut">
                    <class>sw_referencefeat</class>
                </link_listitem_column>
    
                <record_stringline name="name">
                    <anchored position="insidetopleft" offset="5,4">
                        <right parent="rightanchor" anchor="left" relation="relative" offset="-5" />
                    </anchored>
                    <font>sheetlabel</font>
                    <empty textres="library_recordtype_empty_racialability" />
                    <script>
                        function onGainFocus()
                            window.description.updateState(true)
                        end
                        function onLoseFocus()
                            window.description.updateState()
                        end
                    </script>
                </record_stringline>
    
                <record_stringline_h name="description">
                    <anchored to="name" position="below" offset="2">
                        <left offset="15" />
                    </anchored>
                </record_stringline_h>
            </sheetdata>
        </windowclass>
    </root>
    Ultimate Edition license holder - No License Needed to Play My Games (Need Demo Version of FG Downloaded)

    Timezone: Eastern Standard Time (EST) United States; GMT -5 hours

  4. #4
    Thanks for the window definitions.
    Can you post an example of a XML framework record from the module too?

    JPG

  5. #5
    Here's the <list> entry:

    Code:
    <burster>
                            <name type="string">Burster</name>
                                <listlink type="windowreference">
                                    <class>sw_referenceframework</class>
                                    <recordname>reference.frameworks.burster</recordname>
                                </listlink>
                            </burster>
    And the framework itself:

    Code:
    <burster>
                    <name type="string">Burster</name>
                    <text type="formattedtext">
                         LOTS OF DETAILS ABOUT THE BURSTER IN FORMATTED TEXT
                    </text>
                    <abilities>
                        <arcane_background>
                            <name type="string">Arcane Background: Psionics</name>
                            <type type="string">Ability</type>
                            <benefit type="formattedtext">
                                 <p>A Burster begins with Arcane  Background (Psionics) choosing three powers from the list above, the  Blaster and Major Psionic Edges, and a d6 Psionics skill. Bursters begin  with 20 ISP (10 ISP base, doubled by the Major Psionic Edge).</p>
                            </benefit>
                        </arcane_background>
                        <everything_burns>
                            <name type="string">Everything Burns</name>
                            <type type="string">Ability</type>
                            <benefit type="formattedtext">
                                 <p>The fires started by the Burster are  some of the most intense possible and can set almost any material  aflame. When a Burster scores a raise on a damage-causing attack roll  using one of their abilities, the target catches fire taking 3d6 damage  until doused (see <b>Fire </b>in <i>Savage Worlds  </i>).</p>
                            </benefit>
                        </everything_burns>
                        <fiery_aura>
                            <name type="string">Fiery Aura</name>
                            <type type="string">Ability</type>
                            <benefit type="formattedtext">
                                 <p>As an action (no roll or ISP  required) a Burster can surround himself with a damage field of flame  and heat, causing 3d6 damage to adjacent foes at the end of each of his  rounds, and providing +6 Armor to himself (stacks with protection and  natural armor, but not worn armor). This fiery aura also adds 1d6 damage  to any Fighting attack he makes. If the Burster spends 3 ISP when  activating Fiery Aura, for the next five rounds the damage becomes Mega  Damage and the Armor provided gains the MDC quality. Fiery Aura goes  away whenever the Burster is Incapacitated or unconscious.</p>
                            </benefit>
                        </fiery_aura>
                        <fire_mastery>
                            <name type="string">Fire Mastery</name>
                            <type type="string">Ability</type>
                            <benefit type="formattedtext">
                                 <p>The Burster has the Innate Ability to  create, control, and eliminate minor fire, heat, and smoke effects  using <i>elemental manipulation </i>for no ISP. As an  action, she may activate the Elemental Fury or Exalted Manipulation  modifier costing no ISP. Non-arcane environmental protection has no  effect against this ability.</p>
                            </benefit>
                        </fire_mastery>
                        <firewalker>
                            <name type="string">Fire Walker</name>
                            <type type="string">Ability</type>
                            <benefit type="formattedtext">
                                 <p>Bursters have Immunity to all sources  of fire, heat, and plasma damage; he could take a dive into a river of  lava and come out unscathed. He has Environmental Immunity to Heat and  Fire environmental Hazards, and gains +4 on rolls to resist heat-based  arcane effects. Bursters take -4 damage from lightning or electrical  attacks as well as laser, ion, and particle beam weapons.</p>
                            </benefit>
                        </firewalker>
                        <flame_bolt>
                            <name type="string">Flame Bolt</name>
                            <type type="string">Ability</type>
                            <benefit type="formattedtext">
                                 <p>The Burster can hurl forth a flaming  bolt of 3d6 Mega Damage (4d6 on a raise) for one ISP, or 4d6 Mega Damage  (5d6 on a raise) for two ISP. Additional Power Modifiers may be used as  normal. Flame Bolt is Range Smarts &#215;2 and counts as a Mega  Power Modifier for the purpose of utilizing the Blaster Edges and their  Power Modifiers.</p>
                            </benefit>
                        </flame_bolt>
                        <cybernetics>
                            <name type="string">Cybernetics</name>
                                <type type="string">Complication</type>
                                <benefit type="formattedtext">
                                     <p>Cyberware isn't a good option for  a Burster as they interfere too much with his powers. If circumstances  force a bionic addition, each point of Strain imposes a &#45;1  penalty to the Psionics skill.</p>
                                </benefit>
                        </cybernetics>
                        <enemies>
                            <name type="string">Enemies</name>
                                <type type="string">Complication</type>
                                <benefit type="formattedtext">
                                     <p>As with any powerful psychic, the  Coalition and True Federation consider Bursters allied with enemy  factions a dire threat to life and property. They prioritize attacking  them when hostilities break out and hunt them with extreme  prejudice.</p>
                                </benefit>
                        </enemies>
                        <quirk>
                            <name type="string">Quirk-Pyromaniac</name>
                                <type type="string">Complication</type>
                                <benefit type="formattedtext">
                                     <p>Though most are not sociopathic  arsonists, Bursters tend to have a thing about starting fires just to  watch them burn with loving fascination. This is more aggravating than  dangerous (at least most of the time).</p>
                                </benefit>
                        </quirk>
                    </abilities>
                </burster>
    GBFF
    Ultimate Edition license holder - No License Needed to Play My Games (Need Demo Version of FG Downloaded)

    Timezone: Eastern Standard Time (EST) United States; GMT -5 hours

  6. #6
    Any other XML/LUA code needed?

    GBFF
    Ultimate Edition license holder - No License Needed to Play My Games (Need Demo Version of FG Downloaded)

    Timezone: Eastern Standard Time (EST) United States; GMT -5 hours

  7. #7
    Still looking/hoping for assistance with this.

    GBFF
    Ultimate Edition license holder - No License Needed to Play My Games (Need Demo Version of FG Downloaded)

    Timezone: Eastern Standard Time (EST) United States; GMT -5 hours

  8. #8
    Bump! Still looking for ideas on this while I work on learning how to read the code/make it function and do what I want it to do.

    GBFF
    Ultimate Edition license holder - No License Needed to Play My Games (Need Demo Version of FG Downloaded)

    Timezone: Eastern Standard Time (EST) United States; GMT -5 hours

  9. #9
    It looks like the logic is basically sound; but I'm not familiar with SW ruleset to know whether the data is being placed in the right places.

    For example,
    * Is charsheet.id-#####.special the correct place to create a list of abilities?
    * Does the window class that displays the ability record have "name", "description" and "link" fields?
    * How do other scripts use the special list or individual special records (if any)?
    * What does NodeManager.getChildrenOrdered actually do? (Not part of CoreRPG)
    * What does CharacterManager.importAbilityEffects do?

    In general, I would start by adding Debug.chat or Debug.console statements between each line in your script to see what is being used and returned for the functions, and ensure that is what you expect to see at that point.

    Regards,
    JPG

  10. #10
    As a customer of several rulesets and modules, it seems to me that there needs to be a better support mechanism for developers of licensed products. Like a ruleset guru that the various developers can go to for specific advise on basic stuff like implementing drag and drop or building the coding side of effects. This thread has been here for a couple of weeks, had to be bumped three times by the dev, and the final answer was basically your on your own, good luck.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
FG Spreadshirt Swag

Log in

Log in