Page 1 of 1
Ignoring Friendly Fire
Posted: Fri Oct 02, 2009 6:12 pm
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?
Posted: Fri Oct 02, 2009 7:24 pm
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.