Jump to content

[RELEASE] How to make Custom Player HUD By AsReMix


Recommended Posts

  • 2 months later...

Has anyone figured how to make this toggleable? using the end key? I've given it a shot in my dayz_spaceinterrupt and edited the hud SQF but it refuses to toggle, heres my SQF's (I've proabaly done it horribly wrong :P all help is appreciated :D

EDIT: Got it working now but for some reason the HUD takes ages to "disappear" it will visibly pause itself (the FPS counter freezes) but it takes 5-10 seconds to go away, I've updated my code in the SQF's bellow

Also in m hud i have a working implementation of restart in hours + mins rather than uptime, I think i found it via an old post on Open DayZ, a post by MGM or pulled it from infistar's debug menu, credits to whoever the source was :D
 

HUD

/* 
Author : AsReMixhud
Edited By : Peter Beer
*/

fnc_debug = {
disableSerialization;
DZE_AsReMix_PLAYER_HUD = true;
while {DZE_AsReMix_PLAYER_HUD} do
{
  1000 cutRsc ["AsReMixhud","PLAIN"];

  _wpui = uiNameSpace getVariable "AsReMixhud";
  _vitals = _wpui displayCtrl 4900;
  _Player = player;

  ZombieKills   =   _Player getVariable["zombieKills",0];
  Money           =   _Player getVariable["cashMoney",0];
  Hero_Kills    =   _Player getVariable["humanKills",0];
  Bank_Balance   =   _Player getVariable["bankMoney",0];
  Bandit_Kills   =   _Player getVariable["banditKills",0];
  Humanity       =   _Player getVariable["humanity",0];
  Blood           =   _Player getVariable["USEC_BloodQty",12000];
  Fps           =   (round diag_fps);
 
  _stime = 0;
  if (serverTime > 36000) then {
   _stime = time;
  } else { _stime = serverTime;
 
  };
  _optime = _stime - (360*60);
  if (_optime < 0) then {_optime = _optime * -1;};
  _hours = (_optime/60/60);
  _hours = toArray (str _hours);
  _hours resize 1;
  _hours = toString _hours;
  _hours = compile _hours;
  _hours = call  _hours;
  _minutes = floor(_optime/60);
  _minutes2 = ((_minutes - (_hours*60)) min 60) max 0;if (_minutes2 < 10) then {_minutes2 = format ['0%1',_minutes2];};
 
  if(Humanity >= 7500) then { Humanity_Icon = "<img size='0.9' image='gui\hero.paa'/>"; };
  if((Humanity >= -14999) && (Humanity <= 7499)) then { Humanity_Icon = "<img size='0.9' image='gui\survivor.paa'/>"; };
  if(Humanity <= -15000) then { Humanity_Icon = "<img size='0.9' image='gui\bandit.paa'/>"; };

  _vitals ctrlSetStructuredText parseText format
["
  <t size='0.8' align='right'>~~~~~ Stats ~~~~~</t><br/>
  <t size='0.9'> Blood: %1 </t><img size='0.9' align='right' image='gui\blood.paa'/><br/>
  <t size='0.9'> Humanity: %2 %3 </t><br/>
  <t size='0.9'> Wallet: £%4 </t><img size='0.9' align='right' image='gui\coins.paa'/><br/>
  <t size='0.9'> Bank Balance: £%5 </t><img size='0.9' align='right' image='gui\safe.paa'/><br/>
  <t size='0.9'> Hero Kills: %6 </t><img size='0.9' align='right' image='gui\hero.paa'/><br/>
  <t size='0.9'> Bandit Kills: %7 </t><img size='0.9' align='right' image='gui\bandit.paa'/><br/>
  <t size='0.9'> Zombie Kills: %8 </t><img size='0.9' align='right' image='gui\zombie.paa'/><br/>
  <t size='0.9'> Restart In: %9h %10min </t><img size='0.9' align='right' image='gui\restart.paa'/><br/>
  <t size='0.9'> FPS: %11 </t><img size='0.9' align='right' image='gui\fps.paa'/><br/>
  <t size='0.8' align='right'>~~~~~~~~~~~~~~~~~</t><br/>",
  Blood, //1
  [Humanity] call BIS_fnc_numberText, //2
  Humanity_Icon, //3
  [Money] call BIS_fnc_numberText, //4
  [Bank_Balance] call BIS_fnc_numberText, //5
  Hero_Kills, //6
  Bandit_Kills, //7
  Zombiekills, //8
  _hours, //9
  _minutes2, //10
  Fps //11
];
  _vitals ctrlCommit 0;
  sleep 1.5;
};
};

[] spawn fnc_debug;



dayz_spaceinterrupt

private ["_dikCode","_handled","_primaryWeapon","_secondaryWeapon","_nearbyObjects","_nill","_shift","_ctrl","_alt","_dropPrimary","_dropSecondary","_iItem","_removed","_iPos","_radius","_item"];
_dikCode =  _this select 1;

_handled = false;
if ((animationState player) in ["smk_urbanproneright","smk_prone_to_urbanprone_right","smk_urbanproneleft","smk_prone_to_urbanprone_left"]) then {
player switchMove "";
player playActionNow "Down";
cutText ["\n\nUrban prone stances have been disabled.", "PLAIN DOWN"];
};

if (_dikCode in[0x02,0x03,0x04,0x58,0x57,0x44,0x43,0x42,0x41,0x40,0x3F,0x3E,0x3D,0x3C,0x3B,0x0B,0x0A,0x09,0x08,0x07,0x06,0x05]) then {
_handled = true;
};

if ((_dikCode == 0x3E or _dikCode == 0x0F or _dikCode == 0xD3)) then {
if(diag_tickTime - dayz_lastCheckBit > 10) then {
  dayz_lastCheckBit = diag_tickTime;
  call dayz_forceSave;
};
call dayz_EjectPlayer;
};

// esc
if (_dikCode == 0x01) then {
DZE_cancelBuilding = true;
call dayz_EjectPlayer;
};

//END Debug
if (_dikCode == 0xCF) then {
if (DZE_AsReMix_PLAYER_HUD) then {
  DZE_AsReMix_PLAYER_HUD = false;
  hintSilent "";
} else {
  [] spawn fnc_debug;
  _handled
};
};


// Disable ESC after death
if (_dikCode == 0x01 && r_player_dead) then {
_handled = true;
};

// surrender
if (_dikCode in actionKeys "Surrender") then {

_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder and !_inVehicle);

if (_canDo and !DZE_Surrender and !(player isKindOf  "PZombie_VB")) then {
  DZE_Surrender = true;
  _dropPrimary = false;
  _dropSecondary = false;

  _primaryWeapon = primaryWeapon player;
  if (_primaryWeapon != "") then {_dropPrimary = true;};
  _secondaryWeapon = "";
  {
   if ((getNumber (configFile >> "CfgWeapons" >> _x >> "Type")) == 2) exitWith {
     _secondaryWeapon = _x;
   };
  } forEach (weapons player);
  if (_secondaryWeapon != "") then {_dropSecondary = true;};

  if (_dropPrimary or _dropSecondary) then {
   player playActionNow "PutDown";
   _iPos = getPosATL player;
   _radius = 1;
   _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
   _item setposATL _iPos;
   if (_dropPrimary) then {
    _iItem = _primaryWeapon;
    _removed = ([player,_iItem,1] call BIS_fnc_invRemove);
    if (_removed == 1) then {
     _item addWeaponCargoGlobal [_iItem,1];
    };
   };
   if (_dropSecondary) then {
    _iItem = _secondaryWeapon;
    _removed = ([player,_iItem,1] call BIS_fnc_invRemove);
    if (_removed == 1) then {
     _item addWeaponCargoGlobal [_iItem,1];
    };
   };
   player reveal _item;
  };

  // set publicvariable that allows other player to access gear
  player setVariable ["DZE_Surrendered", true, true];
  // surrender animation
  player playMove "AmovPercMstpSsurWnonDnon";
};
_handled = true;
};

