Update humanity morphing

Vanilla commits:

33d4165e64

6674be6d5f

f4d18a6fef
This commit is contained in:
ebayShopper
2017-11-25 14:52:06 -05:00
parent 1e65d5d324
commit ac10daeb4d
7 changed files with 86 additions and 55 deletions

View File

@@ -1,4 +1,8 @@
private ["_change","_wait","_humanity","_model","_isMen","_isMenH","_isMenB","_isWomen","_isWomenH","_isWomenB"];
private ["_change","_wait","_humanity"];
/*
Set humanity chanages and sets freeTarget(openTarget)
*/
_change = _this select 0;
_wait = _this select 1;
@@ -7,7 +11,6 @@ player setVariable["humanity",_humanity,true];
if (_change < 0) then { //non-bandit player can be "punished" in next "_wait" seconds w/o loosing humanity
if ((_humanity > -2000) and (_wait > 0)) then {
// player setVariable ["freeTarget",true,true];
player setVariable ["FTcounter",((player getVariable ["FTcounter",0]) + _wait)];
[_wait] spawn {
private ["_endtime","_wait"];
@@ -17,59 +20,13 @@ if (_change < 0) then { //non-bandit player can be "punished" in next "_wait" se
player setVariable ["FTcounter",((player getVariable ["FTcounter",0]) - _wait)];
if ((player getVariable ["FTcounter",0]) <= 0) then {
player setVariable ["FTcounter",0];
// player setVariable ["freeTarget",false,true];
};
};
};
};
/* Humanity morphing disabled on Epoch to avoid loss of purchased clothing
//add humanity cap both ways
//if (_humanity < 500000) then { player setVariable["humanity",-500000,true]; }; //Hive adds/removes diffrence
//if (_humanity > 500000) then { player setVariable["humanity",500000,true]; }; //Hive adds/removes diffrence
_model = typeOf player;
//if model will not be changed by humanity
if !(_model in ["Survivor1_DZ","Survivor2_DZ","Survivor3_DZ","SurvivorW2_DZ","SurvivorW3_DZ","Bandit1_DZ","BanditW1_DZ"]) exitWith {};
//don't switch model when in a vehicle (ejects player)
if (vehicle player != player) exitWith {};
//Not sure if this will work needs testing
_isMen = _model == "Survivor1_DZ" || _model == "Survivor2_DZ";
_isMenH = _model == "Survivor3_DZ";
_isMenB = _model == "Bandit1_DZ";
_isWomen = _model == "SurvivorW2_DZ";
_isWomenH = _model == "SurvivorW3_DZ"; //TODO
_isWomenB = _model == "BanditW1_DZ";
// Bandit
if (_humanity <= -2000) then {
if (_isMen || _isMenH) then {
[dayz_playerUID,dayz_characterID,"Bandit1_DZ"] spawn player_humanityMorph;
};
if (_isWomen || _isWomenH) then {
[dayz_playerUID,dayz_characterID,"BanditW1_DZ"] spawn player_humanityMorph;
};
};
//Survivor
if (_humanity > -2000 && _humanity <= 5000) then {
if (_isMenH || _isMenB) then {
[dayz_playerUID,dayz_characterID,"Survivor2_DZ"] spawn player_humanityMorph;
};
if (_isWomenH || _isWomenB) then {
[dayz_playerUID,dayz_characterID,"SurvivorW2_DZ"] spawn player_humanityMorph;
};
};
// Hero
if (_humanity > 5000) then {
if (_isMen || _isMenB) then {
[dayz_playerUID,dayz_characterID,"Survivor3_DZ"] spawn player_humanityMorph;
};
if (_isWomenB) then {
[dayz_playerUID,dayz_characterID,"SurvivorW2_DZ"] spawn player_humanityMorph;
};
};
*/
/*
Should block damageHandler running humanityCheck(Skin change check), allow all other humanity events to run humanityCheck(Skin change check)
*/
//if ((_wait == 0) and (vehicle player == player)) then { [_humanity] call player_humanityCheck; };
//Humanity morphing disabled on Epoch to avoid loss of purchased clothing

View File

@@ -0,0 +1,50 @@
private ["_humanity","_model","_isMen","_isMenH","_isMenB","_isWomen","_isWomenH","_isWomenB"];
_humanity = _this select 0;
//add humanity cap both ways
//if (_humanity < 500000) then { player setVariable["humanity",-500000,true]; }; //Hive adds/removes diffrence
//if (_humanity > 500000) then { player setVariable["humanity",500000,true]; }; //Hive adds/removes diffrence
_model = typeOf player;
//if model will not be changed by humanity
if !(_model in ["Survivor1_DZ","Survivor2_DZ","Survivor3_DZ","SurvivorW2_DZ","SurvivorW3_DZ","Bandit1_DZ","BanditW1_DZ"]) exitWith {};
//Not sure if this will work needs testing
_isMen = _model == "Survivor1_DZ" || _model == "Survivor2_DZ";
_isMenH = _model == "Survivor3_DZ";
_isMenB = _model == "Bandit1_DZ";
_isWomen = _model == "SurvivorW2_DZ";
_isWomenH = _model == "SurvivorW3_DZ"; //TODO
_isWomenB = _model == "BanditW1_DZ";
// Bandit
if (_humanity <= -2000) then {
if (_isMen || _isMenH) then {
[dayz_playerUID,dayz_characterID,"Bandit1_DZ"] spawn player_humanityMorph;
};
if (_isWomen || _isWomenH) then {
[dayz_playerUID,dayz_characterID,"BanditW1_DZ"] spawn player_humanityMorph;
};
};
//Survivor
if (_humanity > -2000 && _humanity <= 5000) then {
if (_isMenH || _isMenB) then {
[dayz_playerUID,dayz_characterID,"Survivor2_DZ"] spawn player_humanityMorph;
};
if (_isWomenH || _isWomenB) then {
[dayz_playerUID,dayz_characterID,"SurvivorW2_DZ"] spawn player_humanityMorph;
};
};
// Hero
if (_humanity > 5000) then {
if (_isMen || _isMenB) then {
[dayz_playerUID,dayz_characterID,"Survivor3_DZ"] spawn player_humanityMorph;
};
if (_isWomenB) then {
[dayz_playerUID,dayz_characterID,"SurvivorW2_DZ"] spawn player_humanityMorph;
};
};

View File

@@ -2,8 +2,10 @@ private ["_charID","_newmodel","_old","_humanity","_medical","_worldspace","_zom
//_playerUID = _this select 0;
_charID = _this select 1;
_model = _this select 2;
_old = player;
if (typeOf player == _model) exitWith {};
_old = player;
_old removeAllEventHandlers "FiredNear";
_old removeAllEventHandlers "HandleDamage";
_old removeAllEventHandlers "Killed";

View File

@@ -652,7 +652,8 @@ player_medTransfuse = compile preprocessFileLineNumbers "\z\addons\dayz_code\med
player_medMorphine = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medMorphine.sqf";
player_medPainkiller = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medPainkiller.sqf";
player_medAntiBiotics = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medAntibiotics.sqf";
player_humanityChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityChange.sqf";
player_humanityChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityChange.sqf"; //New
player_humanityCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityCheck.sqf"; //Old
player_projectileNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_projectileNear.sqf";
player_bloodCalc = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\bloodCalc.sqf";
fn_selectRandomLocation = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selectRandomLocation.sqf";

View File

@@ -670,6 +670,7 @@ if (!isDedicated) then {
dayz_hitByTime = 0;
skipGearSound = false;
TimeOutDisplayed = false;
playerHumanityCHK = 0;
voice_actions = ["voiceOverNet","PushToTalk","PushToTalkAll","PushToTalkCommand","PushToTalkDirect","PushToTalkGroup","PushToTalkSide","PushToTalkVehicle"];
// EPOCH ADDITIONS

View File

@@ -0,0 +1,18 @@
#include "scheduler.hpp"
sched_humanityChange = {
HIDE_FSM_VARS
_startcombattimer = player getVariable["startcombattimer", 0];
//If player is not in combat and humanity differs from the last time it ran run humanityCheck(skin change check)
if (_startcombattimer == 0) then {
_playerHumanity = player getVariable ["humanity",0];
if ((_playerHumanity != playerHumanityCHK) and (vehicle player == player)) then {
[_playerHumanity] call player_humanityCheck;
playerHumanityCHK = _playerHumanity;
};
};
objNull
};

View File

@@ -14,6 +14,7 @@ call compile preprocessFileLineNumbers (_base+"sched_medical.sqf");
//call compile preprocessFileLineNumbers (_base+"sched_achievement.sqf");
call compile preprocessFileLineNumbers (_base+"sched_gui.sqf");
call compile preprocessFileLineNumbers (_base+"sched_buildingBubble.sqf");
//call compile preprocessFileLineNumbers (_base+"sched_humanityChange.sqf");
if (dayz_antihack == 1) then {
call compile preprocessFileLineNumbers (_base+"sched_security.sqf");
@@ -39,6 +40,7 @@ if (count _list == 0) then {
[ 6, 24.18, sched_spawnCheck, sched_spawnCheck_init ],
[ 1, 0.63, sched_throwable, sched_throwable_init ],
[ 1, 0.33, sched_medical, sched_medical_init ],
//[ 15, 3, sched_humanityChange ], //Humanity morphing disabled on Epoch to avoid loss of purchased clothing
//[ 3, 2.70, sched_achievement, sched_achievement_init ],
[ 4, 2.38, sched_bloodStains, sched_bloodStains_init ],
[ 60, 10.44, sched_animals ],