Release: Player2's Knockout

Player2

Valued Member!
Current Version: 0.1
Last Update: 22/04/13
DayZ Version: 1.7.6.1

Player2's Knockout
About
This mod enables you to scroll on another player and select a 'Knockout!' option that will knock the player unconscious in the same way DayZ does when you're shot or injured.
This works in the same way that Chloroform does in the popular Redux mod.

This script currently has 3 modes.
  1. Players can knock out other players
  2. Players need a crowbar to knock another player out
  3. Players needs to have a primary weapon to knock another player out.
Installation

This quick installation tutorial assumes that you know how to extract files from the dayz_code.
You will need these files extracted:

...\dayz_code\init\compiles.sqf
...\dayz_code\init\publicEH.sqf
...\dayz_code\init\variables.sqf
...\dayz_code\compile\fn_selfActions.sqf
Bambi Note: A large amount of mission file modifications (e.g. Self-Bloodbag) will already use customised versions of these files. If you find any of these files already existing in your mission file then you should not replace them, or you'll just break one of your other mods, or the server. Simply make the changes outlined in this thread to your existing files.

Create a new folder called 'fixes' inside the root directory of your mission file. Place all of the files in the list above into that folder. Now download this, and this, and place them two files in the fixes folder too.

Now, lets start actually opening these files and changing them to do what we want.

\init.sqf
Find & Replace: call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\variables.sqf";
With: call compile preprocessFileLineNumbers "fixes\variables.sqf";

Find & Replace: call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\publicEH.sqf";
With: call compile preprocessFileLineNumbers "fixes\publicEH.sqf";

Find & Replace: call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";
With: call compile preprocessFileLineNumbers "fixes\compiles.sqf";


\fixes\compiles.sqf

Find the line ending with: player_sleep.sqf";
Insert on a new line below the above text:
player_knockout = compile preprocessFileLineNumbers "fixes\knockout2.sqf";

Find & Replace:
fnc_usec_selfActions = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selfActions.sqf";
With:
fnc_usec_selfActions = compile preprocessFileLineNumbers "fixes\fn_selfActions.sqf";


\fixes\variables.sqf

Find: canRoll = true;
Insert on a new line below the above: dayz_knockout = [];

Find: s_player_fire = -1;
Insert below: s_player_knockout = -1;


\fixes\fn_selfActions.sqf

Find:
//Dog
if (_isDog and _isAlive and (_hasRawMeat) and _canDo and _ownerID == "0" and player getVariable ["dogID", 0] == 0) then {

Insert above the found text:
Code:
    //####    KNOCKOUT            ####
    _unconscious =    cursorTarget getVariable ["NORRN_unconscious", false];
 
    if (_isMan and _isAlive and !_isZombie and _canDo and !_unconscious) then {
        if (s_player_knockout < 0) then {
            s_player_knockout = player addAction [("<t color=""#FF9800"">" + ("Knockout!") + "</t>"), "fixes\knockout.sqf",cursorTarget, 0, false, true, "",""];
        };
    } else {
        player removeAction s_player_knockout;
        s_player_knockout = -1;
    };
    //##############################

Find: s_player_studybody = -1;
Insert below:
player removeAction s_player_knockout;
s_player_knockout = -1;


\fixes\publicEH.sqf

Find:
"dayzFire" addPublicVariableEventHandler {nul=(_this select 1) spawn BIS_Effects_Burn};
Insert below:
"dayz_knockout" addPublicVariableEventHandler {nul=(_this select 1) call player_knockout};


Customisation
To change which mode the script is running in, open the 'fixes\knockout.sqf' file, then look at lines 11 -> 17.
To change the text displayed to a player when they have been knocked out, open the 'fixes\knockout2.sqf' file and modify line 10.
Credits

Script & Tutorial By: Player2
Thanks To: DayZRedux, ZombZ, GhostZ, Gorsy
 
Back
Top