Abort delay on death

psychognatz

New Member
Hi folks,

I need some help to put a delay on the abort button when a player dies, because if he dies and aborts really quick the corpse vanishes...
and there is also the problem if a player dies and quickly aborts and comes back into the game to fast, he spawns with broken leg and bleeding and unconscious and that happen really often when server is running 2h+ without restart ! you can see that by looking at the kill messages, if server is running 2h+ with 40/40 playerlimit and someone kills a player it takes ~30 seconds until the killmessage shows up, what means that it takes like 30 seconds to execute the server_playerdied.sqf and if people come back into game quicker than that delay they spawn with broken legs and stuff....

that is my onPauseScript:

Code:
private["_display","_btnRespawn","_btnAbort","_timeOut","_timeMax","_isDead"];
        disableSerialization;
        waitUntil {
            _display = findDisplay 49;
            !isNull _display;
        };
        sleep 1;
        _btnRespawn = _display displayCtrl 1010;
        _btnAbort = _display displayCtrl 104;
        _btnRespawn ctrlEnable false;
        _btnAbort ctrlEnable false;
        _timeOut = 0;
        _timeMax = 4;
       
        if(r_player_dead) exitWith {_btnAbort ctrlEnable true;};
        if(r_fracture_legs) exitWith {_btnRespawn ctrlEnable true;};
               
        while {!isNull _display} do {
            switch true do {
                case ({isPlayer _x} count (player nearEntities ["AllVehicles", 6]) > 1) : {
                    _btnAbort ctrlEnable false;
                    cutText ["Cannot Abort near another player!", "PLAIN DOWN"];
                };
                case (_timeOut < _timeMax && count (player nearEntities ["zZombie_Base", 50]) > 0) : {
                    _btnAbort ctrlEnable false;
                    cutText [format ["Can Abort in %1", (_timeMax - _timeOut)], "PLAIN DOWN"];
                    _timeOut = _timeOut + 1;
 
                };
                case (player getVariable["combattimeout", 0] >= time) : {
                    _btnAbort ctrlEnable false;
                    cutText ["Cannot Abort while in combat!", "PLAIN DOWN"];               
                };
                default {
                    _btnAbort ctrlEnable true;
                    cutText ["", "PLAIN DOWN"];               
                };
            };
            sleep 3;
        };
        cutText ["", "PLAIN DOWN"];


I tried so many things now but I couldnt manage to put a delay on abort button after death -.- please help me !!!
 
I doesn't have the time to test it but try that (I made that very quickly, so I don't know if it work)
Code:
private["_display","_btnRespawn","_btnAbort","_timeOut","_timeMax","_isDead","_isInCombat","_unit"];
 
_unit =        _this select 0;
 
diag_log ("0");
 
_isInComat = _unit getVariable["startcombattimer",0];
 
_listNear = [];
_callCount = 0;
 
        disableSerialization;
        waitUntil {
            _display = findDisplay 49;
            !isNull _display;
        };
        sleep 1;
        _btnRespawn = _display displayCtrl 1010;
        _btnAbort = _display displayCtrl 104;
        _btnRespawn ctrlEnable false;
        _btnAbort ctrlEnable false;
        _timeOut = 0;
        _timeMax = 4;
 
        if(r_player_dead) exitWith {_x setVariable["startcombattimer", 1, true];};
        if(r_fracture_legs) exitWith {_btnRespawn ctrlEnable true;};
         
        while {!isNull _display} do {
            switch true do {
                case ({isPlayer _x} count (player nearEntities ["AllVehicles", 6]) > 1) : {
                    _btnAbort ctrlEnable false;
                    cutText ["Cannot Abort near another player!", "PLAIN DOWN"];
                };
                case (_timeOut < _timeMax && count (player nearEntities ["zZombie_Base", 50]) > 0) : {
                    _btnAbort ctrlEnable false;
                    cutText [format ["Can Abort in %1", (_timeMax - _timeOut)], "PLAIN DOWN"];
                    _timeOut = _timeOut + 1;
 
                };
                case (player getVariable["combattimeout", 0] >= time) : {
                    _btnAbort ctrlEnable false;
                    cutText ["Cannot Abort while in combat!", "PLAIN DOWN"];         
                };
                default {
                    _btnAbort ctrlEnable true;
                    cutText ["", "PLAIN DOWN"];         
                };
            };
            sleep 3;
        };
        cutText ["", "PLAIN DOWN"];
