cfrag Posted December 13, 2021 Posted December 13, 2021 (edited) I'm using a small script that removes clutter from the map: the 'parachute guy' that you get when pilots eject from the plane. Doing that is simple: wait for the landing_after_eject event, and then Unit.Delete(event.initiator) Now, imagine you are a player and get shot down. You eject, and do not re-slot: after ejecting, you simply enjoy the show and follow the parachute to the ground. Interestingly, if a player ejects, the player-controlled pilot unit that represents the ejected pilots does NOT correctly return the player name (via :getPlayerName()), so it's impossible to distinguish this unit from an AI unit. This creates a problem: if your script goes ahead and Unit.delete(event.initiator), that *will* create a pilot_dead event for the unit that they ejected from (the plane!). Conversely, if I re-slot before the parachute reaches the ground, deleting the parachute guy after touch-down will not result in a pilot_dead event. So my question: why is the pilot_dead triggered on deleting the parachute unit, and why is that event tied to the plane unit that the player ejected from? I propose that when a player 'controls' the parachute guy it properly returns the player's name for :getPlayerName when the player re-slots, :getPlayerName() for the parachute guy now returns nil I know that this is a minor issue, but this inconsistency (not being able to see that the parachute guy is being controlled by a player) requires an ungainly work-around for my CSAR mission detection (I now delete all parachute guys not immediately, but after 3 minutes to avoid the incorrect pilot_dead event, in the hopes that the player has re-slotted until then). Edited December 13, 2021 by cfrag
Recommended Posts