Hello all.
I have recently been trying to implement a health bar into my game, without having to edit setuplevel, as then I would just have no HUDs whatsoever, so I have made this script, so that I would not need to edit the file.
So here is my script, you have full permissions, so long as I am credited, (and all the other people that have been creditied in the script (its only fair, thanks for pointing that out Mr Illusionest) as this is my first released script, even if I was helped a lot, and used another script as a template.
;Created by Michael Thompson of Flash Star Games, with the help of Mr Illusionest, Seth Black, and Gencheff.
;Idea for script structure by Gencheff.
;Please note that my script works on the player having 100 health, not 500.
;Header
desc = Health Display HUD
;Triggers
:state=0:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud0.dds,hudname=hhud0,hudhide=1,hudmake=display,state=1
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud1.dds,hudname=hhud01,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud2.dds,hudname=hhud02,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud3.dds,hudname=hhud03,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud4.dds,hudname=hhud04,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud5.dds,hudname=hhud05,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud6.dds,hudname=hhud06,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud7.dds,hudname=hhud07,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud8.dds,hudname=hhud08,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud9.dds,hudname=hhud09,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud10.dds,hudname=hhud10,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud11.dds,hudname=hhud11,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud12.dds,hudname=hhud12,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud13.dds,hudname=hhud13,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud14.dds,hudname=hhud14,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud15.dds,hudname=hhud15,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud16.dds,hudname=hhud16,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud17.dds,hudname=hhud17,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud18.dds,hudname=hhud18,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud19.dds,hudname=hhud19,hudhide=1,hudmake=display
:state=1:hudreset,hudx=10,hudy=90,hudimagefine=gamecore\huds\healthhuds\hhud20.dds,hudname=hhud20,hudhide=1,hudmake=display,state=2
:state=2,plrhealthless=101,plrhealthgreater=94:hudunshow=hHud0,hudshow=hHud20,state=3
:state=2,plrhealthless=95:state=3
:state=3,plrhealthless=95,plrhealthgreater=89:hudunshow=hHud20,hudshow=hHud19,state=4
:state=3,plrhealthgreater=94:state=2
:state=3,plrhealthless=90:state=4
:state=4,plrhealthless=90,plrhealthgreater=84:hudunshow=hHud19,hudshow=hHud18,state=5
:state=4,plrhealthgreater=89:state=3
:state=4,plrhealthless=85:state=5
:state=5,plrhealthless=85,plrhealthgreater=79:hudunshow=hHud18,hudshow=hHud17,state=6
:state=5,plrhealthgreater=84:state=4
:state=5,plrhealthless=80:state=6
:state=6,plrhealthless=80,plrhealthgreater=74:hudunshow=hHud17,hudshow=hHud16,state=7
:state=6,plrhealthgreater=79:state=5
:state=6,plrhealthless=75:state=7
:state=7,plrhealthless=75,plrhealthgreater=69:hudunshow=hHud16,hudshow=hHud15,state=8
:state=7,plrhealthgreater=74:state=6
:state=7,plrhealthless=70:state=8
:state=8,plrhealthless=70,plrhealthgreater=64:hudunshow=hHud15,hudshow=hHud14,state=9
:state=8,plrhealthgreater=69:state=7
:state=8,plrhealthless=65:state=9
:state=9,plrhealthless=65,plrhealthgreater=59:hudunshow=hHud14,hudshow=hHud13,state=10
:state=9,plrhealthgreater=64:state=8
:state=9,plrhealthless=60:state=10
:state=10,plrhealthless=60,plrhealthgreater=54:hudunshow=hHud13,hudshow=hHud12,state=11
:state=10,plrhealthgreater=59:state=9
:state=10,plrhealthless=55:state=11
:state=11,plrhealthless=55,plrhealthgreater=49:hudunshow=hHud12,hudshow=hHud11,state=12
:state=11,plrhealthgreater=54:state=10
:state=11,plrhealthless=50:state=12
:state=12,plrhealthless=50,plrhealthgreater=44:hudunshow=hHud11,hudshow=hHud10,state=13
:state=12,plrhealthgreater=49:state=11
:state=12,plrhealthless=45:state=13
:state=13,plrhealthless=45,plrhealthgreater=39:hudunshow=hHud10,hudshow=hHud09,state=14
:state=13,plrhealthgreater=44:state=12
:state=13,plrhealthless=40:state=14
:state=14,plrhealthless=40,plrhealthgreater=34:hudunshow=hHud09,hudshow=hHud08,state=15
:state=14,plrhealthgreater=39:state=13
:state=14,plrhealthless=35:state=15
:state=15,plrhealthless=35,plrhealthgreater=29:hudunshow=hHud08,hudshow=hHud07,state=16
:state=15,plrhealthgreater=34:state=14
:state=15,plrhealthless=30:state=16
:state=16,plrhealthless=30,plrhealthgreater=24:hudunshow=hHud07,hudshow=hHud06,state=17
:state=16,plrhealthgreater=29:state=15
:state=16,plrhealthless=25:state=17
:state=17,plrhealthless=25,plrhealthgreater=19:hudunshow=hHud06,hudshow=hHud05,state=18
:state=17,plrhealthgreater=24:state=16
:state=17,plrhealthless=20:state=18
:state=18,plrhealthless=20,plrhealthgreater=14:hudunshow=hHud05,hudshow=hHud04,state=19
:state=18,plrhealthgreater=19:state=17
:state=18,plrhealthless=15:state=19
:state=19,plrhealthless=15,plrhealthgreater=9:hudunshow=hHud04,hudshow=hHud03,state=20
:state=19,plrhealthgreater=14:state=18
:state=19,plrhealthless=10:state=20
:state=20,plrhealthless=10,plrhealthgreater=4:hudunshow=hHud03,hudshow=hHud02,state=21
:state=20,plrhealthgreater=9:state=19
:state=20,plrhealthless=5:state=21
:state=21,plrhealthless=5,plrhealthgreater=0:hudunshow=hHud02,hudshow=hHud01,state=22
:state=21,plrhealthgreater=4:state=20
:state=21,plrhealthless=1:hudunshow=hHud01,state=22
:state=22,plrhealthgreater=0:hudunshow=hHud01,hudshow=hHud0,state=2
This works on the player having 100 health, so if you want it to be 500, you will have to change it yourself.
As the code says, it is not completely my script, it was originally made my the user Reyvyn, and I just refined it.
To use it, set it as the main script for dynamic light. I will leave it up to you to make the huds, you will need to make 20, and put the in the gamebank\huds folder, under a subdirectory called 'healthhuds'.
To make the dds pictures, you can be like me and use gimp and get the dds plugin from the gimp website.
Please note that they must be dds images, unless you changed that part in the script
Name them hHudx (x being 1 through to 20), and they must all be in the healthhuds subdirectory of the gamecore folder.
I hope this was discriptive eneough for you all. Let me know if you have any problems.
Enjoy!
EDIT
It is now finnished. When you reach 0 health, it doesnt display a HUD, but when you respawn, it shows the correct huds. I will fix this in my next release.
Let me know if this no longer works and I will have a look at it.
Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations