mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
Add new combat function
This commit is contained in:
12
SQF/dayz_code/compile/fn_setCombat.sqf
Normal file
12
SQF/dayz_code/compile/fn_setCombat.sqf
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
local _object = _this select 0;
|
||||||
|
local _setCombatOverTime = _this select 1;
|
||||||
|
|
||||||
|
if (_setCombatOverTime) then {
|
||||||
|
_object setVariable["combattimeout", diag_tickTime + DZE_CombatTimer];
|
||||||
|
} else {
|
||||||
|
_object setVariable["startcombattimer", 1];
|
||||||
|
};
|
||||||
|
|
||||||
|
if !(_object getVariable ["inCombat",false]) then {
|
||||||
|
_object setVariable ["inCombat",true,true];
|
||||||
|
};
|
||||||
@@ -748,6 +748,7 @@ if (!isDedicated) then {
|
|||||||
DZ_KeyDown_EH = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\keyboard.sqf";
|
DZ_KeyDown_EH = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\keyboard.sqf";
|
||||||
dayz_EjectPlayer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dze_ejectPlayer.sqf";
|
dayz_EjectPlayer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dze_ejectPlayer.sqf";
|
||||||
fnc_isInsideBuilding = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
|
fnc_isInsideBuilding = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
|
||||||
|
fnc_setCombat = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_setCombat.sqf";
|
||||||
};
|
};
|
||||||
|
|
||||||
//Both
|
//Both
|
||||||
@@ -781,7 +782,6 @@ local_zombieDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\comp
|
|||||||
local_setFuel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_setFuel.sqf"; //Generated when someone refuels a vehicle
|
local_setFuel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_setFuel.sqf"; //Generated when someone refuels a vehicle
|
||||||
local_eventKill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_eventKill.sqf"; //Generated when something is killed
|
local_eventKill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_eventKill.sqf"; //Generated when something is killed
|
||||||
player_humanityChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityChange.sqf"; //New
|
player_humanityChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityChange.sqf"; //New
|
||||||
player_projectileNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_projectileNear.sqf";
|
|
||||||
player_bloodCalc = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\bloodCalc.sqf";
|
player_bloodCalc = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\bloodCalc.sqf";
|
||||||
fn_selectRandomLocation = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selectRandomLocation.sqf";
|
fn_selectRandomLocation = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selectRandomLocation.sqf";
|
||||||
fn_addCargo = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_addCargo.sqf";
|
fn_addCargo = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_addCargo.sqf";
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
if !(isDedicated) then {
|
if !(isDedicated) then {
|
||||||
private "_amm";
|
local _amm = _this select 4;
|
||||||
|
|
||||||
_amm = _this select 4;
|
|
||||||
_this call (call compile GetText (configFile >> "CfgAmmo" >> _amm >> "muzzleEffect"));
|
_this call (call compile GetText (configFile >> "CfgAmmo" >> _amm >> "muzzleEffect"));
|
||||||
//Handle combat in vehicle
|
//Handle combat in vehicle
|
||||||
if (player in (crew (_this select 0))) then {
|
if (player in (crew (_this select 0))) then {
|
||||||
if !(player getVariable ["inCombat",false]) then {
|
[player,true] call fnc_setCombat;
|
||||||
player setVariable ["inCombat",true,true];
|
|
||||||
};
|
|
||||||
player setVariable["combattimeout", diag_tickTime + 30, false];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,11 +14,6 @@ _timer150 = diag_ticktime;
|
|||||||
player setVariable ["temperature",dayz_temperatur,true];
|
player setVariable ["temperature",dayz_temperatur,true];
|
||||||
player setVariable["friendlies",DZE_Friends,true];
|
player setVariable["friendlies",DZE_Friends,true];
|
||||||
|
|
||||||
//[0,0] call player_humanityChange;
|
|
||||||
|
|
||||||
//player addMagazine "Hatchet_swing";
|
|
||||||
//player addWeapon "MeleeHatchet";
|
|
||||||
|
|
||||||
while {1 == 1} do {
|
while {1 == 1} do {
|
||||||
//_start = diag_tickTime;
|
//_start = diag_tickTime;
|
||||||
|
|
||||||
@@ -281,8 +276,7 @@ while {1 == 1} do {
|
|||||||
|
|
||||||
_startcombattimer = player getVariable["startcombattimer", 0];
|
_startcombattimer = player getVariable["startcombattimer", 0];
|
||||||
if (_startcombattimer == 1) then { //Do not use _PlayerNearby it makes building impossible, this is handled in player_onPause.sqf just fine
|
if (_startcombattimer == 1) then { //Do not use _PlayerNearby it makes building impossible, this is handled in player_onPause.sqf just fine
|
||||||
player setVariable["combattimeout", diag_tickTime + 30, false];
|
[player,true] call fnc_setCombat;
|
||||||
if !(player getVariable["inCombat",false]) then {player setVariable["inCombat",true,true];};
|
|
||||||
player setVariable["startcombattimer", 0, false];
|
player setVariable["startcombattimer", 0, false];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ sched_playerActions = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//combat check
|
//combat check
|
||||||
if ((player getVariable ["combattimeout",0] < diag_tickTime) && {player getVariable ["inCombat",false]}) then {
|
if ((player getVariable ["combattimeout",0] < diag_tickTime) && {player getVariable ["inCombat",false]} && {player getVariable["startcombattimer", 0] == 0}) then {
|
||||||
player setVariable ["inCombat", false, true];
|
player setVariable ["inCombat", false, true];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user