Jump to content

Recommended Posts

Can anyone help sort this problem please?

FN_hudUpdate

#include "..\..\script_macros.hpp"
#define IDC_LIFE_BAR_FOOD 2200
#define IDC_LIFE_BAR_WATER 2201
#define IDC_LIFE_BAR_HEALTH 2202
#define IDC_LIFE_FOOD_TEXT 1000
#define IDC_LIFE_WATER_TEXT 1001
#define IDC_LIFE_HEALTH_TEXT 1002

#define LIFEdisplay (GVAR_UINS ["playerHUD",displayNull])
#define LIFEctrl(ctrl) ((GVAR_UINS ["playerHUD",displayNull]) displayCtrl ctrl)
/*
	File: fn_hudUpdate.sqf
	Author: Dillon "Itsyuka" Modine-Thuen

	Description:
	Updates the HUD when it needs to.
*/
disableSerialization;

if(isNull LIFEdisplay) then {[] call life_fnc_hudSetup;};
LIFEctrl(IDC_LIFE_BAR_FOOD) progressSetPosition (1 / (100 / life_hunger));
LIFEctrl(IDC_LIFE_BAR_WATER) progressSetPosition (1 / (100 / life_thirst));
LIFEctrl(IDC_LIFE_BAR_HEALTH) progressSetPosition (1 - (damage player));

LIFEctrl(IDC_LIFE_FOOD_TEXT) ctrlsetText format["%1", life_hunger];
LIFEctrl(IDC_LIFE_WATER_TEXT) ctrlsetText format["%1", life_thirst];
LIFEctrl(IDC_LIFE_HEALTH_TEXT) ctrlsetText format["%1", round((1 - (damage player)) * 100)];

FN_hudSetup

#include "..\..\script_macros.hpp"
/*
	File: fn_hudSetup.sqf
	Author: Bryan "Tonic" Boardwine
	
	Description:
	Setups the hud for the player?
*/
private["_alpha","_version","_p","_pg"];
disableSerialization;
_alpha = CONTROL(46,1001);
_version = CONTROL(46,1000);

2 cutRsc ["playerHUD","PLAIN"];
_version ctrlSetText format["BETA: 0.%1.%2",(productVersion select 2),(productVersion select 3)];
[] call life_fnc_hudUpdate;

[] spawn
{
	private["_dam"];
	while {true} do
	{
		_dam = damage player;
		waitUntil {(damage player) != _dam};
		[] call life_fnc_hudUpdate;
	};
};

hud_stats.hpp

#define INFINITE 1e+1000
#define IDC_LIFE_BAR_FOOD 2200
#define IDC_LIFE_BAR_WATER 2201
#define IDC_LIFE_BAR_HEALTH 2202
#define IDC_LIFE_PICTURE_FOOD 1200
#define IDC_LIFE_PICTURE_WATER 1201
#define IDC_LIFE_PICTURE_HEALTH 1202
#define IDC_LIFE_FOOD_TEXT 1000
#define IDC_LIFE_WATER_TEXT 1001
#define IDC_LIFE_HEALTH_TEXT 1002
/*
	Name: Dillon "Itsyuka" Modine-Thuen
	File: ui.hpp
*/

class playerHUD {
	idd = -1;
	duration = INFINITE;
	movingEnable = 0;
	fadein = 0;
	fadeout = 0;
	name = "playerHUD";
	onLoad = "uiNamespace setVariable ['playerHUD',_this select 0]";
	objects[] = {};
	controls[] = {
		LIFE_UI_BACK,
		LIFE_BAR_FOOD,
		LIFE_BAR_WATER,
		LIFE_BAR_HEALTH,
		LIFE_PICTURE_FOOD,
		LIFE_PICTURE_WATER,
		LIFE_PICTURE_HEALTH,
		LIFE_FOOD_TEXT,
		LIFE_WATER_TEXT,
		LIFE_HEALTH_TEXT
	};

	/* Background */
	class LIFE_UI_BACK: Life_RscBackground
	{
		colorBackground[] = {0,0,0,0.5};
		x = 0.917656 * safezoneW + safezoneX;
		y = 0.819 * safezoneH + safezoneY;
		w = 0.0825 * safezoneW;
		h = 0.11 * safezoneH;
	};