If is doesn't work try to change that
Code:
if(r_player_dead) exitWith {_x setVariable["startcombattimer", 1, true];};
with
Code:
if(r_player_dead) exitWith {_x setVariable["startcombattimer", 0];};
 
I cant get any of this to work either. I even tried creating a case but nothing is displayed on the death screen. Maybe we have to set something up under the player_death.sqf?
 
Here you go, this even fixes the bug where you wasnt able to abort with a broken leg.

When Player is dead and hits ESC, this counts silent from 0 to 4 and then activates the abort button.

Code:
private["_display","_btnRespawn","_btnAbort","_timeOut","_timeMax","_isDead","_timeOutDead","_timeMaxDead"];
        disableSerialization;
        waitUntil {
            _display = findDisplay 49;
            !isNull _display;
        };
        _btnRespawn = _display displayCtrl 1010;
        _btnAbort = _display displayCtrl 104;
        _btnRespawn ctrlEnable false;
        _btnAbort ctrlEnable false;
        _timeOut = 0;
        _timeOutDead = 0;
        _timeMax = 15;
        _timeMaxDead = 4;
        dayz_lastCheckBit = time;
       
        //if(r_player_dead) exitWith {_btnAbort ctrlEnable true;};
        //if(r_player_dead && _timeOutDead >= _timeMaxDead) exitWith {_btnAbort ctrlEnable true;};
        if(r_fracture_legs) then {_btnRespawn ctrlEnable true;};
       
        //force gear save
        if (time - dayz_lastCheckBit > 10) then {
            call dayz_forceSave;
        };           
               
        while {!isNull _display} do {
            switch true do {
                case (r_player_dead) : {
                    if(_timeOutDead < _timeMaxDead) then {
                        _btnAbort ctrlEnable false;
                        //cutText [format ["Can Abort in %1", (_timeMaxDead - _timeOutDead)], "PLAIN DOWN"];
                        _timeOutDead = _timeOutDead + 1;
                    } else {
                        _btnAbort ctrlEnable true;
                    };
                };
                case ({isPlayer _x} count (player nearEntities ["AllVehicles", 6]) > 1) : {
                    _btnAbort ctrlEnable false;
                    cutText [format[localize "str_abort_playerclose",_text], "PLAIN DOWN"];
                };
                case (_timeOut < _timeMax && count (player nearEntities ["zZombie_Base", 35]) > 0) : {
                    _btnAbort ctrlEnable false;
                    cutText [format ["Can Abort in %1", (_timeMax - _timeOut)], "PLAIN DOWN"];
                    //cutText [format[localize "str_abort_zedsclose",_text, "PLAIN DOWN"];
                };
                case (player getVariable["combattimeout", 0] >= time) : {
                    _btnAbort ctrlEnable false;
                    //cutText ["Cannot Abort while in combat!", "PLAIN DOWN"];
                    cutText [format[localize "str_abort_playerincombat",_text], "PLAIN DOWN"];                   
                };
                default {
                    _btnAbort ctrlEnable true;
                    cutText ["", "PLAIN DOWN"];               
                };
            };
            sleep 1;
            _timeOut = _timeOut + 1;
        };
        cutText ["", "PLAIN DOWN"];
 
On a side note, is there a way to set a timer to abort overall? I run multiple instances and want to elimanate server hopping. Having a logout timer for a standard abort would help with this.

Example:

Player #1 spots Player #2 on Server 1

Player #1 Hops to Server #2 to re position

Player #1 Hops to Server #1 and kills Player #2

What I want is a timer on logout no matter what.

Any ideas?
 
I know there are servers where you are constantly in-combat and you have to stand still for X seconds before you can logout, so everytime you move the combat-timer starts again.

But dont know how to acomplish that.
 
Hey guys, awesome stuff! i was digging around to see if anyone had mentioned this, especially the log out while broken leg thing i thought i was bugged when it happened. I have also been wondering if anyone knows how to reduce the amount of zombies or tone down the relentless respawn rate of them, any help would be great.
 
Is there a way to do this via mission file?

This is done via mission file. Just replace player_onPause.sqf path in descrition.ext

I know there are servers where you are constantly in-combat and you have to stand still for X seconds before you can logout, so everytime you move the combat-timer starts again.

But dont know how to acomplish that.

