• 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

Pointing usrChosen to the right pick

Bob G

Well-known member
Hi folks,

Writing a script for this ability: "Grants a bonus on two of the following skills of the rogue’s choice: Fly, Handle Animal, Profession (driver), Profession
(sailor), or Ride."

I've got the custom expression choosing the correct skills. Now I want to apply a +2 competence bonus to the chosen skills.
<post-attributes 10000>
Code:
hero.childfound[usrChosen1].field[BonComp].value += 2
hero.childfound[usrChosen2].field[BonComp].value += 2
That produces a syntax error. So what's the correct command to take the user's selections and apply bonuses to them?

Thanks as always!
 
The reason you're getting errors is because that script is looking for picks on the hero called userChosen1 and usrChosen2, which don't exist. What you are looking for is the transition "chosen", like so:

Code:
doneif (field[usrChosen1].ischosen = 0)
field[usrChosen1].chosen.field[BonComp].value += 2

The first line basically says, "Hey, did the user pick a skill yet? If not, then don't do anything else because we don't want errors when we try to give bonuses to a skill we haven't picked".

The second line starts from the ability's 'usrchosen1' field, then uses the 'chosen' transition to move to the pick selected in that field (i.e. the chosen skill), and is then able to apply the value to the BonComp field.
 
That makes more sense now IG, thanks for taking the time to explain it. Works great now.

Maybe I spoke too soon. I'm now getting an error message saying "Attempt to assign field value with no pick context."
Code:
doneif (field[usrChosen1].ischosen = 0)
field[usrChosen1].chosen.field[BonComp].value += 2

doneif (field[usrChosen2].ischosen = 0)
field[usrChosen2].chosen.field[BonComp].value += 2
What's it tripping up on?
 
In the editor, how did you set up your choosers for this? It sounds like you left one of the settings blank, so it's defaulting to thing-based selections, instead of choosing "picks on hero".
 
In the editor, how did you set up your choosers for this? It sounds like you left one of the settings blank, so it's defaulting to thing-based selections, instead of choosing "picks on hero".

Yessir, that was the problem. All good now, thanks!
 
Back
Top