• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Racial attribute bonus

royalfa

Active member
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>

I add the six racXXX fields and the macros then I change the code in traits.str adding this field

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>

In the trait componet.

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.
 
Add

Code:
perform

before each of your #traitmodify[] lines.

Code:
perform #traitmodify[attrStr,trtRacial,field[racStr].value,""]

(I also noticed that you're modifying a different field on Str than on any other attribute).
 
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.
 
Back
Top