A couple of issues here:
- You only update warningDeserter and Deserter arrays when the triggers are activated. This means it would be quite possible for the player to not get warned/killed if an AI has entered the zone before they enter. To operate as you wish, you need to name the triggers and use:
? (player in (list warningDeserterTrigger)) : goto "warning"
? (player in (list killDeserterTrigger)) : goto "deserter"
- You start the script from the player object init placed in the editor. This unnecessarily breaks the script in MP. You need to either:
- Start the script in init.sqs, but abandon the script if on a dedicated server.
- Start the script from the player object init, but pass through the object as a parameter (rather than using player) and exit the script if the object isn't local.
- You can only ever have one of each type of trigger in a mission, since you are using hard-coded global variables.
Alternatively though, you could avoid using a script entirely by just using a activation of "player in thisList" in both triggers and put the code in the trigger activations (or put the code in two scripts and exec the script from the appropriate activations; this has the advantage that you can have more than one of each type of trigger without repeating the code):
playsound "Warning_Deserter"; Hint "Warning. You are leaving the Mission Zone. Turn back or you will face Termination!"
playsound "Deserter"; Hint "You have abandoned the Mission Zone. You will now Die a Traitor!";~6;player setdamage 1
As another alternative, perhaps you could work with Norrin to put your sounds in his Out of Bounds script. As far as I can tell, Norrin's script is more comprehensive than yours, so you might not want to work further on this script in order to make it no better than his.