Member
Join Date: Feb 2011
Posts: 37
|
I need to set a racial bonus for every race in the game, some are fixed some are chosen by the user.
I navigate in the 4e source files and find a "macro" to do this. Here is my Race component in components.core Code:
<!-- Race component Each race derives from this component --> <component id="Race" name="Race" autocompset="no"> <field id="racStr" name="Strength Bonus" type="static"> </field> <field id="racDex" name="Dexterity Bonus" type="static"> </field> <field id="racCon" name="Constitution Bonus" type="static"> </field> <field id="racInt" name="Intelligence Bonus" type="static"> </field> <field id="racWis" name="Wisdom Bonus" type="static"> </field> <field id="racCha" name="Charisma Bonus" type="static"> </field> <!-- Each race needs its own identity tag to configure the hero appropriately --> <identity group="Race"/> <!-- Also a tag to use to note that certain things (e.g. feats) require certain races --> <identity group="ReqRace"/> <!-- Track the race on the actor by assigning the appropriate tag --> <eval index="1" phase="Setup" priority="5000"><![CDATA[ perform forward[Race.?] ~ Add appropriate bonuses #traitmodify[attrStr,trtBonus,field[racStr].value,""] #traitmodify[attrDex,trtRacial,field[racDex].value,""] #traitmodify[attrCon,trtRacial,field[racCon].value,""] #traitmodify[attrInt,trtRacial,field[racInt].value,""] #traitmodify[attrWis,trtRacial,field[racWis].value,""] #traitmodify[attrCha,trtRacial,field[racCha].value,""] ]]></eval> </component> Code:
<field id="trtRacial" name="Racial Bonus" type="derived" history="best" maxfinal="25"> <finalize><![CDATA[ if (@value = 0) then @text = "-" done endif @text = signed(@value) ]]></finalize> </field> At the end I add this: + field[trtRacial].value to the trtFinal and trtDerived fields evals. When run the game this message pop up: syntax error in "eval" script for component "Race" (Eval script '#1') on line 5 ->unspecified error parsing script. Don't know what I'm doing wrong. PS: I modify the editor accordingly to capture the race bonus. |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,207
|
Add
Code:
perform Code:
perform #traitmodify[attrStr,trtRacial,field[racStr].value,""] |
#2 |
Member
Join Date: Feb 2011
Posts: 37
|
I was doing the testing with perform and a new error was pop up.
(I was "testing" if the trtRacial was the trouble but it wasn't that's why Str has trtBonus instead) Finally it works. The definition file in the game system don't have this macro defined (I think this was by default of the program) moreover I kind of intuit that this was the problem but yesterday don't find where this macro is defined. Thanks again Mathias. I will test this feature and try to add movement (only for race) and saving throws now. |
#3 |
Thread Tools | |
Display Modes | |
|
|