• 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

Template hit point adjustment

gwydion2

Member
I'm working on a template for "Demon spawn" that is basicaly a weaker version of the half fiend. I've been able to copy the half-fiend template adding / subtracting various abilities but I'm stuck on one feature.

I want to add 4 hit points / hit die to the creature, and I've not been able to find a similar feature in another template to copy.

Presumably it needs a script in the Hit dice info section?
 
I agree that's a neater way of doing things, so I went back and copied the scripting that was working in the new feat directly to the template, in "Eval scripts"

Unfortunately, having the script here doesn't produce any effect in creatures with the template. I've checked that phasing and priority are the same for both scripts.

I'm still pretty new at this. Am I missing something obvious that I need to do?
 
Why don't you post the eval script you put on the template here, along with the phase and priority?
 
This one is copied straight from the toughness feat except for the minor adjustment shown in red

phase - post levels priority 5000

~ If we are using the wounds and vigor variant we need to adjust for that
if (hero.tagis[source.UCWound] <> 0) then
~ our bonus is our hit dice
field[abValue].value += herofield[tHitDice].value * 4
else
~ our bonus is our hit dice or 4, whichever is higher
field[abValue].value += maximum(herofield[tHitDice].value * 4, 4)
endif

This one is an exact copy of the toughness feat

phase - post levels priority 15000

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

~ If we are using the wounds and vigor variant we need to adjust for that
if (hero.tagis[source.UCWound] <> 0) then
~ add that bonus to our wounds total
container.child[Wounds].field[wndFeat].value += field[abValue].value
else
~ add that bonus to our hit points
container.child[Totals].field[tBonusHP].value += field[abValue].value
endif

As I said, this works fine when I made a new feat and attached it to the template as a bonus feat, but does nothing when directly put on the template.
 
If those eval scripts are put directly onto the template, I would expect some errors to be thrown. The abValue field doesn't exist on templates, you see. Are you getting any errors? Or did you put the eval script elsewhere?
 
The script is on the template and I didn't get any errors when saved and pressed "test now"
Does explain why it doesn't work though.

What's the correct way to do these adjustments on the template?
 
Maybe combine them into one script and use a variable instead? I must say I am puzzled that you aren't getting an error thrown.

How about something like this:

PostLevel 10000
Code:
var extrahp as number

debug "This is " & this.idstring
~ If we are using the wounds and vigor variant we need to adjust for that
if (hero.tagis[source.UCWound] <> 0) then
debug "We are using the Wounds and Vigor source"
  ~ our bonus is our hit dice
  extrahp += herofield[tHitDice].value * 4
debug "So extrahp is " & extrahp
else
debug "We are NOT using the Wounds and Vigor source"
  ~ our bonus is our hit dice or 4, whichever is higher
  extrahp += maximum(herofield[tHitDice].value * 4, 4)
debug "So extrahp is " & extrahp
  endif

~ If we are using the wounds and vigor variant we need to adjust for that
if (hero.tagis[source.UCWound] <> 0) then
debug "BEFORE container.child[Wounds].field[wndFeat].value is " & container.child[Wounds].field[wndFeat].value
  ~ add that bonus to our wounds total
  container.child[Wounds].field[wndFeat].value += extrahp
debug "AFTER container.child[Wounds].field[wndFeat].value is " & container.child[Wounds].field[wndFeat].value
else
debug "BEFORE container.child[Totals].field[tBonusHP].value is " & container.child[Totals].field[tBonusHP].value
  ~ add that bonus to our hit points
  container.child[Totals].field[tBonusHP].value += extrahp
debug "AFTER container.child[Totals].field[tBonusHP].value is " & container.child[Totals].field[tBonusHP].value
  endif

I included the debugs in case that didn't work. If it compiles fine and appears to be working, then you can just delete them. Otherwise, go to Develop -> Enable Data File Debugging after you have added the template, and then Develop -> Floating Info Windows -> Show Debug Output. Looking at that should tell you where your eval script is going wrong, I think.
 
Back
Top