Dear all
I am trying to make a script detect whether (1) an entity's parent has been targeted in a hostile way by some other ship (that's to enable a missile to target ships attacking the ship that launched the missile), (2) the as-it-were grandparent of an entity has been targeted in a hostile way by some other ship (that's to enable subminitions that launch from the aforementioned missile to target ships attacking the ship that launched the missile).
Now, I've managed to do this (both 1 and 2) when the ship that launches the missile is the player. For then I can just use the following function.
Code: Select all
function isHostile(entity)
{
return (entity.isShip && entity.target && entity.target == player.ship && entity.hasHostileTarget);
}
Apologies if this has been discussed before. I couldn't find such a discussion.