Jump to content
Sign in to follow this  
zapat

SP respawn?

Recommended Posts

I have a SP respawn script in Arma2.

I attach a onKilled eventhandler to player, and when it is triggered (player dies) my script runs:

-I create a new unit and then selectplayer _newUnit;

This works great in Arma 2, since the engine waits for the script to finish before triggereing endgame.

In A3 I always get a black screen when player dies. The killed EH runs my script, but doesn't wait for it.

Is it a bug?

Is there a workaround for this for anyone?

Thanks

Share this post


Link to post
Share on other sites

Use the local host MP editor.

Share this post


Link to post
Share on other sites

I´m sure there was a SP Respawn Script for ArmA2... somewhere in the depth of the internet... =/

Think you can use it for SP... ^^

Share this post


Link to post
Share on other sites

You misunderstood me. My A2 respawn works in A2.

Problem is that A3 cuts black after player is dead.

After some experiments I found out that this is "only" a cut, so if I wait until its finished, I can cut it back with a cutText ["","BLACK IN", 1];

So this is more of an annoyance than a real bug, since the engine is not stopped, just hidden.

Share this post


Link to post
Share on other sites

NP :)

Tajin: I've thought about it as well, but it would require a robust system. All for by-passing an unnecessary black screen.

Share this post


Link to post
Share on other sites

zapat, could you share your script please? I'm having trouble creating a new unit and being able to selectPlayer it.

Share this post


Link to post
Share on other sites

My script is a part of a lot larger framework and contains many things which is connected to other stuff.

Here is the method which actually respawns the player. I just wrote the eventhandler around it, so you'll probably need to tidy this up a bit, but this will do for a quick demo on how to do this:


player removeAllEventHandlers "killed";
player addEventHandler ["killed",
{
   if (_this select 0 == player) then  
   {
       []call  //actual respawning script: if spawned, wait 6 seconds! (with accTime 1)
       {
           setAccTime 1;
           cutText ["","BLACK IN", 1];  //cut back to visible


           _oldPlayer = player; 

           _newPos = getMarkerPos "respawn";    //or write any position here
           _newGrp = createGroup west;            //dead player will be civilian! So you either save his side in the beginning, or hard code it

           _newPlayer = _newGrp createUnit [typeOf _oldPlayer , _newPos, [], 0, "FORM"];
           selectplayer _newPlayer;

           //[_newPlayer,PREVIOUS_LOADOUT] call fn_setLoadout; //I am using get/set loadout script. Must be saved periodically, as dead player will have unassigned weapons.
           deleteVehicle _oldPlayer ;
       };    
   };
}];

Trick is, that player becomes civilian and unit of a <null-group> when killed.

So if you want some data from the killed player (previous loadout, side, units in group) you'll need to save it periodically while player is alive, because you can't get these infos anymore when the player is dead. And player is dead when the killed eventhandler triggers, right?

If you don't call the script, but spawn it, you'll need to wait 6 seconds until BIS black cut is finished.

Edited by zapat

Share this post


Link to post
Share on other sites

have you tried to use something similar to the MP revive?

http://forums.bistudio.com/showthread.php?148085-BTC-Revive

It does have a weird glitch where you go back to base for a few seconds then end up in the same spot (even in mid air), it is more the eventhandler you may ba able to use to prevent the black screen and eventual mission end.

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
Sign in to follow this  

×