Jump to content
Sign in to follow this  
jcae2798

SP Respwan

Recommended Posts

Hey all,

I'm working on some custom self missions and was looking to see if there was a way to respawn myself and/or groups of AIs.

For example, I am setting up an Alive mission. I have a group of 6 people. As the units start to die or if i die myself, i would like to respawn at base. A good example of a respawn i love is Saok's version he used in his Lotta missions.

I understand this can easily be done in COOP/MP modes by opening mission in MP but this disabled SP features which i want to use during this time so not an option. THanks all

Share this post


Link to post
Share on other sites

Interesting....having a hard time getting it to work...i think i am doing something wrong.

---------- Post added at 03:00 ---------- Previous post was at 02:59 ----------

Let me calrify, i am using this:

http://forums.bistudio.com/showthread.php?121820-Single-Player-Respawn-with-KillerCam-Script

And testing it in editor and when i get killed it goes to death screen to restart...however i see the unit getting created a few seconds later... How do i avoid the death screen?

Share this post


Link to post
Share on other sites

My bad, as per this thread, that no longer works for A3.

As you can see in that thread, they are using a "killed" event handler, and then switching the playable unit to another unit. Here are the commands related to switching your unit to a new unit. Also, I noticed you mentioned Saok's Whole Lotta mission. Try dePBOing his mission and see how he accomplished it.

Share this post


Link to post
Share on other sites

Hey thanks for the info man. I been playing around with this since you pointed me to it and got it somewhat working enough that it will work or me. BTW since it was for myself i did try that but his mission files are crazy lol.

BTW here's how it got it working:

On onPlayerKilled.sqf file:

private ["_plyr","_kilr"];

_plyr = _this select 0;

_kilr = _this select 1;

nul = [_plyr,_kilr,"wrespawn0"] execVM "onPlayerRespawn.sqf";

Then on a file called "onPlayerRespawn.sqf":

private ["_plyr","_kilr","_type","_group","_dist","_camera","_found","_rand","_unit"];

_plyr = _this select 0;

_kilr = _this select 1;

_mrkr = if (count _this >2) then {_this select 2};

if (isNil "_kilr") then {_kilr = objNull};

//grab some stuff we need later

_type = typeOf _plyr;

_group = group _plyr;

_dist = _plyr distance _kilr;

if (count _this > 2) then {

//if (not (isNil _mrkr)) then {

//create the new unit.... same group

_unit = _group createUnit [_type, (getMarkerPos _mrkr), [], 0, "NONE"];

sleep 3;

addSwitchableUnit _unit;

selectPlayer _unit;

waitUntil {_unit == player};

_found = true;

} else {

//try to find a random playable unit

while {(not (_found)) and ((count switchableunits) >=1)} do {

_unit = switchableunits select (floor (random (count switchableunits)));

if (alive _unit) then {

_found = true;

selectplayer _unit;

};

sleep 2;

};

};

Hope this helps others :)

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  

×