• 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

Feat Help

Manalishi66

Well-known member
I have a race that chooses from one of five energy resistances (acid, cold, fire, electricity or sonic). It gets #applyresist[xDamRsCold, 5] resistance, etc.

The feat I'm trying to code allows the race to add 5 to the chosen resistance. How is this done. I have looked over the forums and HL and can not find an example that I understand? Any help would be welcomed.
 
You create a feat with a selector and then you have to check what energy type is chosen using the field[usrChosen1].chosen.tagis[XXX.XXX] approach and apply the appropriate one as needed.
 
Ok., I have not done uiser chosen so I do not know where to begin. Was sort of looking for an example I could modify.
 
So lets make sure we are all on the same page. It sounds like to me that you have a "Racial Special" that needs to choose the Elemental Type. And the feat only increases the value that the Racial Special choose. Is that right?

Or is the Racial Special always giving "cold" and the feat can add another elemental type or increase the cold...
 
Yes. The feat increases the existing resistance by 5 or allows the user to change the original chosen racial to another and add 5 to that new one.
 
So in this example we are going to be using some existing tags to control the Type of Energy resistance. We will be using abValue to store our value so that an outside Thing (Feat) can adjust the amount.

For this example the Racial Special is (thingid.raXXCold) and the Feat is (thingid.fXXXX). The Racial Special will have the tag BloodEner.Cold setup as default on itself. You do this by clicking on the "Tags" button in the top right corner.

Then setup this srcript on the Racial Special:
Post-Levels/10000
Code:
[B][COLOR="Green"]~ If we're disabled, do nothing[/COLOR][/B]
doneif (tagis[Helper.SpcDisable] <> 0)

[B][COLOR="Green"]~ Default to 5 resistance[/COLOR][/B]
field[abValue].value += 5

[B][COLOR="Green"]~ Apply the correct type of energy resistance[/COLOR][/B]
If (tagis[BloodEner.Acid] <> 0) then
   #applyresist[xDamRsAcid,field[abValue].value]
Elseif (tagis[BloodEner.Elec] <> 0) then
   #applyresist[xDamRsElec,field[abValue].value]
Elseif (tagis[BloodEner.Fire] <> 0) then
   #applyresist[xDamRsFire,field[abValue].value]
Elseif (tagis[BloodEner.Cold] <> 0) then
   #applyresist[xDamRsCold,field[abValue].value]
Endif

[B][COLOR="Green"]~ Set livename to include the type of energy[/COLOR][/B]
field[livename].text = field[name].text & " (" & tagnames[BloodEner.?] & ")"
So the above sets 5 in the abValue field. This field can be adjusted by other Things. Then we figure out which energy type based on the tag that is assigned. By default this will be BloodEner.Cold. But we can easily change this with other scripts.

Here is the script you will run on your new feat. Set the "Select From" field on the feat to "Energy Type (Base 4)".
Pre-Levels/10000
Code:
[B][COLOR="Green"]~ If we're disabled, do nothing[/COLOR][/B]
doneif (tagis[Helper.FtDisable] <> 0)
[B][COLOR="Green"]~ If nothing chosen get out now[/COLOR][/B]
doneif (field[usrChosen1].ischosen <> 1)
[B][COLOR="Green"]~ If racial special not live get out now![/COLOR][/B]
doneif (hero.childlives[raXXCold] <> 1)
[B][COLOR="Green"]
~ Pull the type of Energy tag[/COLOR][/B]
perform field[usrChosen1].chosen.pulltags[BloodEner.?]

[B][COLOR="Green"]~ Set the racial ability to the chosen type[/COLOR][/B]
perform hero.child[raXXCold].delete[BloodEner.?]
perform hero.child[raXXCold].pushtags[BloodEner.?]

[B][COLOR="Green"]~ Increase amount by 5[/COLOR][/B]
#value[raXXCold] += 5
The above checks to make sure the feat is not disabled. It checks to make sure something was chosen (ie energy type). And makes sure the racial special is live on the hero.

Then then pulls the BloodEnergy tag from the energy type Thing to the feat. Then we delete the BloodEnergy tag on the Racial Special and then assign the new one. Finally we increase the "abValue" using the #value[] by 5.
 
Everything worked as you said..but I did not make clear that the race chooses from one of the four resistances when created. Then if he gets the feat he can change it to a different resistance with a +5 bonus or keep what he initially chose and gain +5.


Sorry, forgot energy type (base 4) on race. Late night. Everything ok.
 
Last edited:
Everything worked as you said..but I did not make clear that the race chooses from one of the four resistances when created. Then if he gets the feat he can change it to a different resistance with a +5 bonus or keep what he initially chose and gain +5.
Well then! That is a tad different... :p The gears are turning slower as it approaches midnight! Give me a minute to think.
 
