Horner 13 Posted September 10, 2012 Here's my setup for a revive script. Basically a script is running on a client all the times and triggers this code when you die. It essentially respawns you and moves you back to the position you died and changes your animation. The problem is after the fnc_revive.sqf script runs it doesn't return you back to the normal animation. Here's the code from the respawn.sqf. respawn.sqf waitUntil {alive player}; hidebody role; _emtonline = false; for "_i" from 0 to (count playableUnits) do { if ((side (playableUnits select _i) == EAST && playableUnits select _i != player)) then { _emtonline = true; }; }; if (_emtonline) then { player setVariable ["Revived",0,true]; player allowDamage false; player setPos [revivePos select 0, revivePos select 1, revivePos select 2]; [nil,player,rPlayMove,"AidlPpneMstpSnonWnonDnon_SleepB_death"] call RE; role = player; _count = 300; while {needsRevive || _count >= 0} do { hintSilent format ["%1 seconds left", _count]; if (_count == 0) then { player allowDamage true; player setDamage 1; needsRevive = false; _lives = _lives + 1; hidebody role; deleteMarker _deadmrk; hintSilent ""; }; _revived = player getVariable "Revived"; if ((player getVariable "Revived") == 1) then { needsRevive = false; [nil,player,rSwitchMove,""] call RE; player groupChat "You have been revived!"; deleteMarker _deadmrk; hintSilent ""; player allowDamage true; }; _count = _count - 1; sleep 1; }; } else { _lives = _lives + 1; deleteMarker _deadmrk; needsRevive = false; disableUserInput true; player groupChat "No EMTs online, please wait 30 seconds to continue playing"; sleep 30; disableUserInput false; }; And basically there's a loop which adds an action for the medic to be able to revive you. And here's the code for the action. fnc_revive.sqf private["_target"]; _target = (_this select 3) select 0; player groupChat format ["Reviving - %1", name _target]; if (animationState _target != "AidlPpneMstpSnonWnonDnon_SleepB_death") exitWith {player groupChat "No one to revive!";}; player removeAction revive; [nil,player,rSwitchMove,"AinvPknlMstpSnonWrflDr_medic0"] call RE; sleep 10; [nil,player,rSwitchMove,""] call RE; player groupChat "You have revived this player!"; _target setVariable ["Revived",1,true]; [nil,_target,rSwitchMove,""] call RE; With _target defining the nearest downed man in the looping script. It defines the man correctly and all but I think the problem with the set variable command as with the respawn.sqf loop it never detects that getVariable "revived" == 1. But clearly I have it set to set the "Revived" Variable to 1 on _target which is "player" in respawn.sqf. This is the only problem I have with the script is the animation not changing. And obviously using RE to switchMove back to normal isn't working because I'm using it right there in the actual fnc_revive.sqf. Sorry if this post is real shitty, I'm in kind of a rush. Thanks in advance for any advice. Share this post Link to post Share on other sites
kylania 568 Posted September 10, 2012 Don't other revive systems teleport you somewhere else then just have a dummy body with an attached camera doing the animations instead of the player himself? Maybe that would work better? Share this post Link to post Share on other sites
Horner 13 Posted September 10, 2012 Maybe, but why wouldn't just switching his animation back to normal work? It's working for the medic who is doing the revive animation but not the guy who is in the death animation. There must be an answer. Share this post Link to post Share on other sites
Horner 13 Posted September 10, 2012 It's not picking up on the setVariable because this if ((player getVariable "Revived") == 1) then { needsRevive = false; [nil,player,rSwitchMove,""] call RE; player groupChat "You have been revived!"; deleteMarker _deadmrk; hintSilent ""; player allowDamage true; }; does not run. But I'm trying to figure out why the animation isn't switching back to normal for the person who needs revived. Share this post Link to post Share on other sites
zonekiller 175 Posted September 11, 2012 ive never been able to switch back from a death animation either with a player or AI on a dedicated server - use a different animation instead of "AidlPpneMstpSnonWnonDnon_SleepB_death" and loop the animation to keep it running Share this post Link to post Share on other sites
Horner 13 Posted September 12, 2012 I'll try it out, that's pretty lame that you can't use the death animation. :P But also, why isn't it picking up on the setVariable ? Share this post Link to post Share on other sites