Dateien die ihr Braucht: fn_hudUpdate.sqf fn_hudSetup ui.hpp und macro.hpp
Einfach alles copy pasten
fn_hudUpdate
Spoiler anzeigen
Code
#include <macro.h>
/*
File: fn_hudUpdate.sqf
Author: Daniel Stuart
Description:
Updates the HUD when it needs to.
*/
disableSerialization;
if(isNull LIFEdisplay) then {[] call life_fnc_hudSetup;};
LIFEctrl(2200) progressSetPosition (1 / (100 / life_hunger));
LIFEctrl(2201) progressSetPosition (1 - (damage player));
LIFEctrl(2202) progressSetPosition (1 / (100 / life_thirst));
Alles anzeigen
fn_hudSetup
Spoiler anzeigen
Code
#include <macro.h>
/*
File: fn_hudSetup.sqf
Author: Bryan "Tonic" Boardwine
Description:
Setups the hud for the player?
*/
disableSerialization;
2 cutRsc ["playerHUD","PLAIN"];
[] call life_fnc_hudUpdate;
[] spawn
{
private["_dam"];
while {true} do
{
_dam = damage player;
waitUntil {(damage player) != _dam};
[] call life_fnc_hudUpdate;
};
};
Alles anzeigen
ui.hpp
Spoiler anzeigen
Code
#define ST_CENTER 0x02
/*
Author: Daniel Stuart
File: hud_stats.hpp
*/
class playerHUD {
idd = -1;
duration = 10e10;
movingEnable = 0;
fadein = 0;
fadeout = 0;
name = "playerHUD";
onLoad = "uiNamespace setVariable ['playerHUD',_this select 0]";
objects[] = {};
controls[] = {
Life_RscBackground_HUD,
Life_RscProgress_HUDFood,
Life_RscProgress_HUDHealth,
Life_RscProgress_HUDWater,
Life_RscText_HUDFood,
Life_RscText_HUDHealth,
Life_RscText_HUDWater
};
/* Background */
class Life_RscBackground_HUD : Life_RscBackground {
colorBackground[] = {0,0,0,0.35};
x = 0.414815 * safezoneW + safezoneX;
y = 0.966667 * safezoneH + safezoneY;
w = 0.170371 * safezoneW;
h = 0.0333333 * safezoneH;
};
/* Progress Bars */
class LIFE_RscProgress_HUDCommon : Life_RscProgress {
colorFrame[] = {0, 0, 0, 0.8};
y = 0.972223 * safezoneH + safezoneY;
w = 0.0462964 * safezoneW;
h = 0.0222222 * safezoneH;
};
class Life_RscProgress_HUDFood : LIFE_RscProgress_HUDCommon {
idc = 2200;
colorBar[] = {0,0.50,0,0.65};
x = 0.418981 * safezoneW + safezoneX;
};
class Life_RscProgress_HUDHealth : LIFE_RscProgress_HUDCommon {
idc = 2201;
colorBar[] = {0.85,0.05,0,0.65};
x = 0.476852 * safezoneW + safezoneX;
};
class Life_RscProgress_HUDWater : LIFE_RscProgress_HUDCommon {
idc = 2202;
colorBar[] = {0,0.25,0.65,0.65};
x = 0.534723 * safezoneW + safezoneX;
};
/* Texts */
class Life_RscText_HUDCommon : Life_RscText {
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
style = ST_CENTER;
y = 0.970023 * safezoneH + safezoneY;
w = 0.0462964 * safezoneW;
h = 0.0222222 * safezoneH;
};
class Life_RscText_HUDFood : Life_RscText_HUDCommon {
idc = 1200;
text = "Essen";
x = 0.418981 * safezoneW + safezoneX;
};
class Life_RscText_HUDHealth : Life_RscText_HUDCommon {
idc = 1201;
text = "Leben";
x = 0.476852 * safezoneW + safezoneX;
};
class Life_RscText_HUDWater : Life_RscText_HUDCommon {
idc = 1202;
text = "Trinken";
x = 0.534723 * safezoneW + safezoneX;
};
};
Alles anzeigen
und in der macro.h (core/functions/macro.h)
Spoiler anzeigen
Code
#define __CONST__(var1,var2) var1 = compileFinal (if(typeName var2 == "STRING") then {var2} else {str(var2)}) //Quick macro for creating a constant variable
#define __GETC__(var) (call var) //Quick clean macro for getting a value of a constant / compileFinal variable. i.e if(__GETC__(numberone) == 1) then {}
#define __SUB__(var1,var2) var1 = var1 - var2
//Control Macros
#define getControl(disp,ctrl) ((findDisplay ##disp) displayCtrl ##ctrl)
#define getSelData(ctrl) (lbData[##ctrl,(lbCurSel ##ctrl)])
//Player based quick macros
#define grpPlayer group player
#define steamid getPlayerUID player
//UI Macros
#define LIFEdisplay (GVAR_UINS ["playerHUD",displayNull])
#define LIFEctrl(ctrl) ((GVAR_UINS ["playerHUD",displayNull]) displayCtrl ctrl)
//Namespace Macros
#define SVAR_MNS missionNamespace setVariable
#define SVAR_UINS uiNamespace setVariable
#define SVAR_PNS parsingNamespace setVariable
#define GVAR_MNS missionNamespace getVariable
#define GVAR_UINS uiNamespace getVariable
Alles anzeigen
Viel Spaß!