[Release] Spectre's Knockout/Revive

ZGreen-Spectre

Well-Known Member
Spectre's Knockout/Revive Player Death
Version 1.5
When the player reaches 100 life they are knocked out, either until revived with an epi-pen or they choose suicide through a scroll wheel option. The attacking player can approach their victim and execute them silently with a knife, they lose humanity based on the humanity of their target (optional and adjustable).
Files Modified:
Init.sqf
Compiles.sqf
Variables.sqf
setup_functions_med.sqf
fn_selfActions.sqf
fn_damageHandler.sqf
fn_unconscious.sqf
Files Added:
player_suicide.sqf
player_execute.sqf
Difficulty
Moderate = Orange 10-30
Installation Steps -
All necessary files are included in the download, if you have any of the files in the Revive folder on github then simply merge them using a program like notepad ++
Instructions on how to merge some common files are provided below.
Step 1: For init.sqf
Code:
// Compile and call important functions
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\variables.sqf";
progressLoadingScreen 0.1;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\publicEH.sqf";
progressLoadingScreen 0.2;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\setup_functions_med.sqf";
progressLoadingScreen 0.4;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";
progressLoadingScreen 1.0;
change to
Code:
// Compile and call important functions
call compile preprocessFileLineNumbers "Revive\variables.sqf";
progressLoadingScreen 0.1;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\publicEH.sqf";
progressLoadingScreen 0.2;
call compile preprocessFileLineNumbers "Revive\setup_functions_med.sqf";
progressLoadingScreen 0.4;
call compile preprocessFileLineNumbers "Revive\compiles.sqf";
progressLoadingScreen 1.0;
If your init.sqf looks like the first code then change it to the second code, download the provided folder and place it into your mission.pbo and skip to step 4.
Step:2 For variables.sqf look for
dayz_resetSelfActions = {​
at the bottom of the s_player list add
s_player_suicide = -1;​
it should now look something like this
Code:
dayz_resetSelfActions = {
    s_player_fillfuel20 = -1;
    s_player_fillfuel5 = -1;
    s_player_suicide = -1;
};
call dayz_resetSelfActions;



Step 3: for compiles.sqf look for
Code:
fnc_usec_selfActions = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selfActions.sqf";        //Checks which actions for self
fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf";        //Event handler run on damage
player_medEpi = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medEpi.sqf";
and change to
Code:
    fnc_usec_selfActions = compile preprocessFileLineNumbers "Revive\fn_selfActions.sqf";        //Checks which actions for self
    fnc_usec_unconscious = compile preprocessFileLineNumbers "Revive\fn_unconscious.sqf";
    fnc_usec_damageHandler = compile preprocessFileLineNumbers "Revive\fn_damageHandler.sqf";        //Event handler run on damage
player_medEpi = compile preprocessFileLineNumbers "Revive\medEpi.sqf";



Step 4: for fn_selfActions.sqf insert
Code:
// ------------------------------------------------------------------------Spectres Suicide Start------------------------------------------------------------------------
    if ((r_player_blood <= 1000) and (r_player_unconscious)) then {
            nearDead = true;
        } else { nearDead = false;};
        if( nearDead ) then{
            if (s_player_suicide < 0) then {
            s_player_suicide = player addaction[("<t color=""#c70000"">" + ("Suicide") +"</t>"),"Revive\player_suicide.sqf","",5,false,true,"", ""];
        };
    } else {
        player removeAction s_player_suicide;
        s_player_suicide = -1;
    };
// -------------------------------------------------------------------------Spectres Suicide End--------------------------------------------------------------------------
below _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
Step 5: for fn_selfActions.sqf insert
Code:
//------------------------------------------------------------------------Spectre's Execute Start--------------------------------------------------------
    _unconscious =    cursorTarget getVariable ["NORRN_unconscious", false];
 
    if (_isMan and _isAlive and !_isZombie and !_isAnimal and _unconscious and _hasKnife and _canDo and (player distance cursorTarget < 3)) then {
        if (s_player_execute < 0) then {
            s_player_execute = cursorTarget addAction [format[("<t color=""#ee8900"">" + ("Execute") +"</t>")],"Revive\player_execute.sqf",cursorTarget,0,true,true,"",""];
        };
    } else {
        player removeAction s_player_execute;
        s_player_execute = -1;
    };
//------------------------------------------------------------------------Spectre's Execute End--------------------------------------------------------------
below
s_player_studybody = -1;
};


-Credits-
Krixes' Self Bloodbag
For providing a self actions template to work from for player_suicide.
For the idea!
OP
Download
Here
Discussion/Support starts
HERE
 
V 1.1
Changes:
Added medEpi.sqf to Revive folder
New medEpi raises blood to 150 to avoid falling unconscious repeatedly.

in compiles.sqf find
player_medEpi = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medEpi.sqf";
change to
player_medEpi = compile preprocessFileLineNumbers "Revive\medEpi.sqf";
 
V 1.5
If you have either of the older versions please be sure to get rid of all your old files and download all of the new ones from github. See original instructions for how to add execute.

Changes:
Added execute option. A player approaching another player in a coma has to option to execute them if they have a knife.
Humanity change for executing is as follows;
Hero -1000
Survivor -500
Bandit +250
These number are easily changed as well as the output text upon execution.

Bugs Fixed:
Can no longer load an unconscious player into a vehicle(upon exiting they would be invulnerable)
Crashing a vehicle and dropping below 95 health will now kill you(upon exiting they would be invulnerable)
players will no longer randomly recover from unconsciousness and be able to shoot while remaining invisible and invulnerable (yeah terrible bug, hard to replicate FIXED NOW HOORAY!)

If you encounter any of the above bugs or any other bugs PLEASE let me know the exact circumstances right away so I can fix it!!!
 
Back
Top