What I have here is an eventhandler (killed) launching a script local to the killed member of the player squad. The object of that script is to add an action to the dead body that is visible for all players, so anyone can activate the action to respawn the dead (ie. teleport the instantly-spawned-but-away-teleported-soldier to the location of the body). Surprisingly, this doesn't work straight away. The scripts that I'm using are these (derived from the old revive respawn by doolittle):
The script launched by the eventhandler
;hint format ["dead: %1",_this]
_string = _this select 0
_body= call _string
_grp=group _body
enableradio false
[(call _string)] join grpNull
enableradio true
?_body == player: [player,_string,_body] exec "cam.sqs"
?local _body && _body!=player:[ObjNull,_string,_body] exec "cam.sqs"
~1
[server,_body,_string,_grp] call {deadpeople2=deadpeople2+[[_this select 1,format [{"%1"},_this select 2],_this select 3]]}
[server,_string] call {deadpeople=deadpeople + [_this select 1]}
tmpDead=_body
tmpDeadName=_string
~random 5
publicvariable "tmpDead"
publicvariable "tmpDeadName"
exit
This script was first used to add the action, but obviously that action was utterly local to the dead man, which is somewhat redundant. The solution should've been the following script, ran locally by every player to add the action to the body locally. The script is launched in the init.sqs by a foreach command for each member of the player squad.
?_this!=player:exit ; AIs don't need this
tmpdead=ObjNull
tmpdeadname=ObjNull
#loop
~0.5
?isNull tmpDead:goto "loop"
tmpDead addaction [format ["Revive %1", name (call tmpDeadName)],"revive.sqs"]
tmpdead=ObjNull
tmpdeadname=ObjNull
publicVariable "tmpDead"
publicVariable "tmpDeadname"
goto "loop"
exit
The script works well for the server with AI loons, but the other players can see no revive action for anyone, and no non-server player receives the action to their body when killed. Any ideas on how this could work as intended?
The revive script itself works just fine.