Hi all, I just wanted to share this new health HUD for anybody who is making a game for this
HALLOWEEN.
It is based on
CR4CK3T script which is here:-
[GER] [ENG] Modern Hud
I just added new skull icons and text.
The lua script is below and the
HUD images are attached in a
zip. Just extract the zip images into a folder called
skull_hud in the scriptbank image folder and copy the lua script
skul_hud.lua to your scriptbank root directory. Just add to your game in the same way you would other
scripts to be
always active. Take a look at the images below for in-game example.
-- LUA Script - precede every function and global member with lowercase name of script
local time1 = 1;
local time2 = g_Time;
local timepassed = time2 - time1;
local imagenumber = 0;
local healtnumber = 0;
local max_images = 9;
local max_healt = 100;
local delay = 2;
local toggle = 0;
local pressed = 0;
local hud_on = 0;
local me_hud_on = 1;
local ready = 0;
local test = 1;
local run_once = 0;
-- x, y Location for skull image
local image_posx = 97
local image_posy = 94
function skull_hud_init(e)
LoadImages("skull_hud") -- skull hud directory
HideHuds();
end
function skull_hud_main(e)
if g_PlayerHealth and ready == 0 then
ShowMeHuds(e);
ready = 1;
end
--KEY AKTION
if GetScancode() == 63 and pressed == 0 then
if hud_on == 1 then
HideHuds();
hud_on = 0;
me_hud_on = 1;
pressed = 1;
toggle = 1;
ShowMeHuds();
else
ShowHuds();
hud_on = 1;
me_hud_on = 0;
pressed = 1;
toggle = 1;
HideMeHuds();
end
elseif GetScancode() == 0 then
pressed = 0
end
-- SHOW INFO TEXT
if toggle == 1 then
if time1 == 0 then
time1 = g_Time
end
time2 = g_Time
timepassed = (time2 - time1) / 1000
if hud_on == 0 then
if timepassed <= delay then
elseif timepassed >= delay then
time1 = 0
toggle = 0
end
elseif hud_on == 1 then
if timepassed <= delay then
elseif timepassed >= delay then
time1 = 0
toggle = 0
end
end
end
--Update the MeHuds
if me_hud_on == 1 then
ShowMeHuds(e);
HideHuds();
else
HideMeHuds(e);
ShowHuds();
end
end
function gif(e)
if timepassed >= delay then
ShowImage(imagenumber)
time1 = 0
if imagenumber < max_images - 1 then
imagenumber = imagenumber + 1
else
imagenumber = 0
end
end
end
function ShowMeHuds(e)
if g_PlayerHealth <= 0 then
SetImagePosition(image_posx,image_posy)
ShowImage(008)
elseif g_PlayerHealth <= 12.5 then
SetImagePosition(image_posx,image_posy)
ShowImage(007)
elseif g_PlayerHealth <= 25 then
SetImagePosition(image_posx,image_posy)
ShowImage(006)
elseif g_PlayerHealth <= 37.5 then
SetImagePosition(image_posx,image_posy)
ShowImage(005)
elseif g_PlayerHealth <= 50 then
SetImagePosition(image_posx,image_posy)
ShowImage(004)
elseif g_PlayerHealth <= 62.5 then
SetImagePosition(image_posx,image_posy)
ShowImage(003)
elseif g_PlayerHealth <= 75 then
SetImagePosition(image_posx,image_posy)
ShowImage(002)
elseif g_PlayerHealth <= 87.5 then
SetImagePosition(image_posx,image_posy)
ShowImage(001)
elseif g_PlayerHealth >= 100 then
SetImagePosition(image_posx,image_posy)
ShowImage(000)
end
-- delete this whole if code block if you wish to remove the health numbers in the skull.
-- From here
if g_PlayerHealth >= 75 then
TextCenterOnXColor(97,91.5,1,g_PlayerHealth,0,128,0)
elseif g_PlayerHealth >= 50 then
TextCenterOnXColor(97,91.5,1,g_PlayerHealth,255,204,0)
elseif g_PlayerHealth >= 25 then
TextCenterOnXColor(97,91.5,1,g_PlayerHealth,255,102,0)
elseif g_PlayerHealth <= 25 then
TextCenterOnXColor(97,91.5,1,g_PlayerHealth,255,0,0)
end
--- to here.
end
function HideMeHuds(e)
for i=1, max_images-1 do
HideImage(imagenumber)
HideImage(i)
end
end
That's about it.
Dark Base 900 Pro OJ: Rampage V Ed.10, i7 6950x non-OC, DDR4-3333 64 GB RAM, Win 10/64, Asus Strix GeForce 1080 x 2 MDA mode, Air cooled
Laptop - M17xR3