Junior Member
Join Date: Dec 2017
Posts: 7
|
I am currently adding some functionality to the rifts savage worlds files.
The upgrade edge lets you select a piece of cyberware and add it to your character. I already have the drop down content but need help adding the "usrChosen1" to the cyberware list of the hero. <thing id="edgSRUpgade" name="Upgrade" description="..." compset="Edge" summary="Add a new piece of cyberware of your choice"> <fieldval field="usrCandid1" value="component.Cyberware"/> <usesource source="SavRiftC"/> <tag group="ChooseSrc1" tag="Thing" name="All Things" abbrev="All Things"/> <tag group="MinRank" tag="1" name="Seasoned" abbrev="Seasoned"/> <tag group="EdgeType" tag="Iconic"/> <eval phase="PreTraits" priority="5000"><![CDATA[ doneif (field[usrChosen1].ischosen = 0) <!-- NEED TO add field[usrChosen1].chosen to cyberware list--> ]]></eval> <evalrule phase="Validate" priority="5000" message="May only be taken once per rank" summary="May only be taken once per rank"> <![CDATA[validif (herofield[acRank].value + 1 >= hero.tagcount[Edge.edgSRUpgade])]]></evalrule> <exprreq message="Combat Cyborg or M.A.R.S. required."> <![CDATA[(hero.tagcount[Group.grpSRCoCyb] + hero.tagcount[Rifts.MARS]) >= 1]]></exprreq> <exprreq message="Seasoned required."> <![CDATA[herofield[acRank].value >= 1]]></exprreq> </thing> |
#1 |
Senior Member
Join Date: Jan 2007
Location: NW Arkansas
Posts: 1,321
|
This: (http://forums.wolflair.com/showthread.php?t=61101) might be what you're looking for....
I've not got time at the moment to test this, but this might work Code:
perform hero.addpick[tabCyberwr,field[usrChosen1].chosen.idstring] Working on - |
#2 |
Junior Member
Join Date: Dec 2017
Posts: 7
|
Quote:
Hero Lab was forced to stop compilation after the following errors were detected: Syntax error in 'eval' script for Thing 'edgSRUpgade' (Eval Script '#1') on line 3 -> Script reference is invalid under the circumstances |
|
#3 |
Senior Member
Join Date: Jan 2007
Location: NW Arkansas
Posts: 1,321
|
Quote:
Code:
doneif (field[usrChosen1].ischosen = 0) var thingid as string thingid = field[usrChosen1].chosen.idstring perform hero.addpick[tabCyberwr,thingid] Working on - |
|
#4 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,215
|
You cannot use an eval script to add a pick to the character - the cyberware will need to run its own scripts, so it cannot be created by another script - the list of all scripts to be run must be set up before any script runs, so that HL knows the order to run them in. You'll need to build a new table where the user can add this item, and then for each purchase of this edge, add +1 to the count of items available to add to that table.
An action script run from a button could do this, but the table is a cleaner interface for the user, who can take their time to look at the available cyberware, instead of just having to pick a name from a list, with no indications of what cyberware they already have and which of the available items is legal. If you don't have access to the structure of the game system you're modifying, then I would just add instructions to the description that once the user purchases this edge, they should then buy an appropriate piece of cyberware for free. Without access to the structure, this is not an edge that can be implemented beyond having the user do things themselves. |
#5 |
Junior Member
Join Date: Dec 2017
Posts: 7
|
Quote:
I would basically do an autoadd of a dynamic thing. 10x Adi Last edited by adimar; November 15th, 2018 at 09:24 AM. Reason: /thought of another option |
|
#6 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,215
|
If this adds a specific item, then an autoadd is an option, but if you have a hundred different cyberware items, do you want a hundred versions of this edge, each for adding a different cyberware item?
Also, with an autoadd, if the user decides not to take this edge, how will you also tell them that they must then delete the cyberware? With the table, removing the edge will remove one of the slots allowed on the table, and so the user will get an error message until they reduce the count of items in the table. |
#7 |
Junior Member
Join Date: Dec 2017
Posts: 7
|
10x Mathias.
For the edge I decided to keep the drop down without actually adding the cyber. (IMHO it's more usable.) I used the extra table approach for another screen where multiple items need to be added and not just 1 related to a specific edge. Adi |
#8 |
|
|