lverona wrote:Added an actor variable but each time I try to use it, the script editor says - unexpected variable delcaration.
lverona wrote:I did put the hp variable at the beginning of the script and it solved an error, however this is weird. What if I need the variable to be not in the beginning of the script? How to declare it without changing its value?
You should not put a local copy of the hp variable in any scripts. Otherwise gE won't use the actor variable you created.
hp--; // lower the actor's hp
if(hp<=0) // actor is dead
{
DestroyActor("Event Actor");
}
int var; // you can declare variables at the beginning of a code block
hp--; // but as soon as you stop declaring variables, you can no longer declare any
hp--;
int var;
First, the problem is you wrotemindcontrol wrote:hi, i tried to do this:
On enemy:
-Draw actor -> script editor -> hp == 5;
-Collision with any side of player -> script editor -> hp --;
if(hp<=0) { DestroyActor ("enemy"); }
So i wanted wich the enemy only lose 1 hp for each time he collide, but he die on the first collision, what am I doing wrong?
hp == 5;
hp = 5;
Users browsing this forum: No registered users and 1 guest