Jump to content
gadjr114

Respawn Decision

Recommended Posts

I currently use the default "Respawn at position of death" and love it.  Although, for my newest MP mission I would like to give the option of respawning at the position of death OR back at base, whichever the player decides.

 

What is the simplest way to accomplish this?

Share this post


Link to post
Share on other sites

I would use killed eventhandler and create respawn marker local with respawn template menuposition

Share this post


Link to post
Share on other sites

I would use killed eventhandler and create respawn marker local with respawn template menuposition

 

Could you explain how I would do that?  I'm merely a beginner with scripting.  Is it possible to do entirely in the editor?

Share this post


Link to post
Share on other sites

init.sqf or initPlayerLocal.sqf
 

if (hasInterface) then {

    player addEventHandler ["Killed",{
    
    params ["_unit"];

        switch (side _unit) do {
        
            case WEST: {private _marker = createMarkerLocal ["respawn_west_1", position _unit];};
            case EAST: {private _marker = createMarkerLocal ["respawn_east_1", position _unit];};
            case INDEPENDENT: {private _marker = createMarkerLocal ["respawn_guerrila_1", position _unit];};
            default {};
        };
    }];
    
    
    player addEventHandler ["Respawn",{
    
    params ["_unit","_corpse"];

        switch (side _unit) do {
        
            case WEST: {
            
                if !(isNil "respawn_west_1") then {
                    deleteMarkerLocal "respawn_west_1";
                };
            
            };
            case EAST: {

                if !(isNil "respawn_east_1") then {
                    deleteMarkerLocal "respawn_east_1";
                };
            };
            
            case INDEPENDENT: {
            
                if !(isNil "respawn_guerrila_1") then {
                    deleteMarkerLocal "respawn_guerrila_1";
                };
            };
            
            default {};
        };    
    
        deleteVehicle _corpse;
    
    }];


};

description.ext

respawn = BASE;
respawnOnStart = -1;
respawnDelay = 5;
respawnTemplates[] = {"MenuPosition"};

Share this post


Link to post
Share on other sites

 

init.sqf or initPlayerLocal.sqf

 

if (hasInterface) then {

    player addEventHandler ["Killed",{
    
    params ["_unit"];

        switch (side _unit) do {
        
            case WEST: {private _marker = createMarkerLocal ["respawn_west_1", position _unit];};
            case EAST: {private _marker = createMarkerLocal ["respawn_east_1", position _unit];};
            case INDEPENDENT: {private _marker = createMarkerLocal ["respawn_guerrila_1", position _unit];};
            default {};
        };
    }];
    
    
    player addEventHandler ["Respawn",{
    
    params ["_unit","_corpse"];

        switch (side _unit) do {
        
            case WEST: {
            
                if !(isNil "respawn_west_1") then {
                    deleteMarkerLocal "respawn_west_1";
                };
            
            };
            case EAST: {

                if !(isNil "respawn_east_1") then {
                    deleteMarkerLocal "respawn_east_1";
                };
            };
            
            case INDEPENDENT: {
            
                if !(isNil "respawn_guerrila_1") then {
                    deleteMarkerLocal "respawn_guerrila_1";
                };
            };
            
            default {};
        };    
    
        deleteVehicle _corpse;
    
    }];


};

description.ext

respawn = BASE;
respawnOnStart = -1;
respawnDelay = 5;
respawnTemplates[] = {"MenuPosition"};

Wow, thanks man!  So, all I have to do is make an init and description file and put it in the mission folder?  Do I have to do anything with the current respawn conditions I have setup in the Eden editor (Respawn on position of death)?  Oh, one last thing: What's the difference between the init.sqf & initPlayerLocal.sqf?  If it matters, this will be for a MP mission.

 

Thanks again!

Share this post


Link to post
Share on other sites

Obviously you can set description.ext part directly in editor

Do you mean by using the built-in features of Eden now where I can set the respawn type, ect?  What type is "base"? and what's the part about "templates"?

 

Sorry, scripts aren't my strength.

 

Again, thanks for your help!

Share this post


Link to post
Share on other sites

I'm having trouble getting it to work properly.  It's either I get to chose a spawn location (off of markers I place down) or I respawn where I died.  It doesn't give me a choice of spawn at a marker OR spawn where I died.

 

Any ideas?

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

×