OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: THobson on 23 Apr 2005, 18:04:21
-
My brain is a bit fuddled. I know how to give a named individual a switchmove to do when they are killed. What I want to do is to give the switchmove to a batch of units that don't have individual names or at least I don't know what they are.
I have tried:
{_x addEventHandler ["Killed",format ["%1 ",_x]+{switchMove "FXStandSurDead"}]} forEach units infGrp
I get an error:
WEST |#|Bravo Black 7 switchMove "FXStandSurDead": Error unknown operator Bravo
{_x addEventHandler ["Killed",format ["%1 switchMove {FXStandSurDead}",_x]]} forEach units infGrp
Gives exactly the same result
This works for a single named unit:
unitname addEventHandler ["Killed",{unitname switchMove "FXStandSurDead"}]
I am losing the will to live.
-
I'm a bit hazy on this, but doesn't the EH return certain paramaters? Could you have _this select 0 switchmove instead of the format stuff?
There's a square bracket missing in the second one.
-
{_x addEventHandler ["Killed",{_this select 0 switchMove "FXStandSurDead"}]} foreach units infGrpWorks...
But it doesn't look good if the soldier was lying on the ground when getting shot. Soldier will suddenly jump to a standing position and then fall back down. Not good.
-
Thank you both.
Baddo - the guys that will get this are standing up with their hands on their heads - promise
Missing square bracket - by gad sir you are right. I could have sworn I copied and pasted from the trigger - maybe I forgot to do it again after I got a 'bracket missing error' and I certainly remember a few of those.