if (_dikCode in actionKeys "MoveForward") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};};
if (_dikCode in actionKeys "MoveLeft") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};};
if (_dikCode in actionKeys "MoveRight") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};};
if (_dikCode in actionKeys "MoveBack") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};};

//Prevent exploit of drag body
if ((_dikCode in actionKeys "Prone") and r_drag_sqf) exitWith { force_dropBody = true; };
if ((_dikCode in actionKeys "Crouch") and r_drag_sqf) exitWith { force_dropBody = true; };

_shift =  _this select 2;
_ctrl =  _this select 3;
_alt =  _this select 4;

//diag_log format["Keypress: %1", _this];
if ((_dikCode in actionKeys "Gear") and (vehicle player != player) and !_shift and !_ctrl and !_alt && !dialog) then {
   createGearDialog [player, "RscDisplayGear"];
   _handled = true;
};

if (_dikCode in (actionKeys "GetOver")) then {

if (player isKindOf  "PZombie_VB") then {
  _handled = true;
  DZE_PZATTACK = true;
} else {
  _nearbyObjects = nearestObjects[getPosATL player, dayz_disallowedVault, 8];
  if (count _nearbyObjects > 0) then {
   if((diag_tickTime - dayz_lastCheckBit > 4)) then {
    [objNull, player, rSwitchMove,"GetOver"] call RE;
    player playActionNow "GetOver";
    dayz_lastCheckBit = diag_tickTime;
   } else {
    _handled = true;
   };
  };
};
};
//if (_dikCode == 57) then {_handled = true}; // space
//if (_dikCode in actionKeys 'MoveForward' or _dikCode in actionKeys 'MoveBack') then {r_interrupt = true};
//if (_dikCode == 210) then {
//  _nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
//};

