Jump to content

[FIX] Knockout Glitch / Action Using


ToejaM

Recommended Posts

This should stop all forms of getting out of the knockout glitch, where it is mostly when people try to use certain medical objects from their inventory that cause them to do a scripted animation which they can skip and then continue you running.

 

I'm putting this up as a fix is needed asap, though I have faith that someone can simplify this by making the fn_unconscious.sqf bullet proof. Until then, this works fine. Expect a lot of whining from overburdened players building bases though!

 

Just follow the steps below, those of your savvy enough know where to skip certain basic steps.

 

Creating a custom compiles.sqf

A compiles.sqf is essentially a hub for linking most of the scripts within DayZ Epoch. Without this, you cannot do the following changes to files below.

Step 1)
Unpack your dayz_code.pbo in Dayz_Epoch\addons\

Step 2)
Pull out the compiles.sqf from dayz_code\init\ and place into your root mission folder (where mission.sqm is)

Step 3)
Find and edit in your init.sqf inside your mission file look like this

call compile preprocessFileLineNumbers "compiles.sqf";    //Compile regular functions

 

Folder Creation - Can Skip if you're a messy one and you like to have every edited file in the root directory, you heretic.

Step 1)

Create a folder in your mission.pbo / folder called "medical" - Mine for example is in another folder called fixes as a subfolder.

 

Prevent Gear Opening While Unconcious - credit Itsatrap

This should prevent opening of gear while unconcious, negating the need for my fixes below. If you find that you can brute force the gear open, follow the extra steps to prevent items being used completely.

 

Step 1)

Goto @DayZ_Epoch\addons\dayz_code\compile and remove the following file to the folder above or if you already have the file skip to step 2 and you should be able to ignore step 3.

fn_gearMenuChecks.sqf

 

Step 2)

Edit the following code into the fn_gearMenuChecks.sqf file at line 9

//Knockout Glitch Fix
if ((player getVariable ["NORRN_unconscious", true])) exitWith {
	_display closeDisplay 1;
	//Let Zeds know
	[player,15,true,(getPosATL player)] spawn player_alertZombies;
	systemChat ( "You are unconscious." );
};

Step 3)

Edit your compiles.sqf and change:

fn_gearMenuChecks =   compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_gearMenuChecks.sqf";

to

fn_gearMenuChecks =   compile preprocessFileLineNumbers "fixes\fn_gearMenuChecks.sqf";

You're done.

 

Prevent players using items from inventory that would allow them to move.

This will stop players from using medical items that allow them to move freely while unconscious.

 

Step1)

Goto @DayZ_Epoch\addons\dayz_code\medical in your client files and copy the following files to the folder you created above.

  • antibiotics.sqf - Not important but stops infected people losing more blood while they are supposed to be unconcious.
  • bandage.sqf - This is one of the major glitches that gets you out of being unconcious
  • morphine.sqf - Same as above
  • painkiller.sqf - This removes your unconcious timer if overburdened, may also remove it if knocked out.
  • selftransfusion - Stops bloodbagging, may also kick you out of "unconcious"

Step 2) 

 

Edit this line into each file at the stated line below:

//CPC Glitch Fix
if ((player getVariable ["NORRN_unconscious", true])) exitWith {systemChat ( "You are unconscious." );};

antibiotics.sqf - Line 10 - Below: //s_player_antiobiotic = -1;
bandage.sqf - Line 6 - Below: disableserialization;
morphine.sqf - Line 6 - Below: disableserialization;
painkiller.sqf - Line 6 - Below: disableserialization;
selftransfusion.sqf - Line 7 - Below: if ((round(time - _lastused)) <= _timeout) exitWith {cutText [format[(localize "str_actions_medical_18"),(_timeout - (round(time - _lastused)))] , "PLAIN DOWN"]};

 

Step 3)

Goto  @DayZ_Epoch\addons\dayz_code\actions and copy the following file into the medical folder you created above:

  • player_useMeds.sqf

