• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Need Help Figuring out the Dis-masting values.

Jonesie85

Boarding Master
Storm Modder
As you may have guessed. I am trying to modify the dismasting values. By this, i mean reducing the probability of a dismast and/or removing the probability of a dismasting completely. I believe that i am trying to change the dismasting values globally, not just for the player ship. i dont mind that.

Below i have posted a piece of code from the 'Age of Pirates 2\Program\SEA_AI\AIShip.c'. I have highlighted the lines that interest me. my question is posted after that.



float Ship_MastDamage()
{
int iDamageType = GetEventData();
int iMastNum = GetEventData();
float x = GetEventData();
float y = GetEventData();
float z = GetEventData();
float fDamage = GetEventData();
aref rCharacter = GetEventData();

rCharacter.seatime.lasthit = GetSeaTime(); // JA: added for surrender code

switch (iDamageType)
{
case SHIP_MAST_TOUCH_ISLAND:
fDamage = fDamage + 0.25;
break;
case SHIP_MAST_TOUCH_SHIP:
//aref rCollideCharacter = GetEventData();

fDamage = fDamage + 0.2;
break;
case SHIP_MAST_TOUCH_BALL:
int iBallType = sti(AIBalls.CurrentBallType); //ñïîðíî, òê ýòî íå ÿäðà, òîãî êòî ñòðåëÿë, à ñêîðåå ÿäðà ÃÃ
switch (iBallType)
{
case GOOD_BALLS:
fDamage = fDamage + 0.1;
break;
case GOOD_GRAPES:
fDamage = fDamage + 0.05;
break;
case GOOD_KNIPPELS:
fDamage = fDamage + 0.25;
break;
case GOOD_BOMBS:
fDamage = fDamage + 0.15;
break;
}
break;
}


//float fAccuracy = stf(rCharacter.TmpSkill.Accuracy);

//fDamage = fDamage * (1.0 + (0.3 * fAccuracy));

fDamage = Clampf(fDamage);

// if mast fall - play sound
if (fDamage >= 1.0)
{
Play3DSound("mast_fall", x, y, z);
rCharacter.ship.sp = CalculateShipSP(rCharacter); // ðåôðåøèì ïàðóñà îò ìîäåëè
rCharacter.Tmp.SpeedRecall = 0; // ÷òîá ïåðåñ÷èòàëñÿ ìàíåâð
}

return fDamage;
//procMastFall


MY QUESTIONS:- If i was to change...

THIS:-
case GOOD_BALLS:
fDamage = fDamage + 0.1

TO THIS:-
case GOOD_BALLS:
fDamage = 0

Would it mean that if a normal cannon ball hits the mast(s) there is ZERO damage therefore the mast does not fall?


Thank you for your time and patience
 
Again this is some good detective work. We had talked about doing this and I think Luke experimented with it, but I never did anything with it. I was against Buho's mast invincibility work and went off in my own direction.

Let me know how happy you are with the results.

MK
 
You could try the following "Program\STORE == initGoods.C" and change the following line for each shot type entery.

Code:
Goods[GOOD_BALLS].DamageRig = 0.1;
Goods[GOOD_GRAPES].DamageRig = 0.01;
Goods[GOOD_KNIPPELS].DamageRig = 1.0;
Goods[GOOD_BOMBS].DamageRig = 0.1;

Now change them to.

Code:
 Goods[GOOD_BALLS].DamageRig = 0.0;
Goods[GOOD_GRAPES].DamageRig = 0.0;
Goods[GOOD_KNIPPELS].DamageRig = 0.0;
Goods[GOOD_BOMBS].DamageRig = 0.0;

This should drastically nower the chance of sail damage which in turn reduces the chance of a mast falling. But to also reduce the likelyhood of a mast falling go to "Program\SEA_AI == AIShip.c" and change the following code to look as follows.

Code:
switch (iDamageType)
{
case SHIP_MAST_TOUCH_ISLAND:
fDamage = fDamage + 0.0;
break;
case SHIP_MAST_TOUCH_SHIP:
//aref rCollideCharacter = GetEventData();
 
fDamage = fDamage + 0.0;
break;
case SHIP_MAST_TOUCH_BALL:
int iBallType = sti(AIBalls.CurrentBallType); //ñïîðíî, òê ýòî íå ÿäðà, òîãî êòî ñòðåëÿë, à ñêîðåå ÿäðà ÃÃ
switch (iBallType)
case GOOD_BALLS:
fDamage = fDamage + 0.0;
break;
case GOOD_GRAPES:
fDamage = fDamage + 0.0;
break;[/COLOR]
case GOOD_KNIPPELS:
fDamage = fDamage + 0.0;
break;
case GOOD_BOMBS:
fDamage = fDamage + 0.0;
break;

MY QUESTIONS:- If i was to change...

THIS:-
case GOOD_BALLS:
fDamage = fDamage + 0.1

TO THIS:-
case GOOD_BALLS:
fDamage = 0

Would it mean that if a normal cannon ball hits the mast(s) there is ZERO damage therefore the mast does not fall?


Thank you for your time and patience

Yes changing that value to 0 should work as with all changes noted above in place should also work. Trial and error is the only way to go, i suspect that there will be other lines of code placed here and there that will need finding and editing, but for the most part these changes will lower the demasting of ships so much that you will hardly see a mast fall. Or should hardly see a mast fall.
 
I have attacked and sunk well over 200 ships in game since i change the fDamage value to 0.0 (highlightd red) and i have not been dismasted or dismasted any of the 200+. I have not recieved any dismast ctds either.

QUESTION: the blue highlighted value seems to represent the amount of damage a mast must suffer before it plays the dismast sound. Meaning if the total(cumulative or one shot wonder??) damage is equal to or greater than 1.0 the mast falls. Is that correct?


Code:
float Ship_MastDamage()
{
int iDamageType = GetEventData();
int iMastNum = GetEventData();
float x = GetEventData();
float y = GetEventData();
float z = GetEventData();
float fDamage = GetEventData();
aref rCharacter = GetEventData();
 
rCharacter.seatime.lasthit = GetSeaTime(); // JA: added for surrender code
 
switch (iDamageType)
{
case SHIP_MAST_TOUCH_ISLAND:
fDamage = fDamage + [COLOR=#ff0000]0.0[/COLOR];
break;
case SHIP_MAST_TOUCH_SHIP:
//aref rCollideCharacter = GetEventData();
 
fDamage = fDamage +[COLOR=#ff0000] 0.0[/COLOR];
break;
case SHIP_MAST_TOUCH_BALL:
int iBallType = sti(AIBalls.CurrentBallType); //ñïîðíî, òê ýòî íå ÿäðà, òîãî êòî ñòðåëÿë, à ñêîðåå ÿäðà ÃÃ
switch (iBallType)
{
case GOOD_BALLS:
fDamage = fDamage + [COLOR=#ff0000]0.0[/COLOR];
break;
case GOOD_GRAPES:
fDamage = fDamage + [COLOR=#ff0000]0.0[/COLOR];
break;
case GOOD_KNIPPELS:
fDamage = fDamage + [COLOR=#ff0000]0.0[/COLOR];
break;
case GOOD_BOMBS:
fDamage = fDamage + [COLOR=#ff0000]0.0[/COLOR];
break;
}
break;
}
 
 
//float fAccuracy = stf(rCharacter.TmpSkill.Accuracy);
 
//fDamage = fDamage * ([COLOR=#00ccff]1.0[/COLOR] + (0.3 * fAccuracy));
 
fDamage = Clampf(fDamage);
 
// if mast fall - play sound
if (fDamage >=[COLOR=#00ccff] 1.0[/COLOR])
{
Play3DSound("mast_fall", x, y, z);
rCharacter.ship.sp = CalculateShipSP(rCharacter); // ðåôðåøèì ïàðóñà îò ìîäåëè
rCharacter.Tmp.SpeedRecall = 0; // ÷òîá ïåðåñ÷èòàëñÿ ìàíåâð
}
 
return fDamage;
//procMastFal
 
I reopen this old topic to ask a question: in the game there is a difference between large ships (victory) and small ships? Are the hp of the mast in proportion to the size of the ship?
I modified the hp sails of a ship to 50,000 hp, but after a few shots the mast falls...
I like to see the mast fall but I'd like to be more difficult to bring down those of large ships. (sorry for my bad English)
 
If it is somewhat similar to PotC, then probably the "Sail HP" is completely unrelated to masts falling.
For that, you'd have to go digging through the PROGRAM\SEA_AI folder most likely.
 
Back
Top