player_spawn_2 - Humanity Changes

Manatee Hunter

Valued Member!
Hey,

I been basically working off some of the stuff i've seen on Tavi with the skin changes at various humanity levels....

When I test this in game (switching around humanity in the DB), it DOES appear to occur in game, but every 10-15 seconds it attempts to do a character model change, but ends up staying the same... But it's REALLY intrusive... I assume I've missed something somewhere, not sure if anyone knows what it might be?

Also - Don't mind the redic humanity levels.

Code:
private["_refObj","_size","_vel","_speed","_hunger","_thirst","_array","_unsaved","_timeOut","_result","_lastSave"];
disableSerialization;
_timeOut =    0;
_messTimer = 0;
_lastSave = 0;
_lastTemp = dayz_temperatur;
_debug = getMarkerpos "respawn_west";
_isBandit = false;
_isHero = false;
 
player setVariable ["temperature",dayz_temperatur,true];
 
dayz_myLoad = (((count dayz_myBackpackMags) * 0.2) + (count dayz_myBackpackWpns)) +  (((count dayz_myMagazines) * 0.1) + (count dayz_myWeapons * 0.5));
 
    //player addMagazine "Hatchet_swing";
    //player addWeapon "MeleeHatchet";
 
while {true} do {
    //Initialize
    _refObj =    vehicle player;
    _size =    (sizeOf typeOf _refObj) * 0.6;
    _vel =        velocity player;
    _speed =    round((_vel distance [0,0,0]) * 3.5);
    _saveTime = (playersNumber west * 2) + 10;
       
    //reset position
    _randomSpot = true;
    _tempPos = getPosATL player;
    _distance = _debug distance _tempPos;
    if (_distance < 2000) then {
        _randomSpot = false;
    };   
    _distance = [0,0,0] distance _tempPos;
    if (_distance < 500) then {
        _randomSpot = false;
    };
    _distance = _mylastPos distance _tempPos;
    if (_distance > 400) then {
        _randomSpot = false;
    };
   
    if (_randomSpot) then {
        _mylastPos = _tempPos;
    };
   
    dayz_mylastPos = _mylastPos;
    dayz_areaAffect = _size;
   
    //CheckVehicle
    /*
    if (_refObj != player) then {
        _isSync =_refObj getVariable ["ObjectID",0] > 0;
        if (!_isSync) then {
            _veh allowDamage true;
            _veh setDamage 1;
            player setDamage 1;           
        };
    };
    */
   
    if (_speed > 0.1) then {
        _timeOut = _timeOut + 1;
    };
   
    _humanity = player getVariable ["humanity",0];
 
    if (_humanity < -120000 and _timeOut > 5) then {
        //_isBandit3 = true;
        _model = typeOf player;
        if (_model in ["Clan_UN_Helmet_DZC","Clan_UN_Cap_DZC","Clan_Delta3_DZC","Clan_Delta","Survivor3_DZ","Clan_Terror_DZC","Clan_Terror2_DZC","Clan_GER_DZC","Clan_GER_Hvy_DZC"]) then {
           
            toModel = "Clan_GER_Hvy_DZC";
            _timeOut = 0;
            [dayz_playerUID,dayz_characterID,toModel] spawn player_humanityMorph;
        };
    };
   
    if (_humanity >= -120000 and _humanity <= -60000  and _timeOut > 5) then {
        _isBandit2 = true;
        _model = typeOf player;
        if (_model in  ["Clan_UN_Helmet_DZC","Clan_UN_Cap_DZC","Clan_Delta3_DZC","Clan_Delta","Survivor3_DZ","Clan_Terror_DZC","Clan_Terror2_DZC","Clan_GER_DZC","Clan_GER_Hvy_DZC"]) then {
            toModel = "Clan_GER_DZC";
            _timeOut = 0;
            [dayz_playerUID,dayz_characterID,toModel] spawn player_humanityMorph;
        };
    };
   
    if (_humanity > -60000 and _humanity < -30000 and _timeOut > 5) then {
        _isBandit = true;
        _model = typeOf player;
        if (_model in ["Clan_UN_Helmet_DZC","Clan_UN_Cap_DZC","Clan_Delta3_DZC","Clan_Delta","Survivor3_DZ","Clan_Terror_DZC","Clan_Terror2_DZC","Clan_GER_DZC","Clan_GER_Hvy_DZC"]) then {
           
            toModel = "Clan_Terror2_DZC";
            _timeOut = 0;
            [dayz_playerUID,dayz_characterID,toModel] spawn player_humanityMorph;
        };
    };
   
    if (_humanity > -30000 and _humanity < -15000 and _timeOut > 5) then {
        _isBandit = true;
        _model = typeOf player;
        if (_model in ["Clan_UN_Helmet_DZC","Clan_UN_Cap_DZC","Clan_Delta3_DZC","Clan_Delta","Survivor3_DZ","Clan_Terror_DZC","Clan_Terror2_DZC","Clan_GER_DZC","Clan_GER_Hvy_DZC"]) then {
           
            toModel = "Clan_Terror_DZC";
            _timeOut = 0;
            [dayz_playerUID,dayz_characterID,toModel] spawn player_humanityMorph;
        };
    };
   
    if (_humanity >= -15000 and _humanity <= 10000 and _timeOut > 5) then {
       
        _model = typeOf player;
        if (_model in ["Clan_UN_Helmet_DZC","Clan_UN_Cap_DZC","Clan_Delta3_DZC","Clan_Delta","Survivor3_DZ","Clan_Terror_DZC","Clan_Terror2_DZC","Clan_GER_DZC","Clan_GER_Hvy_DZC"]) then {
            toModel = "Survivor3_DZ";
            _timeOut = 0;
            [dayz_playerUID,dayz_characterID,toModel] spawn player_humanityMorph;
        };
    };
 
    if (_humanity > 10000 and _humanity < 20000 and _timeOut > 5) then {
       
        _model = typeOf player;
        if (_model in ["Clan_UN_Helmet_DZC","Clan_UN_Cap_DZC","Clan_Delta3_DZC","Clan_Delta","Survivor3_DZ","Clan_Terror_DZC","Clan_Terror2_DZC","Clan_GER_DZC","Clan_GER_Hvy_DZC"]) then {
            toModel = "Clan_Delta";
            _timeOut = 0;
            [dayz_playerUID,dayz_characterID,toModel] spawn player_humanityMorph;
        };
    };
   
    if (_humanity > 20000 and _humanity < 40000 and _timeOut > 5) then {
       
        _model = typeOf player;
        if (_model in ["Clan_UN_Helmet_DZC","Clan_UN_Cap_DZC","Clan_Delta3_DZC","Clan_Delta","Survivor3_DZ","Clan_Terror_DZC","Clan_Terror2_DZC","Clan_GER_DZC","Clan_GER_Hvy_DZC"]) then {
            toModel = "Clan_Delta3_DZC";
            _timeOut = 0;
            [dayz_playerUID,dayz_characterID,toModel] spawn player_humanityMorph;
        };
    };
   
    if (_humanity >= 40000 and _humanity <= 80000 and _timeOut > 5) then {
       
        _model = typeOf player;
        if (_model in ["Clan_UN_Helmet_DZC","Clan_UN_Cap_DZC","Clan_Delta3_DZC","Clan_Delta","Survivor3_DZ","Clan_Terror_DZC","Clan_Terror2_DZC","Clan_GER_DZC","Clan_GER_Hvy_DZC"]) then {
            toModel = "Clan_UN_Cap_DZC";
            _timeOut = 0;
            [dayz_playerUID,dayz_characterID,toModel] spawn player_humanityMorph;
        };
    };
   
    if (_humanity > 80000 and _timeOut > 5) then {
       
        _model = typeOf player;
        if (_model in ["Clan_UN_Helmet_DZC","Clan_UN_Cap_DZC","Clan_Delta3_DZC","Clan_Delta","Survivor3_DZ","Clan_Terror_DZC","Clan_Terror2_DZC","Clan_GER_DZC","Clan_GER_Hvy_DZC"]) then {
            toModel = "Clan_UN_Helmet_DZC";
            _timeOut = 0;
            [dayz_playerUID,dayz_characterID,toModel] spawn player_humanityMorph;
        };
    };
   
    //Has infection?
    //if (r_player_infected) then {
    //    [player,"cough",8,false] call dayz_zombieSpeak;
    //};
 
    //Record Check
    _lastUpdate =    time - dayZ_lastPlayerUpdate;
    if (_lastUpdate > 8) then {
        //POSITION?
        _distance = dayz_myPosition distance player;
        if (_distance > 10) then {
            //Player has moved
            dayz_myPosition = getPosATL player;
            player setVariable["posForceUpdate",true,true];
            dayz_unsaved = true;
            dayZ_lastPlayerUpdate = time;
        };
    };
 
Rest of it - Too long.
};
 
I would suggest making all of the changes via separate statements:

Code:
if (_humanity >= -120000 and _timeOut > 5) then
Code:
if (_humanity <= -60000 and _timeOut > 5) then

etc.

Also define who/what is a bandit/hero or whatever Tavi uses:

Code:
...
_debug = getMarkerpos "respawn_west";
//_isBandit = false;
//_isHero = false;
...

Code:
...
while {true} do {
    //Initialize
    ...
    _saveTime = (playersNumber west * 2) + 10;
    _isBandit = typeOf player == "Bandit1_DZ" || typeOf player == "BanditW1_DZ";
    _isHero = typeOf player == "Survivor3_DZ";
...

then something like this (taken from Vanilla DayZ)
Code:
if (_humanity > 4000 and !_isHero) then {
        _model = typeOf player;
        if (_model == "Survivor2_DZ") then {
            [dayz_playerUID,dayz_characterID,"Survivor3_DZ"] spawn player_humanityMorph;
        };
    };
 
Back
Top