• 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

Armor that applies Damage reduction

I am trying to create custom armors that apply half armor bonus and half damage reduction. For example, the first one I am creating is a chain shirt that applies an armor bonus of 2 and a damage reduction of 2.

In the editor I have already copied the chain shirt and labeled it AR- Chain shirt, where AR stands for armor rating (what we are calling damage reduction applied by armor) and have applied it's own unique ID. I have also reduced the armor bonus of the armor to 2.

Where I hit a snag is where I am applying the damage reduction to the armor, I have copied the eval script from the barbarian damage reduction ability to the eval script of my armor but what I am not sure about is which phase to apply it in (currently I have it applied in post-levels, like the barbarian class has) and which value to change to make it a static damage reduction of 2. Below is the script I am working with. What do I need to remove and/or change to make it a bare minimum to apply a damage reduction of 2/- to the wearer and display the damage reduction in the special tab and in the correct place in the stat block.

doneif (tagis[Helper.ShowSpec] = 0)

field[abValue].value += field[xCount].value
field[CustDesc].text = "Damage Reduction (" & field[abValue].value & ") against weapons and natural attacks."
hero.child[xDamRd].field[abValue].value = maximum(hero.child[xDamRd].field[abValue].value, field[abValue].value)


I know this can be done since the guys at Paizocon showed me this in action but I know I am missing something, Any help would be greatly appreciated.
 
Code:
doneif (tagis[Helper.ShowSpec] = 0)
You want something like this as I expect you only want to apply the 2/- when the armor is equipped not when it is just on the character. So to find the correct field add a suit of armor to a character and then Right click on the "?" to get a list of choices. Take the one called something like "Show Debug Fields...".

If you don't see that you have to go to the develop menu, make sure the first option, "Enable Data File Debugging" is checked. This way you can start seeing the name of the fields on Things and their values. Really helpful. Plus this lets you do a Ctrl-R which does a quick reload of the data set. Also very helpful when making changes.

Once you have done that you can equip/un-equip the armor to figure out the field you want to check.
Code:
field[abValue].value += field[xCount].value
xCount only exists on Classes so you want replace the whole field[xCount].value with the amount of DR to provide. By setting the field[abValue].value variable instead of hard-coding just a 2 it leaves you room for outside Things (ie a feat) to affect the amount of DR this armor provides without a script change.

Code:
      field[CustDesc].text = "Damage Reduction (" & field[abValue].value & ") against weapons and natural attacks."
This is just custom text and you won't have need of this.

Code:
      hero.child[xDamRd].field[abValue].value = maximum(hero.child[xDamRd].field[abValue].value, field[abValue].value)
This is very important part here. This says to give a value to the Thing xDamRd (Damage Reduction /-). After the equal it says take either the value of DR that already exists or the value this armor is providing and make our DR that. As normally DR does not stack. So if a character already has 1/- DR and the armor provides 3/- DR you will get a maximum of 3/- not 4/-.

For timing you should be good First 10,000 or later.
 
We actually want armor rating to stack with damage reduction. Does that mean we can just remove the last line?
Code:
    hero.child[xDamRd].field[abValue].value = maximum(hero.child[xDamRd].field[abValue].value, field[abValue].value)
 
We actually want armor rating to stack with damage reduction. Does that mean we can just remove the last line?
Code:
    hero.child[xDamRd].field[abValue].value = maximum(hero.child[xDamRd].field[abValue].value, field[abValue].value)

Not exactly. If you want to stack or ADD then instead of a doing a equal you want to say ADD to what ever DR already exists. So change it to be:
Code:
hero.child[xDamRd].field[abValue].value += field[abValue].value
~ Above is a short hand way of doing the following:
hero.child[xDamRd].field[abValue].value = hero.child[xDamRd].field[abValue].value + field[abValue].valuefield[abValue].value
~ Both the lines above do the exact same thing one is just shorter to write.
~ P.S. anything with a squiggly line in front is a comment in HL.
So now we are saying take the existing Value of Thing.xDamRd and add in the field[abValue].value Value which in this case is 2.

You may need to change the timing of this script to be just before when xDamRd does its calculations as all other DR scripts are set to not stack.

So to find the timing of xDamRd you will need to go to the Ability tab in the editor and do a New (Copy). Then find xDamRd in the list and double click on it. Then click on the Eval Script on the top right corner and see when its Phase/Timing is and go just before it.
 
Gosh, that is an amazing amount of help!
I will give it a shot and let you know what I come up with. The hard part for me is figruing out how to populate the field. I will keep playing with it and thanks again!
 
Back
Top