• 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!

Fixed Reduce Fire Drill Log Messages

Levis

Find(Rum) = false;
Staff member
Administrator
Creative Support
Programmer
Storm Modder
Do other people also have performance issues in storms?
As soon as I hit a stom I'm flooded with firedrill messages etc....
 

Attachments

  • error.log
    100.5 KB · Views: 80
Code:
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 2332
function 'Ship_GetDistance2D' stack error
That is related to changes you made for the submerged Dutchman. I strongly suspect it is related.
 
Yeah fixed those already, but there where more right?
 
As soon as I hit a stom I'm flooded with firedrill messages etc....
Those will appear if you are hit by lightning, which sets your ship on fire.
They'll keep appearing until you execute a Fire Drill and extinguish the fire.
While active, this message will always be the last thing to display. If you keep changing time compression, for example, the fire drill message will keep popping up.
But if you don't press any buttons, then it will not flood the screen.

The reason is in PROGRAM\SEA_AI\AIShip.c in the Ship_FireDamage function:
Code:
  if (fTotalFireTime > 0.0) // KK
   {
     PostEvent(SHIP_FIRE_DAMAGE, iTime, "lllf", iOurCharacterIndex, iBallCharacterIndex, iFirePlaceIndex, fTotalFireTime);
     if(!bAbordageStarted)
     {
       if (sti(GetAttribute(rOurCharacter, "Index")) == GetMainCharacterIndex() && CheckAttribute(rOurCharacter, "Ship.Sink") == false && FIREDAMAGE > 1) { // KK
         Log_SetStringToLog(TranslateString("","Fire still burning! Execute firedrill procedure immediately!"));
       }   //ccc firedrill MAR18 // KK
       if (needstopall) CreateParticleSystem("ball_impact", fX, fY, fZ, 0.0, 0.0, 0.0, 0); // ccc some smoke if fireparticle was deleted above, NK do only if needed
     }
   }
That function is probably executed VERY frequently. Possibly every second, maybe more.

Might be possible to add an attribute so that the message is only shown once. Or once every minute or so. Not sure if it is worth the effort, though.
Especially since such an attribute would have to be deleted again at some point and there are many functions and variables to consider there.

Simple "solution" might be:
Code:
  if (fTotalFireTime > 0.0) // KK
   {
     PostEvent(SHIP_FIRE_DAMAGE, iTime, "lllf", iOurCharacterIndex, iBallCharacterIndex, iFirePlaceIndex, fTotalFireTime);
     if(!bAbordageStarted && LogsToggle > LOG_LACONIC) // PB
     {
       if (sti(GetAttribute(rOurCharacter, "Index")) == GetMainCharacterIndex() && CheckAttribute(rOurCharacter, "Ship.Sink") == false && FIREDAMAGE > 1) { // KK
         Log_SetStringToLog(TranslateString("","Fire still burning! Execute firedrill procedure immediately!"));
       }   //ccc firedrill MAR18 // KK
       if (needstopall) CreateParticleSystem("ball_impact", fX, fY, fZ, 0.0, 0.0, 0.0, 0); // ccc some smoke if fireparticle was deleted above, NK do only if needed
     }
   }
That at least allows you to disable the message with the Logs Toggle.
Alternatively, link it to the difficulty level like so:
Code:
  if (fTotalFireTime > 0.0) // KK
   {
     PostEvent(SHIP_FIRE_DAMAGE, iTime, "lllf", iOurCharacterIndex, iBallCharacterIndex, iFirePlaceIndex, fTotalFireTime);
     if(!bAbordageStarted && GetDifficulty() < DIFFICULTY_ADVENTURER) // PB
     {
       if (sti(GetAttribute(rOurCharacter, "Index")) == GetMainCharacterIndex() && CheckAttribute(rOurCharacter, "Ship.Sink") == false && FIREDAMAGE > 1) { // KK
         Log_SetStringToLog(TranslateString("","Fire still burning! Execute firedrill procedure immediately!"));
       }   //ccc firedrill MAR18 // KK
       if (needstopall) CreateParticleSystem("ball_impact", fX, fY, fZ, 0.0, 0.0, 0.0, 0); // ccc some smoke if fireparticle was deleted above, NK do only if needed
     }
   }
