As frankly I cant make heads or tails of how it works.
I wanted to use damage reduction behaviors, and I didn't want to use one for every single point of armor. So I used stacking behaviors and calculated the needed amount of stacks to get the reduction, based on WC3s armor formula.
For example:
I got a hero with 2 armor. This means, it should have (2 x 0.06)/(1+ 2 0 0.06) = 10.7% damage reduction based on the WC3 formula. Then I calculate the stacks of my reduction behaviors I need to apply. For this, I need information on the stacking of damage reduction behaviors. Since patch 1.4, damage reductions from all behaviors stack multiplicatively, so stacking 2 behaviors with 50% damage reduction will not result in 100%, but 75% reduction.
This means, we can use logarithms to calculate the needed amount of stacks to achieve a specific damage reduction.
This also means, that every change in armor needs to be tracked via trigger to apply the changes to the behavior stacks. For this, I use an armor attribute, which can be tracked via trigger, whenever it changes.
Thats because I used injected galaxy script. It was only meant to be a proof of concept, not a tutorial map, so it does not really have readable code.
You can look at the script by opening the Import Manager (F9), checking the Show Reserved - Flag and then opening the MapScript.galaxy file; however it is generated Galaxy++ script, which makes it kind of hard to read.
Here is the Galaxy++ source code for the main calculation stuff, if you need it.
Ok so I've figured out that trying to use actual armour values will probably not work but behaviours will.
So how do I create this using behaviours?
I'm assuming I may have to use triggers as well it seem behaviours cant do math (unless I'm mistaken).
*click*
I saw that but I mean I want to get it to rise with agility or upgrades is this possible to do with this?
As frankly I cant make heads or tails of how it works.
Yes.
I wanted to use damage reduction behaviors, and I didn't want to use one for every single point of armor. So I used stacking behaviors and calculated the needed amount of stacks to get the reduction, based on WC3s armor formula.
For example:
I got a hero with 2 armor. This means, it should have (2 x 0.06)/(1+ 2 0 0.06) = 10.7% damage reduction based on the WC3 formula. Then I calculate the stacks of my reduction behaviors I need to apply. For this, I need information on the stacking of damage reduction behaviors. Since patch 1.4, damage reductions from all behaviors stack multiplicatively, so stacking 2 behaviors with 50% damage reduction will not result in 100%, but 75% reduction.
This means, we can use logarithms to calculate the needed amount of stacks to achieve a specific damage reduction.
This also means, that every change in armor needs to be tracked via trigger to apply the changes to the behavior stacks. For this, I use an armor attribute, which can be tracked via trigger, whenever it changes.
@Kueken531: Go
Ok but I dont see any triggers in the trigger editor and if I add one the trigger which I cannot see seems to stop working for the armour system.
Thats because I used injected galaxy script. It was only meant to be a proof of concept, not a tutorial map, so it does not really have readable code.
You can look at the script by opening the Import Manager (F9), checking the Show Reserved - Flag and then opening the MapScript.galaxy file; however it is generated Galaxy
++
script, which makes it kind of hard to read.Here is the Galaxy
++
source code for the main calculation stuff, if you need it.Ah cheers that makes a lot of sense I completely forgot about Galaxy++