if (_dikCode in actionKeys "ForceCommandingMode") then {_handled = true};
if (_dikCode in actionKeys "PushToTalk" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = diag_tickTime;
[player,50,true,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "VoiceOverNet" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = diag_tickTime;
[player,50,true,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "PushToTalkDirect" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = diag_tickTime;
[player,15,false,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "Chat" and (diag_tickTime - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = diag_tickTime;
[player,15,false,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "User20" and (diag_tickTime - dayz_lastCheckBit > 5)) then {
dayz_lastCheckBit = diag_tickTime;
_nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};

// numpad 8 0x48 now pgup 0xC9 1
if ((_dikCode == 0xC9 and (!_alt or !_ctrl)) or (_dikCode in actionKeys "User15")) then {
DZE_Q = true;
};
// numpad 2 0x50 now pgdn 0xD1
if ((_dikCode == 0xD1 and (!_alt or !_ctrl)) or (_dikCode in actionKeys "User16")) then {
DZE_Z = true;
};


// numpad 8 0x48 now pgup 0xC9 0.1
if ((_dikCode == 0xC9 and (_alt and !_ctrl)) or (_dikCode in actionKeys "User13")) then {
DZE_Q_alt = true;
};
// numpad 2 0x50 now pgdn 0xD1
if ((_dikCode == 0xD1 and (_alt and !_ctrl)) or (_dikCode in actionKeys "User14")) then {
DZE_Z_alt = true;
};


// numpad 8 0x48 now pgup 0xC9 0.01
if ((_dikCode == 0xC9 and (!_alt and _ctrl)) or (_dikCode in actionKeys "User7")) then {
DZE_Q_ctrl = true;
};
// numpad 2 0x50 now pgdn 0xD1
if ((_dikCode == 0xD1 and (!_alt and _ctrl)) or (_dikCode in actionKeys "User8")) then {
DZE_Z_ctrl = true;
};




// numpad 4 0x4B now Q 0x10
if (_dikCode == 0x10 or (_dikCode in actionKeys "User17")) then {
DZE_4 = true;
}; 
// numpad 6 0x4D now E 0x12
if (_dikCode == 0x12 or (_dikCode in actionKeys "User18")) then {
DZE_6 = true;
};
// numpad 5 0x4C now space 0x39
if (_dikCode == 0x39 or (_dikCode in actionKeys "User19")) then {
DZE_5 = true;
};

// F key
if ((_dikCode == 0x21 and (!_alt and !_ctrl)) or (_dikCode in actionKeys "User6")) then {
DZE_F = true;
};

_handled

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
  • 7 months later...
  • 7 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...