http://www.tunngle.net/community/topic/112181-activecombat-10-script-for-anti-combat-logging-needs/
 
Here you go, this even fixes the bug where you wasnt able to abort with a broken leg.

When Player is dead and hits ESC, this counts silent from 0 to 4 and then activates the abort button.

Code:
private["_display","_btnRespawn","_btnAbort","_timeOut","_timeMax","_isDead","_timeOutDead","_timeMaxDead"];
        disableSerialization;
        waitUntil {
            _display = findDisplay 49;
            !isNull _display;
        };
        _btnRespawn = _display displayCtrl 1010;
        _btnAbort = _display displayCtrl 104;
        _btnRespawn ctrlEnable false;
        _btnAbort ctrlEnable false;
        _timeOut = 0;
        _timeOutDead = 0;
        _timeMax = 15;
        _timeMaxDead = 4;
        dayz_lastCheckBit = time;
     
        //if(r_player_dead) exitWith {_btnAbort ctrlEnable true;};
        //if(r_player_dead && _timeOutDead >= _timeMaxDead) exitWith {_btnAbort ctrlEnable true;};
        if(r_fracture_legs) then {_btnRespawn ctrlEnable true;};
     
        //force gear save
        if (time - dayz_lastCheckBit > 10) then {
            call dayz_forceSave;
        };         
             
        while {!isNull _display} do {
            switch true do {
                case (r_player_dead) : {
                    if(_timeOutDead < _timeMaxDead) then {
                        _btnAbort ctrlEnable false;
                        //cutText [format ["Can Abort in %1", (_timeMaxDead - _timeOutDead)], "PLAIN DOWN"];
                        _timeOutDead = _timeOutDead + 1;
                    } else {
                        _btnAbort ctrlEnable true;
                    };
                };
                case ({isPlayer _x} count (player nearEntities ["AllVehicles", 6]) > 1) : {
                    _btnAbort ctrlEnable false;
                    cutText [format[localize "str_abort_playerclose",_text], "PLAIN DOWN"];
                };
                case (_timeOut < _timeMax && count (player nearEntities ["zZombie_Base", 35]) > 0) : {
                    _btnAbort ctrlEnable false;
                    cutText [format ["Can Abort in %1", (_timeMax - _timeOut)], "PLAIN DOWN"];
                    //cutText [format[localize "str_abort_zedsclose",_text, "PLAIN DOWN"];
                };
                case (player getVariable["combattimeout", 0] >= time) : {
                    _btnAbort ctrlEnable false;
                    //cutText ["Cannot Abort while in combat!", "PLAIN DOWN"];
                    cutText [format[localize "str_abort_playerincombat",_text], "PLAIN DOWN"];                 
                };
                default {
                    _btnAbort ctrlEnable true;
                    cutText ["", "PLAIN DOWN"];             
                };
            };
            sleep 1;
            _timeOut = _timeOut + 1;
        };
        cutText ["", "PLAIN DOWN"];
Where exactly do you put this code? Mission file fixes?
 
That looks to be a replacement player_onPause.sqf script that is called from the description.ext file, adjust accordingly.
 
Here you go, this even fixes the bug where you wasnt able to abort with a broken leg.

When Player is dead and hits ESC, this counts silent from 0 to 4 and then activates the abort button.

