Jump to content
Sign in to follow this  
mr_h

Respawn: Instant + Base

Recommended Posts

I am working on a small mission for some friends of mine, involving two forces: Independents and BluFor. Both units start in different places on the island.

I would like to have the Independents have 'Instant' respawn (IE, 20 seconds after dying spawn at the same point they died).

I would like to have BluFor respond back at a marker called 'Heliport'. (ie, 20 seconds after dying they spawn back at their start point.

Obviously description.ext only lets you do one type of respawn, so that doesn't seem to work so well. I have tried a teleport script, but that only works on the BluFor's first life (I set the script on the BluFor players 'init' line, but after they die and respawn, the init doesn't run again so the line is 'lost'). I also tried a trigger with condition: !alive s5; and On Act: sleep 5;s5 setPos [(getMarkerPos "here") select 0, (getMarkerPos "here") select 1, 0];

That doesn't seem to work. I'm kind of beating my head here. I understand some stuff about scripting, but I'm far from an expert. Any advice would be greatly appreciated.

Thanks

H

Share this post


Link to post
Share on other sites

Have you tried using a "respawned" event handler? It should be the smoothest way.

Share this post


Link to post
Share on other sites
Have you tried using a "respawned" event handler? It should be the smoothest way.

No, I haven't. I am (was) not familiar with that or it's usage.

I did however find a roundabout way of doing it. I changed the respawn to Base, then I made a moving marker (respawn_gurellia) that follows the independent group. Every 5 seconds it moves the marker, so it essentially follows the group.

This seems to be working for now (aside from players not getting the same gear).

Share this post


Link to post
Share on other sites
No, I haven't. I am (was) not familiar with that or it's usage.

I did however find a roundabout way of doing it. I changed the respawn to Base, then I made a moving marker (respawn_gurellia) that follows the independent group. Every 5 seconds it moves the marker, so it essentially follows the group.

This seems to be working for now (aside from players not getting the same gear).

Fine, however when you feel ready maybe you should test with the event handler also so you can compare.

I suggest you that because with the respawn event handler you can also use this simple code to have the unit respawn with the same gear:

 _unit = _this select 0;
_weapons = weapons _unit;
_magazines = magazines _unit;

waituntil {alive player};

_unit = player;
removeallweapons _unit;
{_unit addmagazine _x} foreach _magazines;
{_unit addweapon _x} foreach _weapons; 

Share this post


Link to post
Share on other sites

Thanks..I'm still trying to wrap my head around event handlers.

From what I've read, I would make a new script (say, RespawnGear.sqf), have that called in init.sqf (execVM "RespawnGear.sqf"). Then RespawnGear.sqf would contain

player addEventHandler ["respawn",{
_unit = _this select 0;
_weapons = weapons _unit;
_magazines = magazines _unit;

waituntil {alive player};

_unit = player;
removeallweapons _unit;
{_unit addmagazine _x} foreach _magazines;
{_unit addweapon _x} foreach _weapons;
}];

Am I on the right track, or am I off? I'm a bit slow with understanding coding, most of it tends to zoom right over my head.

Thanks

Edited by mr_h
changed 'killed' to 'respawn'

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  

×