Page 1 of 1

destroy player one if health = 0

PostPosted: Tue Jun 27, 2006 8:39 pm
by Zehper48
how can i do this
if (text)health = 0 destroy player1
i need some code, i have searched the forums but couldnt find anything that helped. it would help if you could give me step by step

PostPosted: Tue Jun 27, 2006 8:56 pm
by makslane
Try this:

Code: Select all
if(health <= 0)
{
   DestroyActor("player1");
}

PostPosted: Tue Jun 27, 2006 9:24 pm
by Zehper48
its not working. it says unknown type in binhconst, possible non relational operation and, undefined for relational operation :(

PostPosted: Tue Jun 27, 2006 10:50 pm
by makslane
Do you have a variable health?
If not, create in the Variables panel, as actor, integer.

PostPosted: Wed Jun 28, 2006 1:07 am
by Zehper48
I have a text actor i named health
i know how to make the health go down but i dont know how to destroy it only when it reaches 0 or lower.

PostPosted: Wed Jun 28, 2006 1:19 am
by makslane
Use:

Code: Select all
if(health.textNumber <= 0)
{
   DestroyActor("player1");
}

PostPosted: Wed Jun 28, 2006 1:59 pm
by Zehper48
Yes it worked :D . Thank you soo much