• 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

Adding Tool Proficiency script not working

Enforcer84

Well-known member
So I've got a subrace that adds Smith's Tools to the character and I used the script add that allows expertise if they already have it.

Phase: Post-levels Priority: 10000 Script:

~ If we're disabled, do nothing
doneif (tagis[Helper.Disable] = 1)

if (hero.tagis[ProfTool.gTooSmith] = 0) then
perform hero.assign[ProfTool.gTooSmith]
perform hero.child[gTooSmith].assign[Helper.TrainTool]
perform hero.child[gTooSmith].assign[Hide.Tool]
perform hero.child[gTooSmith].assign[Proficienc.Tool]
else
foreach pick in hero from BaseEquip where "ProfTool.gTooSmith"
perform hero.assign[ProfTooDbl.gTooSmith]
nexteach
endif

when I add the sub race I get errors. (attached as image)

I cannot add the skill it's not listed with the tools. If I add the Smith's Tools gear it just kind of works.
 

Attachments

  • Smiths Errror.PNG
    Smiths Errror.PNG
    155.4 KB · Views: 6
Try checking out how it was done for the Forge Cleric. it bootstraps the tool gear itself, then assigns it in an eval script with a linkage table (I don't know how that works, but I'm going to go see if I can search and find out).

Then the only thing you'll need to solve is the expertise thing. I'd pull that out, make sure just the proficiency part is working, then put it back in and work from there.
 
Last edited:
I don't think that the line that pushes the proficiency to the link table actually works (perform root.linkage
.assign[ProfTool.gTooSmith]
) -that looks like some leftover test code. If you play around, you can remove that line - it's the bootstrap that pushes the proficiency.

Tool proficiencies are a hack, wish that they had done them the way skill proficiencies are done.

One way to try and accomplish what you want would be to:
1. Bootstrap Smith's Tools with the Procienc.Tool tag, AND add a conditional that looks for a field value - like "fieldval:abValue = 1"

2. add your script (postlevel 10000, Before Calc skProfBon )
Look to see if you have the proficiency. If you don't, set abValue to 1 (enabling the bootstrapped tool skill) and EXIT.
Else,
perform hero.assign[ProfTooDbl.gTooSmith]

or

if (hero.tagis[ProfTool.gTooSmith] = 0) then
~ if I can't see that we have the proficiency, set abValue so that the bootstrap fires off
field[abValue].value = 1
else
~ I see that we already have the tool, so let the hero have double proficiency
perform hero.assign[ProfTooDbl.gTooSmith]
endif


What is very important is the extra timing on the script:
Before Calc skProfBon
forces the script to run before any proficiencies bonuses actually get added, without it your script could run after and never works.
 
I don't think that the line that pushes the proficiency to the link table actually works (perform root.linkage
.assign[ProfTool.gTooSmith]
) -that looks like some leftover test code. If you play around, you can remove that line - it's the bootstrap that pushes the proficiency.

Tool proficiencies are a hack, wish that they had done them the way skill proficiencies are done.

One way to try and accomplish what you want would be to:
1. Bootstrap Smith's Tools with the Procienc.Tool tag, AND add a conditional that looks for a field value - like "fieldval:abValue = 1"

2. add your script (postlevel 10000, Before Calc skProfBon )
Look to see if you have the proficiency. If you don't, set abValue to 1 (enabling the bootstrapped tool skill) and EXIT.
Else,
perform hero.assign[ProfTooDbl.gTooSmith]

or

if (hero.tagis[ProfTool.gTooSmith] = 0) then
~ if I can't see that we have the proficiency, set abValue so that the bootstrap fires off
field[abValue].value = 1
else
~ I see that we already have the tool, so let the hero have double proficiency
perform hero.assign[ProfTooDbl.gTooSmith]
endif


What is very important is the extra timing on the script:
Before Calc skProfBon
forces the script to run before any proficiencies bonuses actually get added, without it your script could run after and never works.


I'm having a bit of trouble figuring out when/where to add that before argument, can I do it from the editor's timing button? Or is this something I should add to the .user file with a text editor?
 
Yes, when you hit the timing button there are three fields you can fill in.

Type or paste Calc skProfBon into the Before Scripts box and hit OK.

You don't need anything in the other two, although for troubleshooting you can type a script name to help if you know how to read the timing report or debug statements that might use it.
 
I was getting an error because I literally pasted "Before Calc skProfBon" which still worked but the script would remind me I'd done a boner with every new add.
 
So I've got a subrace that adds Smith's Tools to the character and I used the script add that allows expertise if they already have it.

Phase: Post-levels Priority: 10000 Script:

~ If we're disabled, do nothing
doneif (tagis[Helper.Disable] = 1)

if (hero.tagis[ProfTool.gTooSmith] = 0) then
perform hero.assign[ProfTool.gTooSmith]
perform hero.child[gTooSmith].assign[Helper.TrainTool]
perform hero.child[gTooSmith].assign[Hide.Tool]
perform hero.child[gTooSmith].assign[Proficienc.Tool]
else
foreach pick in hero from BaseEquip where "ProfTool.gTooSmith"
perform hero.assign[ProfTooDbl.gTooSmith]
nexteach
endif

when I add the sub race I get errors. (attached as image)

I cannot add the skill it's not listed with the tools. If I add the Smith's Tools gear it just kind of works.

I'm no script genius but look at your foreach loop carefully... I think you should be doing eachpick.assign, not hero.assign... hero.assign sends the tag to the actor, not the pick you are looping through.
 
Back
Top