After all, most regular players by now would KNOW that you should execute a Fire Drill if you're on fire.

Making it show up only once in the game is quite doable too.
I put in similar tricks for explanations in the Archipelago Map and F2>Nation Relations interface too.

So what shall it be?
 
I'd Say for each Fire there should be 1 message.
so just post a message if a Fire is created should do the trick
 
Looks like the initial report is already there:
Code:
void Ship_ActivateFirePlace()
{
   if(LAi_IsBoardingProcess() || ownDeckStarted()) return; // NK bugfix for boarding
   aref   arShipObject = GetEventData();
   aref   arCharacter = GetEventData();
   if(GetCharacterShipType(&arCharacter)==SHIP_BOAT || GetCharacterShipType(&arCharacter)==SHIP_NOTUSED) return;//MAXIMUS
   int     iFirePlaceIndex = GetEventData();
   string   sSoundName = GetEventData();
   float   fFireTime = GetEventData();

   aref   arPos; makearef(arPos, arCharacter.Ship.Pos);

   // LDH iSoundID will almost always be zero, probably because it's too far away to hear if on another ship - 25Mar09
   int iSoundID = Play3DSoundComplex(sSoundName, stf(arPos.x), 0.0, stf(arPos.z), true, false);
   string tmpstr = iFirePlaceIndex; arCharacter.fireplaces.(tmpstr) = iSoundID; // NK 05-04-19
   SendMessage(arShipObject, "llsslf", MSG_SHIP_ACTIVATE_FIRE_PLACE, iFirePlaceIndex, "ship_smoke", "ship_fire", iSoundID, fFireTime);

   // ccc firedrill
   if(IsMainCharacter(arCharacter) && !CheckAttribute(arCharacter, "Ship.Sink")) { // so this runs only for the player // KK
     DeleteAttribute(arCharacter,"firedrill"); // deletes the markerattribute that starts firedrill
     if (FIREDAMAGE > 1) {
       AddPerkToActiveList("FireOnShip"); // KK
       Log_SetStringToLog(TranslateString("","Fire! Execute firedrill procedure!")); // infomessage MAR18 // KK
       PlaySound("interface\notebook.wav"); // soundeffect MAR18
     }
   }
   // ccc firedrill end
}
This here is just a further reminder:
Code:
  if (fTotalFireTime > 0.0) // KK
   {
     PostEvent(SHIP_FIRE_DAMAGE, iTime, "lllf", iOurCharacterIndex, iBallCharacterIndex, iFirePlaceIndex, fTotalFireTime);
     if(!bAbordageStarted && LogsToggle > LOG_NORMAL)
     {
       if (sti(GetAttribute(rOurCharacter, "Index")) == GetMainCharacterIndex() && CheckAttribute(rOurCharacter, "Ship.Sink") == false && FIREDAMAGE > 1) { // KK
         Log_SetStringToLog(TranslateString("","Fire still burning! Execute firedrill procedure immediately!"));
       }   //ccc firedrill MAR18 // KK
       if (needstopall) CreateParticleSystem("ball_impact", fX, fY, fZ, 0.0, 0.0, 0.0, 0); // ccc some smoke if fireparticle was deleted above, NK do only if needed
     }
   }
I'm changing this to show on the maximum log level only. So by default now, it will show only on fire start and no more afterwards.
 
Guess this can go to fixed?
 
Uhm.. I just was in a storm with my Heavy Pinnace and she was hit by a lightning. I got this firedrill message like 5 times in 1 second and her HP went down from 90% to 10% in 20 seconds.. so something is definitly not right here.
 
That might be due to the AIShip.c errors with the Dutchman fix.
I returned some code to normal for that in my own files. Will upload that later when I am done fixing things for today.
 
Back
Top