Ignoring Friendly Fire

General discussion for players of Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
Cmd. Cheyd
---- E L I T E ----
---- E L I T E ----
Posts: 934
Joined: Tue Dec 16, 2008 2:52 pm
Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...

Ignoring Friendly Fire

Post by Cmd. Cheyd »

Is there way to make a ship ignore brief friendly-fire from a player.ship?

Or is there a way to remove player.ship from an NPC's "agro list" ? and allow the player to return to normal?
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2877
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Post by LittleBear »

You can get the ship to check who is shooting it and either fire back or not depending on who shot it. The scripts on the NPC hunters in Random Hits do this, so they will take a stray shot from a space bar as friendly fire. Dealing with the player is a bit more tricky as his AI is unpredicable! You know that a police ship won't deliberatley shoot another police ship, so you can safely tell a police ship to ignore all shots from a ship with the role police, as these will definatley be accidental friendly fire. Same can't be said of the player. What you could do though would be send a "PLAYER_ATTACK" message to the AI. First time it gets it, send the AI into a 2 sec pause state. At the end of the pause return to its normal state. But if it gets a second "PLAYER_ATTACK" whilst in the pause state it switches to an Attack Ship state, were it no longer checks for player attacks and just fights normally. That (should) mean that the ship would ignore a stray shot be the player, but a second shot would trigger an attack.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
Post Reply