Jump to content
JohnHSmith

Reviving player trough script

Recommended Posts

Hi all,

is it possible to revive a dead player with a script?

When a player is dead, he gets into spectator mode "Bird". Now the script should revive him and terminate the spectator mode.

It doesn't work with 

player setDamage 0;
["Terminate"] call BIS_fnc_EGSpectator;

 

Share this post


Link to post
Share on other sites

It is possible but it isn't a simple case of revive player, boom, done. I don't think it is possible using that respawn type either. You'd have to use "BASE" or "INSTANT" and do some additional scripting.

Share this post


Link to post
Share on other sites
2 minutes ago, HazJ said:

It is possible but it isn't a simple case of revive player, boom, done. I don't think it is possible using that respawn type either. You'd have to use "BASE" or "INSTANT" and do some additional scripting.

Okay, do you have an idea what exactly to do?

Share this post


Link to post
Share on other sites

I do. Can't slam anything together right now as I'm at work.

Use "BASE" respawn type with respawn delay of 1.

Upon respawn, move them out of map, disable simulation, etc...

Open spectator display. You'll then need to create a function with passable arguments that closes the display and then moves player to whereever, etc...

Sorry that I can't be of more help, as I said, at work.

  • Like 1

Share this post


Link to post
Share on other sites

@JohnHSmith - Very sloppy, basic and done this in 2 minutes. In no way complete or even close. Should give you an idea though.

// make sure to NOT allow players out of map to be viewed in spectator, create a blacklist array or something!

player addEventHandler ["Respawn",
{
	params ["_unit"];
	_unit setPos [-100, 0, 1000];
	_unit switchMove "";
	_unit enableSimulation false;
	["Initialize", [_unit]] call BIS_fnc_EGSpectator;
}];

// revivePlayer.sqf

params ["_unit", "_position"];

["Terminate"] call BIS_fnc_EGSpectator;
_unit enableSimulation true;
_unit setPos _position;
hintSilent "You have been revived!";

 

Share this post


Link to post
Share on other sites

It most likely won't work as in. Try it. Remember to compile function. Pass arguments to it as well.

[player, getMarkerPos "respawn_west"] spawn TAG_fnc_revivePlayer;

 

Share this post


Link to post
Share on other sites
5 hours ago, HazJ said:

It most likely won't work as in. Try it. Remember to compile function. Pass arguments to it as well.


[player, getMarkerPos "respawn_west"] spawn TAG_fnc_revivePlayer;

 

Okay, there is a problem. The dead player should stay at its position. So how to do that?

Share this post


Link to post
Share on other sites

As shown above.

player addEventHandler ["Respawn",
{
	params ["_unit"];
	_unit setPos [-100, 0, 1000];
	_unit switchMove "";
	_unit enableSimulation false;
	["Initialize", [_unit]] call BIS_fnc_EGSpectator;
}];

You can store the position of where the player died using setVariable or something. Then use getVariable to retrieve it when needed.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×