Health Script
Posted: December 7th, 2010, 10:45 am
I made a working health script. I also made a demo map for it. tell me what you think!
oh yea, here is the code on the website:
the download for the demo map is in the attachment.
oh yea, here is the code on the website:
Code: Select all
//tag 1 is spikes or -5 health
//tag 2-4 is heat (2 is -20 health 4 is -10)
//tag 5 is radiation or -10 health
//tag 6 is smoke inhalation or -5 health
//tag 7 is health or +10 health
//tag 8 is instant death or -101 health
//all objects have a trigger type of 6, so they keep hurting you
//set health and whatnot
on_start = [
editbind "I" [showgui health];
health = 100
]
//health gui, press i to see it.
newgui health [
guitext ( format "You have %1 health." $health )
if ( < $health 21 ) [
guitext "You are in the RED ZONE. You need health."
]
guibar
guibutton "OK." [cleargui]
]
level_trigger_1 = [ //Pokey spikes
health = (- $health 10 );
echo "Ouch! That hurt!";
echo ( format "You now have %1 Health." $health );
if ( < $health 1 ) [
nap;
health = 100;
echo "You died!"
]
]
level_trigger_2 = [ //fire level 1
health = (- $health 20 );
echo "It burns!";
echo ( format "You now have %1 Health." $health )
if ( < $health 1 ) [
nap;
health = 100;
echo "You died!"
]
]
level_trigger_3 = [ //fire level 2
health = (- $health 15 );
echo "The pain!";
echo ( format "You now have %1 Health." $health )
if ( < $health 1 ) [
nap;
health = 100;
echo "You died!"
]
]
level_trigger_4 = [ //fire level 3
health = (- $health 10 );
echo "Thats hot!";
echo ( format "You now have %1 Health." $health )
if ( < $health 1 ) [
nap;
health = 100;
echo "You died!"
]
]
level_trigger_5 = [ //radiation
health = (- $health 10 );
echo "Radiation! AUGH!";
echo ( format "You now have %1 Health." $health )
if ( < $health 1 ) [
nap;
health = 100;
echo "You died!"
]
]
level_trigger_6 = [ //smoke in lungs
health = (- $health 5 );
echo "*COUGH!* *COUGH!*";
echo ( format "You now have %1 Health." $health )
if ( < $health 1 ) [
nap;
health = 100;
echo "You died!"
]
]
level_trigger_7 = [ //health
if ( < $health 100 ) [
health = (+ $health 10 );
echo "Ahhhhh...";
echo ( format "You now have %1 Health." $health )
] [
health = 100
]
]
level_trigger_8 = [ //instant death
health = (- $health 101 );
if ( < $health 1 ) [
nap;
health = 100;
echo "You died!"
]
]