• 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

Trait Skill Question

Frodie

Well-known member
I am working on a trait that would give a certain class a class skill. All works fine, but I have the restrict list set to "all things" so the knowledge, craft ect will show. Now I know normally you would get an error because craft (or whatever) skill isn't on the hero. So I tried the class ability script from the expert class (where it will show everything and work). But for some reason I still get the same error. Here is the script at pre-levels 500

if (hero.tagis[Custom.FGMPClInte] <> 0) then
if (field[usrChosen1].ischosen <> 0) then
var result as number
result = field[usrChosen1].chosen.shareidentity[ClassSkill,cHelpSpc]
endif
endif

Is there a reason why it will work as a class ability and not on a trait?
 
I know why the error happens on traits, (because the skill has to be attached to the hero). Anyways the error is

Attempt to access pick information or behaviors for read-only thing 'skFGMPAgri'
Location: 'eval' script for Thing 'trFGMPAcad' (Eval Script '#4') near line 3
- - -
Attempt to assign field value with no pick context
Location: 'eval' script for Thing 'trFGMPAcad' (Eval Script '#4') near line 4
 
There must be a different problem for you, I just made a trait to do exactly that and it works just fine. Using Selection of Skill, All Things.

For Spirtulist, Pre-Levels 500

Code:
      ~ If we haven't chosen anything, get out immediately
      doneif (field[usrChosen1].ischosen = 0)

      ~ Assign the appropriate identity tag to the Expert class
      var result as number
      result = field[usrChosen1].chosen.shareidentity[ClassSkill,cHelpSpi]
 
Well, dang..... I just did another trait for a test and it worked. There has to be something else going on. Weird. Anyways thank you!
 
I found the issue, I had after the script

#applybonus[BonTrait,field[usrChosen1].chosen,1]

Now I just need to find a way to give the chosen skill a +1 with out an error. That might be tricky.
 
field[usrChosen1].chosen.field[BonTrait].value = maximum(field[usrChosen1].chosen.field[BonTrait].value,1)
 
Last edited:
Cool, but it gives this error - I have at as another script at pre-levels 500

Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'eval' script for Thing 'trFGMPAcad' (Eval Script '#6') on line 1
-> Error parsing parameter 2 of function

The script

doneif (field[usrChosen1].ischosen = 0)
field[usrChosen1].chosen.field[BonTrait].value = maximum(field[usrChosen1].chosen.field[BonTrait].value,1]
 
Last edited:
lol, yep I just saw that. Thank you again, the scrip loads, but once the craft skill is chosen it gives this error. IDK if I can get around that.

Attempt to assign field value with no pick context
 
Ah yeah ... that's the problem with using "All Things", if you change it to "All Picks on Hero" they'll have to add the skill to the character before they can make it a class skill which is actually the most common way to do this. What I would do is:

Code:
    ~ If we're not chosen, get out now
    doneif (field[usrChosen1].ischosen = 0)
   
    ~make selected skill a class skill
    perform field[usrChosen1].chosen.assign[Helper.ClassSkill]

    ~add a +1 trait bonus to chosen skill
   field[usrChosen1].chosen.field[BonTrait].value = maximum(field[usrChosen1].chosen.field[BonTrait].value,1)
 
Got an idea that might work, if I can delete the Helper.ExtraSkill tag (I think that hides the skill). I can add the bonus normally later in the timing. But I need to get the script and timing right.

post levels 9000

foreach pick in hero from BaseSkill where "Helper.ClassSkill"
perform eachpick.delete[Helper.ExtraSkill]
nexteach
 
Well, deleting the tag didn't get it. I think the tag is SkillAdded, but you can't use the ?, so IDK. Any ideas?

foreach pick in hero from BaseSkill where "Helper.ClassSkill"
perform eachpick.assign[SkillAdded.?]
nexteach
 
Um, I'm not sure what you're trying to do now. I thought you were just trying to create the class skill and give a bonus.
 
Also tried

perform field[usrChosen1].chosen.setfocus
if (state.isfocus <> 0) then
perform focus.assign[SkillAdded.?]
endif

But the error is

Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'eval' script for Thing 'trFGMPAcad' (Eval Script '#6') on line 2
-> Wildcard tags like 'SkillAdded.?' may not be assigned - you must assign a specific tag

And I tried


if (field[usrChosen1].ischosen <> 0) then
perform field[usrChosen1].chosen.assign[Broadcast.SkillAdded]

So I guess that idea is a no go.
 
Last edited:
I too am confused. You've already got the class skill part done, can't you just check if the selected skill is present on the hero and stop before applying the bonus if not?
 
I think to add the bonus, the skill has to be added to the hero. if there is no skill added, there is no field to modify. So close, but it looks like it just can't do it.
 
Yes, that's why you stop the script if the skill isn't present. Are you having trouble figuring out when a skill is on the hero? Is that the issue?
 
I know normally the user would have had to add the skill before any modifiers and this is kind of backwards, but it's the way it written. Anyways, I was thinking if we could force the skill to show then maybe a later script could modify it. Maybe some kind of loop or something. IDK
 
If it's something in the text which requires you to mess with things, maybe you should post the text of the trait? I don't see why you're trying to do things this way other than you don't want to rely on the user adding the skill as a pick?
 
Back
Top