Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

Health Script

Section for submitting new content to Sandbox, such as maps, code, etc.
Kids are also more than welcome to submit their work with parental permission!
User avatar
DaGeek247
Member
Member
Posts: 53
Joined: May 17th, 2010, 6:52 pm
Name: DaGeek247
IRC Username: DaGeek247
Location: sitting or standing when not laying down
Contact:

Health Script

Post by DaGeek247 »

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:

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!"
	]
]
the download for the demo map is in the attachment.
Attachments
health.zip
Updated Demo Health Script
(117.82 KiB) Downloaded 278 times
If a packet hits a pocket on a socket on a port,
and the bus is interrupted as a very last resort,
and the address of the memory makes your floppy disk abort,
then the socket packet pocket has an error to report

DaGeek247 of http://dageek247.tk/
arcones
Support Team
Support Team
Posts: 2734
Joined: January 13th, 2010, 12:42 pm
Name: Timothy
IRC Username: I use Steam
Location: Looking over your shoulder...
Contact:

Re: Health Script

Post by arcones »

Okay:

Code: Select all

on_start = [
   editbind "I" [showgui health];
   health = 100
]
Why in the world did you use an EDITbind??
Image
Want a user bar like this one? PM Leo!
User avatar
DaGeek247
Member
Member
Posts: 53
Joined: May 17th, 2010, 6:52 pm
Name: DaGeek247
IRC Username: DaGeek247
Location: sitting or standing when not laying down
Contact:

Re: Health Script

Post by DaGeek247 »

it was my failed attempt at making it easier to view the health info. i have no idea on how to put a static progress bar in game, or even just text. I came up with THAT bit of code by exploring defaults.cfg :P (Dont edit that unless you know what you are doing.) It does not do anything, but display an error. the script still works perfectly.
If a packet hits a pocket on a socket on a port,
and the bus is interrupted as a very last resort,
and the address of the memory makes your floppy disk abort,
then the socket packet pocket has an error to report

DaGeek247 of http://dageek247.tk/
User avatar
kid matthew
Developer
Developer
Posts: 468
Joined: August 11th, 2009, 5:28 pm
Name: Matthew
IRC Username: Kid_matthew
Location: Land of Sandbox.

Re: Health Script

Post by kid matthew »

I might use that for my game =]
Lost Lands Work In Progress <3 viewtopic.php?f=10&t=2522 <3
User avatar
jSoftApps
Member
Member
Posts: 426
Joined: May 2nd, 2011, 10:02 pm
Name: J.R.
IRC Username: jSoftApps
Location: jSoft Apps Software Innovations HQ
Contact:

Re: Health Script

Post by jSoftApps »

Thanx! This is exactly what I was looking for
jSoft Apps Software Innovations - App, Games and More!
Visit our Website!

Image

jSoft Apps is now on indie db!
Image
User avatar
Bigboss
Member
Member
Posts: 282
Joined: July 23rd, 2010, 1:35 pm
Name: Naked Snake
Contact:

Re: Health Script

Post by Bigboss »

hehe I will probably use this and recode it for a static bar and text and a picture :)
Zombie map (Version 2) Image
Image
Want a user bar like this one? PM Leo
Image
User avatar
Leo_V117
Support Team
Support Team
Posts: 1640
Joined: February 16th, 2010, 8:00 pm
Name: Leo
IRC Username: Leo_V117
Location: That one place...
Contact:

Re: Health Script

Post by Leo_V117 »

DaGeek247 wrote: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:

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 = [
	bind "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!"
	]
]
the download for the demo map is in the attachment.
Never use editbind...
kgklimyriad
Member
Member
Posts: 61
Joined: May 15th, 2011, 8:27 am
Name: Liam Usher
IRC Username: klimyriad

Re: Health Script

Post by kgklimyriad »

Looks okay apart from the editbind i may have a look at this and use it for my game (save me some coding).
Owner of IK-Soft, IK Software Netowork, IK Software, IK Software Hosting, IK Software Network

IK Software is Working on a game called Mazer find it at http://ik-soft.co.uk/mazer.html or on these forums at viewtopic.php?f=10&t=3268 (Making with PAS)
arcones
Support Team
Support Team
Posts: 2734
Joined: January 13th, 2010, 12:42 pm
Name: Timothy
IRC Username: I use Steam
Location: Looking over your shoulder...
Contact:

Re: Health Script

Post by arcones »

Realistically you might want to use an "on-release" bind, or a bind with cntrl. But those are just some of the ideas that randomly float around my head. I need to get working on my Shift-Speed script.
Image
Want a user bar like this one? PM Leo!
User avatar
Leo_V117
Support Team
Support Team
Posts: 1640
Joined: February 16th, 2010, 8:00 pm
Name: Leo
IRC Username: Leo_V117
Location: That one place...
Contact:

Re: Health Script

Post by Leo_V117 »

arcones wrote:Realistically you might want to use an "on-release" bind, or a bind with cntrl. But those are just some of the ideas that randomly float around my head. I need to get working on my Shift-Speed script.
I'm gonna take it you meant "ctrl" there... :lol:

I havent tested this script out yet... But I'm probably going to use it to test out EasyScriptBuilder 0.1.5 before I release it. Maybe even use it for 0.5.0 to test out Error Checking... If I ever implement it.
Locked