Step 4)

Edit player_useMeds.sqf To look like the following or similar depending on your file structure:

private ["_item","_id","_onLadder","_hasmeditem","_config","_text"];
_item = _this;
call gear_ui_init;
_onLadder =		(getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};

_hasmeditem = _this in magazines player;

_config = configFile >> "CfgMagazines" >> _item;
_text = getText (_config >> "displayName");

if (!_hasmeditem) exitWith {cutText [format[(localize "str_player_31"),_text,"use"] , "PLAIN DOWN"]};
switch (_item) do {
	case "ItemBandage": {
		_id = [0,0,0,[player]] execVM "fixes\medical\bandage.sqf";
	};
	case "ItemMorphine": {
		_id = [0,0,0,[player]] execVM "fixes\medical\morphine.sqf";
	};
	case "ItemPainkiller": {
		_id = [0,0,0,[player]] execVM "fixes\medical\painkiller.sqf";
	};
	case "ItemAntibiotic": {
		_id = [0,0,0,[player]] execVM "fixes\medical\antibiotics.sqf";
	};
	case "ItemBloodbag": {
		_id = [0,0,0,[player]] execVM "fixes\medical\self_transfusion.sqf";
	};
	case "ItemHeatPack": {
		player removeMagazine "ItemHeatPack";
		dayz_temperatur = (dayz_temperatur + 5) min dayz_temperaturmax;
		cutText [localize "str_player_27", "PLAIN DOWN"];
	};
};

Step 5)

Edit the compiles.sqf with the following around line 96 depending on other mod edits ect

	player_useMeds =			compile preprocessFileLineNumbers "fixes\medical\player_useMeds.sqf";

Step 6) Credit to infiSTAR

Create a new .sqf and put the following inside, then place it in your 'fixes' folder under a name of your choice, I called mine "knockoutglitch.sqf"

while {true} do {
	waitUntil {(player getVariable ["NORRN_unconscious", false])};
	titleText ["You are unconscious","PLAIN DOWN"]; titleFadeOut 4;
	disableUserInput true;disableUserInput true;disableUserInput true;
	waitUntil {!(player getVariable ["NORRN_unconscious", false])};
	disableUserInput false;disableUserInput false;disableUserInput false;   
};

Step 7)

In your init.sqf at the bottom add this:

// Knockout Action Glitch Fix
[] execVM "fixes\knockoutglitch.sqf";
Link to comment
Share on other sites

If I add this to fn_gearMenuChecks.sqf will it not have the same effect but use less files ?

 

after disableSerialization;

if ((player getVariable ["NORRN_unconscious", true])) exitWith {
    _display closeDisplay 1;
    //Let Zeds know
    [player,10,true,(getPosATL player)] spawn player_alertZombies;
    systemChat ( "You are unconscious." );
};
I am not home so can't test it.
Link to comment
Share on other sites

If I add this to fn_gearMenuChecks.sqf will it not have the same effect but use less files ?

 

after disableSerialization;

if ((player getVariable ["NORRN_unconscious", true])) exitWith {
    _display closeDisplay 1;
    //Let Zeds know
    [player,10,true,(getPosATL player)] spawn player_alertZombies;
    systemChat ( "You are unconscious." );
};
I am not home so can't test it.

 

That should work but I think its brute forceable without more wizardry

Link to comment
Share on other sites

Add
 

if ((player getVariable ["NORRN_unconscious", true])) exitWith {
	_display closeDisplay 1;
	//Let Zeds know
	[player,15,true,(getPosATL player)] spawn player_alertZombies;
	systemChat ( "You are unconscious." );
};

 
right before
 

if(_inVehicle) then {
	_cTarget = (vehicle player);
};

 
the finished code should look like this
 
 

private ["_cTarget","_isOk","_display","_inVehicle"];
disableSerialization;
_display = (_this select 0);
_inVehicle = (vehicle player) != player;
_cTarget = cursorTarget;