How can you add Sonic resistance to the list? Tried get error?

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

Syntax error in 'eval' script for Thing 'raChaosReX' (Eval Script '#1') on line 16
-> Tag 'BloodEner.Soni' not defined

Let me guess..tagis[BloodEner.Soni..does not exist?
 
Last edited:
Ok so this is similar but our "value" (ie 5 or 10) is calculated based on the number of BloodEner.? tags we find. Then we change the "elseif" into just "if" statements as we can now have multiple different types of Energy Resistance.

Then we remove the delete tag line from the feat and the adding 5.

So on the Racial Special:
Code:
~ If we're disabled, do nothing
doneif (tagis[Helper.SpcDisable] <> 0)

~ Apply the correct type(s) of energy resistance
if (tagis[BloodEner.Acid] <> 0) then
   ~ Calc value as 5 times the number of specific energy types found
   field[abValue].value = 5 * tagcount[BloodEner.Acid]
   #applyresist[xDamRsAcid,field[abValue].value]
endif
if (tagis[BloodEner.Elec] <> 0) then
   ~ Calc value as 5 times the number of specific energy types found
   field[abValue].value = 5 * tagcount[BloodEner.Elec]
   #applyresist[xDamRsElec,field[abValue].value]
endif
if (tagis[BloodEner.Fire] <> 0) then
   ~ Calc value as 5 times the number of specific energy types found
   field[abValue].value = 5 * tagcount[BloodEner.Fire]
   #applyresist[xDamRsFire,field[abValue].value]
endif
if (tagis[BloodEner.Cold] <> 0) then
   ~ Calc value as 5 times the number of specific energy types found
   field[abValue].value = 5 * tagcount[BloodEner.Cold]
   #applyresist[xDamRsCold,field[abValue].value]
endif

~ Set livename to include the type of energy
field[livename].text = field[name].text & " (" & tagnames[BloodEner.?,", "] & ")"

The Feat:
Code:
~ If we're disabled, do nothing
doneif (tagis[Helper.FtDisable] <> 0)
~ If nothing chosen get out now
doneif (field[usrChosen1].ischosen <> 1)
~ If racial special not live get out now!
doneif (hero.childlives[raXXCold] <> 1)

~ Pull the type of Energy tag
perform field[usrChosen1].chosen.pulltags[BloodEner.?]

~ Set the racial ability to the chosen type
perform hero.child[raXXCold].pushtags[BloodEner.?]
 
How can you add Sonic resistance to the list? Tried get error?

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

Syntax error in 'eval' script for Thing 'raChaosReX' (Eval Script '#1') on line 16
-> Tag 'BloodEner.Soni' not defined
This is a excellent learning opportunity. So I will let you add sonic logic. To find the right tag lets use some debugging tools. :)

Go to "Develop->Floating Info Windows->Show Selection Tags". In the search bar type in "Sonic". You get four Picks to choose from. One of these is the "Selection" for Sonic Energy. Check mark that one and press "ok". You will find the correct Tag in the new window. :)
 
Ok. I found it. It compiled ok. but.. it does not show up as selectable with the race, just the first four....Aaaaaaaa! I reloaded HL just in case...nothing.

Code:

~ If we're disabled, do nothing
doneif (tagis[Helper.SpcDisable] <> 0)

~ Default to 5 resistance
field[abValue].value += 5

~ Apply the correct type of energy resistance
If (tagis[BloodEner.Acid] <> 0) then
#applyresist[xDamRsAcid,field[abValue].value]
Elseif (tagis[BloodEner.Elec] <> 0) then
#applyresist[xDamRsElec,field[abValue].value]
Elseif (tagis[BloodEner.Fire] <> 0) then
#applyresist[xDamRsFire,field[abValue].value]
Elseif (tagis[BloodEner.Cold] <> 0) then
#applyresist[xDamRsCold,field[abValue].value]
Elseif (tagis[BloodEner.Sonic] <> 0) then
#applyresist[xDamRsSoni,field[abValue].value]
Endif

~ Set livename to include the type of energy
field[livename].text = field[name].text & " (" & tagnames[BloodEner.?] & ")"
 
Last edited:
Ok. I found it. It compiled ok. but.. it does not show up as selectable with the race, just the first four....Aaaaaaaa! I reloaded HL just in case...nothing.
Opps. So add a select from on the racial special. Remove the blood energy tag on the RS. Then move the pulltag logic from the feat to just after the done if in the RS. That way both the feat and RS will set the BloodEner.? Tag on the RS. :)

P.s - the above mods only work on the code I have in post #10.
 
Last edited:
Got everything working ok. Big thanks for the help! Had another brainfart at first....forgot new feat code.
 
Last edited:
Back
Top