Code:
private["_display","_btnRespawn","_btnAbort","_timeOut","_timeMax","_isDead","_timeOutDead","_timeMaxDead"];
        disableSerialization;
        waitUntil {
            _display = findDisplay 49;
            !isNull _display;
        };
        _btnRespawn = _display displayCtrl 1010;
        _btnAbort = _display displayCtrl 104;
        _btnRespawn ctrlEnable false;
        _btnAbort ctrlEnable false;
        _timeOut = 0;
        _timeOutDead = 0;
        _timeMax = 15;
        _timeMaxDead = 4;
        dayz_lastCheckBit = time;
   
        //if(r_player_dead) exitWith {_btnAbort ctrlEnable true;};
        //if(r_player_dead && _timeOutDead >= _timeMaxDead) exitWith {_btnAbort ctrlEnable true;};
        if(r_fracture_legs) then {_btnRespawn ctrlEnable true;};
   
        //force gear save
        if (time - dayz_lastCheckBit > 10) then {
            call dayz_forceSave;
        };       
           
        while {!isNull _display} do {
            switch true do {
                case (r_player_dead) : {
                    if(_timeOutDead < _timeMaxDead) then {
                        _btnAbort ctrlEnable false;
                        //cutText [format ["Can Abort in %1", (_timeMaxDead - _timeOutDead)], "PLAIN DOWN"];
                        _timeOutDead = _timeOutDead + 1;
                    } else {
                        _btnAbort ctrlEnable true;
                    };
                };
                case ({isPlayer _x} count (player nearEntities ["AllVehicles", 6]) > 1) : {
                    _btnAbort ctrlEnable false;
                    cutText [format[localize "str_abort_playerclose",_text], "PLAIN DOWN"];
                };
                case (_timeOut < _timeMax && count (player nearEntities ["zZombie_Base", 35]) > 0) : {
                    _btnAbort ctrlEnable false;
                    cutText [format ["Can Abort in %1", (_timeMax - _timeOut)], "PLAIN DOWN"];
                    //cutText [format[localize "str_abort_zedsclose",_text, "PLAIN DOWN"];
                };
                case (player getVariable["combattimeout", 0] >= time) : {
                    _btnAbort ctrlEnable false;
                    //cutText ["Cannot Abort while in combat!", "PLAIN DOWN"];
                    cutText [format[localize "str_abort_playerincombat",_text], "PLAIN DOWN"];               
                };
                default {
                    _btnAbort ctrlEnable true;
                    cutText ["", "PLAIN DOWN"];           
                };
            };
            sleep 1;
            _timeOut = _timeOut + 1;
        };
        cutText ["", "PLAIN DOWN"];

Does this also resolve the following? I'm having a couple of issues when the server has been under heavy load for a few hours. One issue (which isn't mentioned) is players actually respawning where they died with their gear - I don't suppose anyone else has encountered this?

the problem if a player dies and quickly aborts and comes back into the game too fast, he spawns with broken leg and bleeding and unconscious and that happen really often when server is running 2h+ without restart ! you can see that by looking at the kill messages, if server is running 2h+ with 40/40 playerlimit and someone kills a player it takes ~30 seconds until the killmessage shows up, what means that it takes like 30 seconds to execute the server_playerdied.sqf


Edit: I've just tried implementing this, but I don't think I've done it correctly. By default, I have no line in my description.ext file which refer to player_onPause at all.

Should the line I add look like this;
Code:
player_onPause = compile preprocessFileLineNumbers "fixes\player_onPause.sqf";

I have created and placed the player_onPause.sqf inside my fixes folder in my mission.pbo. The only code in that file is the code Grafzahl posted above.
 
Code:
...
enableItemsDropping = 0;
onPauseScript = "fixes\player_onPause.sqf";
loadScreen = "\z\addons\dayz_code\gui\dayz_logo_ca.paa";
...
 
Code:
...
enableItemsDropping = 0;
onPauseScript = "fixes\player_onPause.sqf";
loadScreen = "\z\addons\dayz_code\gui\dayz_logo_ca.paa";
...

Thanks.

I assume I can edit this line

Code:
_timeMaxDead = 4;

to increase how long the abort button is greyed out for?
 
Yes. However, it's not working. I put it up to 30 Seconds but body's still disappear.
Not on my Server, everything is working fince since i updated :) Only thing that no one can solve is when player crashes his game after death, then the body still disapears.
 
This is working very nicely. Often players will say 'Why can't I abort?' (or something similar) when they die. Is there a way to display a hint for the player to see?

This shows they're in combat
Code:
cutText ["Cannot Abort while in combat!", "PLAIN DOWN"];
This shows they need to wait X seconds, and counts down
Code:
cutText [format ["Can Abort in %1", (_timeMax - _timeOut)], "PLAIN DOWN"];
I can't get any text to appear when a player dies though. I've tried these (not all at once obviously):
Code:
cutText [format ["Can Abort in %1", (_timeMaxDead - _timeOutDead)], "PLAIN DOWN"];
titleText [format ["Can Abort in %1", (_timeMaxDead - _timeOutDead)], "PLAIN DOWN"];
hint "Press 'Esc' and wait for the \nAbort button to activate.";

The cutText and titleText seem to appear, but only once you close the menu (press Esc again), meaning that the countdown stops and their function is useless. This doesn't happen with cutText when you are not dead, and it will display correctly whilst the Esc menu is open. Does this have something to do with the death screen/image? Is there a way around it?
 
Back
Top