• 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 Remove accidental hits on friendly ship

Grey Roger

Sea Dog
Staff member
Administrator
Storm Modder
Each cannon hit on a friendly ship costs you reputation. This is annoying if you're firing chainshot at an enemy's masts and accidentally hit a friendly ship beyond it, or if you're aiming manually and haven't noticed a friendly ship has just crept up and is level with your foremost or aftmost guns.

Could this be changed so that you only lose reputation, and lots of it, if you actually sink (or board) a friendly ship? That pretty well has to be an intentional betrayal, as opposed to accident.

Especially since it's also possible for a friendly ship to accidentally hit you - I've had sails and sometimes masts damaged because someone behind me fired at an enemy in front of me - and they don't lose reputation for it!
 
There is this variable in InternalSettings.h:

Code:
#define EXTRA_HIT_CHECK                1            // BOOL - Enable stray shot hits on friendly ships to cause hostility
                                                //        USE_REAL_CANNONS must be set to 1 for this setting to take effect
                                                //        1: Yes, when a ship is hit, reduce relation to you
                                                //        0: No, accidental hits won't cause hostilities
When it's set to 0 you still take penalty if there was no enemy in sight when you fired, but you shouldn't be penalized otherwise.
 
I'm not sure if that EXTRA_HIT_CHECK is still functional. I rewrote the functionality for this relatively recently when I was redoing the entire Nations Relations system.
If I recall, ships could even turn hostile from accidental hits and I already substantially turned down the effects.

That being said, I've indeed been thinking of indeed having absolutely no effect whatsoever.
That check is being done for each cannonball hit and we know that is a calculation-intensive part of the game as it is.
So kicking out that entire functionality may help with game performance.
And if we don't even what that functionality in the first place, that's an easy win. ;)

So unless anyone else objects, I'd be fine with removing this altogether.

Especially since it's also possible for a friendly ship to accidentally hit you - I've had sails and sometimes masts damaged because someone behind me fired at an enemy in front of me - and they don't lose reputation for it!
Even if they did lose reputation for it, I don't think it would matter anything for NPCs.... :wp
 
I'm not sure if that EXTRA_HIT_CHECK is still functional. I rewrote the functionality for this relatively recently when I was redoing the entire Nations Relations system.
If I recall, ships could even turn hostile from accidental hits and I already substantially turned down the effects.

That being said, I've indeed been thinking of indeed having absolutely no effect whatsoever.
That check is being done for each cannonball hit and we know that is a calculation-intensive part of the game as it is.
So kicking out that entire functionality may help with game performance.
And if we don't even what that functionality in the first place, that's an easy win. ;)

So unless anyone else objects, I'd be fine with removing this altogether.


Even if they did lose reputation for it, I don't think it would matter anything for NPCs.... :wp

I agree with you. I think that feature is unnecessary.
 
I'm not sure if that EXTRA_HIT_CHECK is still functional. I rewrote the functionality for this relatively recently when I was redoing the entire Nations Relations system.
If I recall, ships could even turn hostile from accidental hits and I already substantially turned down the effects.
It got silly during the battle of Justinian plus Indefatigable versus Temeraire. I wasn't intentionally trying to hit Justinian but I was trying to follow Captain Pellew's orders as given at Charlestown:
We may perhaps be better engaged in taking down her masts.
This did result in Temeraire losing both its mainmast and foremast, but it also resulted in Justinian being downrange of enough chains that my reputation went from "Bloke" to "Swindler". Justinian didn't turn hostile. It turned neutral, left the party and headed off, leaving me to take on the Temeraire alone, which wasn't going to end well because I didn't have enough ammo to finish the job. At this point I reloaded an earlier savegame and tried again. :D
Even if they did lose reputation for it, I don't think it would matter anything for NPCs.... :wp
It won't have any major effect on the game, but it's annoying watching my reputation plummet, then watching my companion get away with no effect for committing exactly the same offence. Of course, in a free-play game in which he isn't protected by a 'SetCharacterRemovable(characterFromID(<insert name here>), false)', there's a very simple way of dealing with a companion who shoots up your ship. :walkplank
 
So.... anyone got any objections to sending this old feature to Davy Jones' Locker?
 
The whole "reputation loss/ship can turn hostile" behaviour has now been 100% removed from the "cannonball hits ship" functionality.
So you can keep accidentally hitting friendly ships and you will get no repercussions for that at all.

This functionality is now exclusive to using Manual Aim to deliberately fire on a friendly ship (e.g. firing when the crosshairs are NOT red):
Code:
void Ship_FireAction()
{
   // LDH restored 23Jan09
   aref rCharacter = GetEventData();         // we attack this character
   aref rMainGroupCharacter = GetEventData();     // commander character for rCharacter - PB: This isn't actually used anymore
   ref rMainCharacter = GetMainCharacter();
   int iRelation = GetEventData();

// KK -->
   if (!TestRef(rCharacter) || !TestRef(rMainGroupCharacter)) return;
   int iCharacterIndex = sti(rCharacter.index);
   if (iCharacterIndex < 0) return;
   int iMainGroupCharacterIndex = sti(rMainGroupCharacter.index);
   if (iMainGroupCharacterIndex < 0) return;
// <-- KK

   if (iRelation != RELATION_ENEMY)
   {
     if (IsCompanion(rCharacter) && GetAttribute(rCharacter, "CompanionEnemyEnable") == true)   // If companion that can turn hostile
     {
       ChangeCharacterReputation(rMainCharacter, -20);                       // Double rep loss compared to ShipMutiny() as you did not give them fair warning with a hostile flag
       SeaAI_SetCompanionEnemy(rCharacter);                           // Disconnect companion from our group and set it enemy to us
     }
     else                                             // If other ship
     {
       if(CheckAttribute(rCharacter,"surrendered"))                       // NK: surrendered ships 05-04-20
       {
         if (sti(rCharacter.surrendered.seatime) + 20 < GetSeaTime())             // 20 second grace period
         {
           ChangeCharacterReputation(rMainCharacter, -15);                   // NK: Large rep loss for firing on surrendered ships
         }
       }
       else
       {
         ChangeCharacterReputation(rMainCharacter, -15);                     // NK: Large rep loss for firing on friendly ships
         SetGroupHostile(rCharacter, true);                           // Have them turn hostile; as you fired first, this is a betrayal
         RefreshBattleInterface(true);                             // Update relations and battle interface
       }
     }
   }
}
Would that be OK now?
 
If you're aiming for an enemy ship's masts then the crosshairs won't be red, they'll be yellow, same as if you're aiming at a piece of empty sea - which effectively you are, you're aiming to have your shots land in the sea beyond the enemy ship. I suppose if the crosshairs are green (you're aiming at a companion) or grey (you're aiming at a non-hostile ship) because that piece of sea beyond the target ship isn't empty and you choose to fire anyway, there could be consequences. So if auto-aim never gets you into trouble if there's a non-hostile ship on the other side of the enemy you're trying to dismast, the logical conclusion is never use manual aiming with chainshot.
 
Now that the "negative effect from hitting friendly ships" has been removed, Auto-Aim is 100% safe. That's what we wanted, right?

If you fire chainshot at another ship, but don't have the grey/green crosshairs, you won't get the bad effects either.
It is either "linked to cannonballs hitting" or "linked to firing when the crosshairs are grey/green" or both.
But we can't have half of each, because how would that work?!? o_O
 
Back
Top