/**** CSG: Knockout Glitch FIX start ****/
if ((player getVariable ["NORRN_unconscious", true])) exitWith {
	_display closeDisplay 1;
	//Let Zeds know
	[player,15,true,(getPosATL player)] spawn player_alertZombies;
	systemChat ( "You are unconscious." );
};
/**** CSG: Knockout Glitch FIX End ****/

if(_inVehicle) then {
	_cTarget = (vehicle player);
};
.....................................

Looks like this
http://cloud-4.steampowered.com/ugc/574527639725913850/50F7EA32AA62F6AB2A748915B1A2DD6066E8F60A/1024x576.resizedimage

Link to comment
Share on other sites

It appears in SOME cases people can vault out of it still, this is a problem as vaulting is a core Arma mechanic and not something we can edit via scripts. This means we need to do something while they are stationary but still flagged as unconscious.

 

Itsatrap I've added your fix to my post above my fix as yours is simpler, its untested by me but it looks sound enough to work.

Link to comment
Share on other sites

It appears in SOME cases people can vault out of it still, this is a problem as vaulting is a core Arma mechanic and not something we can edit via scripts. This means we need to do something while they are stationary but still flagged as unconscious.

 

Itsatrap I've added your fix to my post above my fix as yours is simpler, its untested by me but it looks sound enough to work.

if ((_dikCode in actionKeys "GetOver") && (player getVariable ["NORRN_unconscious", true])) then {
        _handled = true;
};

add this in your dayz_spaceInterrupt.sqf  (untested)

Link to comment
Share on other sites

Added that into my script, will test it when the time comes but it can be difficult to work in two unconscious efforts without dying heh.

 

Seems there is an issue if you die while unconscious now, when you relog you can move freely, no timer but all of the blocking efforts keep informing me that I'm unconscious. A relog fixes this and you do not get set unconscious on a relog which is pretty odd. Seems the state must carry over partially from death.

 

I'm wondering if its to do with the timer that shows briefly after you die.

 

People also appear to get told they are unconcious even a while after being unconscious but I have no specifics on what causes this.

Link to comment
Share on other sites

Updated version

 

Add _isUnconscious to PRIVATE[];

at the top

private ["_cTarget","_isOk","_display","_inVehicle","_isUnconscious"]; 

 

_isUnconscious = player getVariable ["NORRN_unconscious",false];
if (_isUnconscious) exitWith {
	if (alive player) then {
		if (isPlayer player && _isUnconscious) then {
			_display closeDisplay 1;
			//Let Zeds know
			[player,25,true,(getPosATL player)] spawn player_alertZombies;
			systemChat ( "You are unconscious." );
			// combattimeout 
			player setVariable["combattimeout", time + 10, true];
			player setVariable["startcombattimer", 0];
			dayz_combat = 1;
		};
	};
};
Edited by itsatrap
Link to comment
Share on other sites

  • 2 weeks later...

Got it working! Nice thanks guys.

 

Is there any way to make it so they can still open their gear? I'd like players to be able to still drop the items that made them overburdened. Would I just leave out step 2?

 

 

Step 2)

Edit the following code into the fn_gearMenuChecks.sqf file at line 9

  1. //Knockout Glitch Fix
  2. if ((player getVariable ["NORRN_unconscious", true])) exitWith {
  3.     _display closeDisplay 1;
  4.     //Let Zeds know
  5.     [player,15,true,(getPosATL player)] spawn player_alertZombies;
  6.     systemChat ( "You are unconscious." );
  7. };

 

  1.  
Link to comment
Share on other sites

  • 1 month later...

When player after unconscious use bandage and almost same time push to walk, then AI  dont see player becose in database player still stay on the ground as unconscious, after relog player are back where he get unconscious. So my players anyway use this bug, make hard missions and AI dont see players. Dont know how to fight with this....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...