	/* Progress Bars */
	class LIFE_BAR_FOOD: Life_RscProgress
	{
		idc = IDC_LIFE_BAR_FOOD;
		x = 0.938281 * safezoneW + safezoneX;
		y = 0.83 * safezoneH + safezoneY;
		w = 0.061875 * safezoneW;
		h = 0.022 * safezoneH;
	};
	class LIFE_BAR_WATER: Life_RscProgress
	{
		idc = IDC_LIFE_BAR_WATER;
		x = 0.938281 * safezoneW + safezoneX;
		y = 0.863 * safezoneH + safezoneY;
		w = 0.061875 * safezoneW;
		h = 0.022 * safezoneH;
	};
	class LIFE_BAR_HEALTH: Life_RscProgress
	{
		idc = 2202;
		x = 0.938281 * safezoneW + safezoneX;
		y = 0.896 * safezoneH + safezoneY;
		w = 0.061875 * safezoneW;
		h = 0.022 * safezoneH;
	};

	/* Text */

	class LIFE_FOOD_TEXT: Life_RscText
	{
		idc = IDC_LIFE_FOOD_TEXT;
		text = "";
		x = 0.958906 * safezoneW + safezoneX;
		y = 0.8344 * safezoneH + safezoneY;
		w = 0.020625 * safezoneW;
		h = 0.011 * safezoneH;
	};
	class LIFE_WATER_TEXT: Life_RscText
	{
		idc = IDC_LIFE_WATER_TEXT;
		text = "";
		x = 0.958905 * safezoneW + safezoneX;
		y = 0.8674 * safezoneH + safezoneY;
		w = 0.020625 * safezoneW;
		h = 0.011 * safezoneH;
	};
	class LIFE_HEALTH_TEXT: Life_RscText
	{
		idc = IDC_LIFE_HEALTH_TEXT;
		text = "";
		x = 0.958906 * safezoneW + safezoneX;
		y = 0.9004 * safezoneH + safezoneY;
		w = 0.020625 * safezoneW;
		h = 0.011 * safezoneH;
	};

	/* Icons */
	class LIFE_PICTURE_FOOD: life_RscPicture
	{
		idc = IDC_LIFE_PICTURE_FOOD;
		text = "icons\food.paa";
		x = 0.922813 * safezoneW + safezoneX;
		y = 0.83 * safezoneH + safezoneY;
		w = 0.03; h = 0.04;
	};
	class LIFE_PICTURE_WATER: life_RscPicture
	{
		idc = IDC_LIFE_PICTURE_WATER;
		text = "icons\water.paa";
		x = 0.922813 * safezoneW + safezoneX;
		y = 0.863 * safezoneH + safezoneY;
		w = 0.03; h = 0.04;
	};
	class LIFE_PICTURE_HEALTH: life_RscPicture
	{
		idc = IDC_LIFE_PICTURE_HEALTH;
		text = "icons\health.paa";
		x = 0.922813 * safezoneW + safezoneX;
		y = 0.896 * safezoneH + safezoneY;
		w = 0.03; h = 0.04;
	};
};

https://imgur.com/hLU16tC

Share this post


Link to post
Share on other sites

Your hudUpdate contains GVAR_UINS which doesn't exist in 4.4r4 or 5.0. Try this:

#include "..\..\script_macros.hpp"
#define IDC_LIFE_BAR_FOOD 2200
#define IDC_LIFE_BAR_WATER 2201
#define IDC_LIFE_BAR_HEALTH 2202
#define IDC_LIFE_FOOD_TEXT 1000
#define IDC_LIFE_WATER_TEXT 1001
#define IDC_LIFE_HEALTH_TEXT 1002

#define LIFEdisplay (uiNamespace getVariable ["playerHUD",displayNull])
#define LIFEctrl(ctrl) ((uiNamespace getVariable ["playerHUD",displayNull]) displayCtrl ctrl)
/*
	File: fn_hudUpdate.sqf
	Author: Dillon "Itsyuka" Modine-Thuen

	Description:
	Updates the HUD when it needs to.
*/
disableSerialization;

if(isNull LIFEdisplay) then {[] call life_fnc_hudSetup;};
LIFEctrl(IDC_LIFE_BAR_FOOD) progressSetPosition (1 / (100 / life_hunger));
LIFEctrl(IDC_LIFE_BAR_WATER) progressSetPosition (1 / (100 / life_thirst));
LIFEctrl(IDC_LIFE_BAR_HEALTH) progressSetPosition (1 - (damage player));

LIFEctrl(IDC_LIFE_FOOD_TEXT) ctrlsetText format["%1", life_hunger];
LIFEctrl(IDC_LIFE_WATER_TEXT) ctrlsetText format["%1", life_thirst];
LIFEctrl(IDC_LIFE_HEALTH_TEXT) ctrlsetText format["%1", round((1 - (damage player)) * 100)];

 

Share this post


Link to post
Share on other sites
13 hours ago, TrueAllegiant said:

It's not updating when hit and thirst and that

It's not updating on damage at all? Does it actually get the correct values when you spawn? Are you using the version I posted?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...