Scripts / [SOLVED] How to insert an image at health side?

Author
Message
Dyan
6
Years of Service
User Offline
Joined: 26th Mar 2018
Location:
Posted: 17th Feb 2022 01:58
Hello

Im trying to find a way to put one image at health side on HUD. Like Quake

I find some threads but I still lost. There are one thread, site, or video talking about this? Thank you.

https://forum.game-guru.com/thread/214347
https://forum.game-guru.com/thread/222164
https://forum.game-guru.com/thread/214866

Best Regards

The author of this post has marked a post as an answer.

Go to answer
PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 18th Feb 2022 04:28
The store has some cheap hud scripts that will show you in the script where to change the image .
https://gamecreator.store/products?search=hud

There's some free ones in the script forum too.
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 18th Feb 2022 05:16
This post has been marked by the post author as the answer.
Okay, I had to read that again to understand the idea... as in ~ol DOS Wolfenstein_3D style? According to wikipedia... I was in the Army when that was released- so didn't play it then. But I enjoyed Commander Keen quite a bit around that era. https://store.steampowered.com/app/2270/Wolfenstein_3D/

Really I'd go all custom and HideHuds() then put the image that pertains to your player health in the screen location you have in mind + health via text, etc Those sprite commands are in /scriptbank/global.lua and you should probably place the images also in scriptbank/images folder. Make them .png

--[[
LoadImage: myImage = LoadImage ( "myFolder\\myImage.png" ) -- Anywhere inside GG Files folder (however it is best to put into scriptbank images folder for making standalones)
SetSpriteSize ( mySprite , sizeX , sizeZ ) -- passing -1 as one of the params ensure the sprite retains its aspect ratio
CreateSprite: mySprite = CreateSprite ( myImage )
PasteSpritePosition: PasteSpritePosition ( mySprite , x , y ) -- as above but pasted at a specified XY coordinate
--]]

--How about test this and see if it comes close?

mySprite = {}
myImage = {}
spx = {}
spy = {}
topphealth = 100 -- or whatever
health_spno = 1

function health_sprite_init(e)

hespx = 77 -- wherever screen location 'x'
hespy = 90 -- wherever screen location 'y'
myImage[1] = LoadImage ( "myFolder\\myImage1.png" ) -- match to where you put folder
mySprite[1] = CreateSprite ( myImage1 )
--............ and so forth for all the images........... increase numbers+1 at the [1] part

end ---------- init

function health_sprite_main(e)

for msp = 1, 6 do -- go out sprite
spx[msp] = 200
spz[msp] = 200
end
if g_PlayerHealth >= topphealth then
SetPlayerHealth(topphealth )
health_spno = 1
elseif
g_PlayerHealth < topphealth and g_PlayerHealth > 75 then -- who's there?
health_spno = 2
spx[1] = hespx
spz[1] = hespx
elseif g_PlayerHealth < 76 and g_PlayerHealth > 50 then -- ouch
health_spno = 3
spx[2] = hespx
spz[2] = hespx
elseif g_PlayerHealth < 51 and g_PlayerHealth > 25 then -- watch out
health_spno = 4
spx[3] = hespx
spz[3] = hespx
elseif g_PlayerHealth < 26 and g_PlayerHealth > 0 then -- careful!
health_spno = 5
spx[4] = hespx
spz[4] = hespx
elseif g_PlayerHealth < 1 then -- uh oh!
health_spno = 6
spx[5] = hespx
spz[5] = hespx
end

for msp = 1, 6 do
PasteSpritePosition ( mySprite[health_spno], spx[msp] , spy[msp] )
end


end -- main
PM
Dyan
6
Years of Service
User Offline
Joined: 26th Mar 2018
Location:
Posted: 1st Jul 2022 00:53
Hello, hello,

Thank you to muck for everyone!
Thank you bluemeenie195 your post has been added here.
GubbyBlips Really Thank you! More than I wainting for!!

Really, thank you to much!
a snip from my simple display.lua

display.lua

function display_init(e)
fotoPlayer = LoadImage("scriptbank\\images\\Display\\1.jpg")
spriteFotoPlayer = CreateSprite(fotoPlayer)
SetSpriteSize(spriteFotoPlayer, 13, 20)
SetSpritePosition(spriteFotoPlayer, 45, 80)
end

function display_main(e)
end


[img]null[/img]
PM

Login to post a reply

Server time is: 2024-04-27 04:57:05
Your offset time is: 2024-04-27 04:57:05