m'kay - scenario: i'm adding various event handlers to all the loons in the player's group, and i'm wondering how to reference them properly.
there may also be different numbers of troops in the player's group, so i'd rather use an array or somesuch thing, but i've no idea if that can be used in combination with EHs.
to give an example, i have a 'hit' EH which triggers a kevlar script. the action for this can be toggled, like putting on/taking off the vest -
;bodyarmour action
?k_arm:goto "check"
k_arm = true
hint "Bodyarmour:\nEngaged!"
kevlar = player addeventhandler ["hit",{_this exec "boing.sqs"}]
exit
#check
k_arm = false
hint "Bodyarmour:\nDisengaged!"
player removeEventHandler ["hit",kevlar]
exit
so the event handler for the player is easy enough to reference, by the variable 'kevlar'. but what if i have a squadful of them? do i use a format command along with an incremented array? can i use the 'kevlar' reference for all of the loons? is there an easier way?
thanks in advance
EDIT - i'll tack this question on at the end, as it's directly related, but how does one instruct an AI loon to perform a user-added action?
loon_name action ["action_name"]
doesn't work... :-\