if (IsFoot(target) == 1) // Target is foot
{
// Note, the code below results in: BodyArmour 0 gives + 50 POA, 50 gives -25 POA, 100 gives -100 POA, BodyArmour 200 gives -150 POA, BodyArmour 300 gives -200 POA
// (Not including the -50 for death roll adjustment)
POA_adjustment = GetAttrib(target, "BodyArmour") - 100;
POA_adjustment = POA_adjustment / 2;
POA_adjustment = Max(POA_adjustment, -50);
POA_adjustment += Min(GetAttrib(target, "BodyArmour"), 100);
POA -= POA_adjustment;
armor penetration script for ranged
armor penetration script for ranged
can somebody explain to me how this script works exactly?

-
rbodleyscott
- Field of Glory 2

- Posts: 28323
- Joined: Sun Dec 04, 2005 6:25 pm
Re: armor penetration script for ranged
Well it does what it says in the comments.JaM2013 wrote:can somebody explain to me how this script works exactly?if (IsFoot(target) == 1) // Target is foot
{
// Note, the code below results in: BodyArmour 0 gives + 50 POA, 50 gives -25 POA, 100 gives -100 POA, BodyArmour 200 gives -150 POA, BodyArmour 300 gives -200 POA
// (Not including the -50 for death roll adjustment)
POA_adjustment = GetAttrib(target, "BodyArmour") - 100;
POA_adjustment = POA_adjustment / 2;
POA_adjustment = Max(POA_adjustment, -50);
POA_adjustment += Min(GetAttrib(target, "BodyArmour"), 100);
POA -= POA_adjustment;
The only way to see how it works is to pick a value for the armour, and then go through it step by step.
So, for example, if the armour rating is 50 (Protected):
POA_adjustment = 50 - 100; (= -50)
POA_adjustment = -50 / 2; (= -25)
POA_adjustment = Max(-25, -50); (= -25)
POA_adjustment += Min(50, 100); (= 25)
POA -= 25; (= -25)
Richard Bodley Scott


Re: armor penetration script for ranged
Shouldnt this one POA_adjustment += Min(50, 100); (= 25) be actually 50? Then it would make sense as 50-25=25

-
rbodleyscott
- Field of Glory 2

- Posts: 28323
- Joined: Sun Dec 04, 2005 6:25 pm
Re: armor penetration script for ranged
Sorry, I did not make it clear that the number in brackets is the POA_adjustment after that line has been processed.JaM2013 wrote:Shouldnt this one POA_adjustment += Min(50, 100); (= 25) be actually 50? Then it would make sense as 50-25=25
Richard Bodley Scott


Re: armor penetration script for ranged
ok, so simplest solution to my problem with javelins would be to change the value 100 in POA_adjustment = GetAttrib(target, "BodyArmour") - 100; to larger value.. effect against unarmored would be same (POA 50), while against armor, penalty would decrease.. with value 200, POA against armor 100 would be -50 instead of -100. with 150, it would be -75..

