Jump to content
  • 0

Knockout script?


FragZ

Question

I had a working knockout script from player2 on 1.0.4... Used with action menu.


Now, it does not work. Any ideas on how to do it so when people click knockout the target cursor gets knocked out?
 

 

Code:
 

private["_hasCrowbar1","_item","_text","_body","_name","_hasCrowbar2","_knockoutMode"];
_body =         _this select 3;
_onLadder =             (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
 
if (_onLadder) exitWith {cutText ["You can't knock a player out while you're on a ladder; don't you know anything?" , "PLAIN DOWN"]};
 
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Knockout Configuration \\\\\\\\\\\\\\\\\\\\\\\\\
///////////////////////////////////////////////////
//==============================================//
// Knockout Gear Requirements
//--------------------------------------------//
// 2: Weapon (Primary or Secondary) Required
// 1: Crowbar Required
// 0: Nothing Required
//---------------------------------------//
_knockoutMode = 0;
//=====================================//
// Credits
//-----------------------------------//
// Script by Player2
// Thanks To:
// DayZRedux, OpenDayZ
// GhostZ, Gorsy
//==============================//
// www.ZombZ.net
//============================//
 
_hasCrowbar1 = "MeleeCrowbar" in weapons player;
_hasCrowbar2 = "ItemCrowbar" in items player;
_hasPrimary = 0;
 
 if (PrimaryWeapon player != "") then {
         _hasPrimary = 1;
 } else {
        _hasPrimary = 0;
 };
 
 
if (_knockoutMode == 0) then {
        dayz_knockout = [_body,3.5];
        publicVariable "dayz_knockout";
        player playActionNow "PutDown";
        sleep 1;
};
 
if (_knockoutMode == 1) then {
        if (_hasCrowbar1) then {
                dayz_knockout = [_body,3.5];
                publicVariable "dayz_knockout";
                player playActionNow "PutDown";
                sleep 1;
        };
 
        if (_hasCrowbar2) then {
                dayz_knockout = [_body,3.5];
                publicVariable "dayz_knockout";
                player playActionNow "PutDown";
                sleep 1;
        };
 
        if (!_hasCrowbar1 and !_hasCrowbar2) exitWith
        {
                cutText ["You need a Crowbar for this!" , "PLAIN DOWN"];
        };
};
 
if (_knockoutMode == 2) then {
        if (_hasPrimary == 1) then {
                dayz_knockout = [_body,3.5];
                publicVariable "dayz_knockout";
                player playActionNow "PutDown";
                sleep 1;
        } else {
                cutText ["You need a Primary Weapon for this!" , "PLAIN DOWN"];
        };
};
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

What do you have in fn_selfActions.sqf?

I do not use fn_Selfactions. I use an action menu.

 

Code:

 

ActionMenu =
	[
		["",true],
		["Action Menu >>", [], "#USER:ActionsMenu", -5, [["expression", ""]], "1", "1"],
		["Knockout (cursor target)", [],  "", -5, [["expression", format[_EXECscript1,"knockout.sqf"]]], "1", "1"],
		["Deploy Menu >>", [], "#USER:VehicleMenu", -5, [["expression", ""]], "1", "1"],
		["Fun Menu >>", [], "#USER:FunMenu", -5, [["expression", ""]], "1", "1"],
			["", [], "", -5, [["expression", ""]], "1", "0"],
			["Exit", [20], "", -5, [["expression", ""]], "1", "1"]		
	];
Link to comment
Share on other sites

  • 0

The commanding menu does't pass on the information for the body variable like the "addaction" command. This should work.

 

private["_hasCrowbar1","_item","_text","_body","_name","_hasCrowbar2","_knockoutMode"];
_body =         cursorTarget;
_onLadder =             (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
 
if (_onLadder) exitWith {cutText ["You can't knock a player out while you're on a ladder; don't you know anything?" , "PLAIN DOWN"];};
if (vehicle player != player) exitWith {cutText ["You can't knock a player out while you're in a vehicle; don't you know anything?" , "PLAIN DOWN"];};
if (!isPlayer _body) exitWith {cutText ["You can't knock a player out because you aren't looking at one; don't you know anything?" , "PLAIN DOWN"];};
 
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// Knockout Configuration \\\\\\\\\\\\\\\\\\\\\\\\\
///////////////////////////////////////////////////
//==============================================//
// Knockout Gear Requirements
//--------------------------------------------//
// 2: Weapon (Primary or Secondary) Required
// 1: Crowbar Required
// 0: Nothing Required
//---------------------------------------//
_knockoutMode = 0;
//=====================================//
// Credits
//-----------------------------------//
// Script by Player2
// Thanks To:
// DayZRedux, OpenDayZ
// GhostZ, Gorsy
//==============================//
// www.ZombZ.net
//============================//
 
_hasCrowbar1 = "MeleeCrowbar" in weapons player;
_hasCrowbar2 = "ItemCrowbar" in items player;
_hasPrimary = 0;
 
 if (PrimaryWeapon player != "") then {
_hasPrimary = 1;
 } else {
_hasPrimary = 0;
 };
 
 
if (_knockoutMode == 0) then {
dayz_knockout = [_body,3.5];
publicVariable "dayz_knockout";
player playActionNow "PutDown";
sleep 1;
};
 
if (_knockoutMode == 1) then {
if (!_hasCrowbar1 and !_hasCrowbar2) exitWith
{
cutText ["You need a Crowbar for this!" , "PLAIN DOWN"];
};
 
if (_hasCrowbar1) then {
dayz_knockout = [_body,3.5];
publicVariable "dayz_knockout";
player playActionNow "PutDown";
sleep 1;
};
 
if (_hasCrowbar2) then {
dayz_knockout = [_body,3.5];
publicVariable "dayz_knockout";
player playActionNow "PutDown";
sleep 1;
};
};
 
if (_knockoutMode == 2) then {
if (_hasPrimary == 1) then {
dayz_knockout = [_body,3.5];
publicVariable "dayz_knockout";
player playActionNow "PutDown";
sleep 1;
} else {
cutText ["You need a Primary Weapon for this!" , "PLAIN DOWN"];
};
};

So instead of adding it to commanding menu, I add it in fn_selfactions? or what?

NVM answered myself.

Because it was working on 1.0.4.2 like that, did it change?

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...