Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - D&D 5th Edition SRD (http://forums.wolflair.com/forumdisplay.php?f=89)
-   -   Adding Tool Proficiency script not working (http://forums.wolflair.com/showthread.php?t=64334)

Enforcer84 May 14th, 2020 05:30 PM

Adding Tool Proficiency script not working
 
1 Attachment(s)
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.

Fenris447 May 15th, 2020 08:07 AM

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.

dungeonguru May 16th, 2020 09:21 AM

I don't think that the line that pushes the proficiency to the link table actually works (perform root.linkage[table].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.

Enforcer84 May 18th, 2020 01:20 PM

Thanks guys!

Enforcer84 May 18th, 2020 01:37 PM

Quote:

Originally Posted by dungeonguru (Post 288643)
I don't think that the line that pushes the proficiency to the link table actually works (perform root.linkage[table].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?

dungeonguru May 18th, 2020 04:17 PM

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.

Enforcer84 May 18th, 2020 06:44 PM

Works perfectly! Thank you!

Fenris447 May 19th, 2020 05:50 AM

And this is why dungeonguru is the master. :D

Enforcer84 May 24th, 2020 07:25 PM

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.

RavenX May 24th, 2020 11:50 PM

Quote:

Originally Posted by Enforcer84 (Post 288610)
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.


All times are GMT -8. The time now is 06:39 PM.

Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.