armor penetration script for ranged

Post Reply
JaM2013
Sergeant Major - Armoured Train
Sergeant Major - Armoured Train
Posts: 595
Joined: Fri Mar 29, 2013 1:02 pm

armor penetration script for ranged

Post by JaM2013 »

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;
Image
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: armor penetration script for ranged

Post by rbodleyscott »

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;
Well it does what it says in the comments.

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

Image
JaM2013
Sergeant Major - Armoured Train
Sergeant Major - Armoured Train
Posts: 595
Joined: Fri Mar 29, 2013 1:02 pm

Re: armor penetration script for ranged

Post by JaM2013 »

Shouldnt this one POA_adjustment += Min(50, 100); (= 25) be actually 50? Then it would make sense as 50-25=25
Image
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: armor penetration script for ranged

Post by rbodleyscott »

JaM2013 wrote:Shouldnt this one POA_adjustment += Min(50, 100); (= 25) be actually 50? Then it would make sense as 50-25=25
Sorry, I did not make it clear that the number in brackets is the POA_adjustment after that line has been processed.
Richard Bodley Scott

Image
JaM2013
Sergeant Major - Armoured Train
Sergeant Major - Armoured Train
Posts: 595
Joined: Fri Mar 29, 2013 1:02 pm

Re: armor penetration script for ranged

Post by JaM2013 »

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..
Image
Post Reply

Return to “Field of Glory II: Modding”