Page 1 of 1

Enemy problem

PostPosted: Fri Jul 27, 2007 3:25 am
by arcreamer
hey guys i have a actor called "car" and i want it so that the 'eggbomb' actor kills the car after 3 eggbombs hit it... how do i do that?

PostPosted: Fri Jul 27, 2007 3:31 am
by Rux
Create a var called eggbombhit.

On the car create actor,
Code: Select all
eggbombhit = 3;

Then on the car, draw actor,
Code: Select all
if(eggbombhit == 0)
{
    DestroyActor("EventActor");
}


On the eggbomb, collision with the car,
Code: Select all
eggbombhit = eggbombhit - 1;


This should work. Try it. :D

PostPosted: Fri Jul 27, 2007 4:17 am
by d-soldier
.. I would recommend setting up a variable (actor, not global) called "health".
On the car's create-actor script, put:

health=3;

still on the car, add a collision event (to the egg) and on that collision event script:

health-=1;

and in the car's DRAW actor script:

if (health<=0)
{
DestroyActor("Event Actor");
}

thats it.

PostPosted: Fri Jul 27, 2007 4:19 am
by arcreamer
for some reason when i do all that and i shoot the car, the eggbombs just go right through it like no script was added :P what happened?

PostPosted: Fri Jul 27, 2007 4:19 am
by arcreamer
ill try that dsd

PostPosted: Fri Jul 27, 2007 4:19 am
by d-soldier
Note for that last post: It's important that the egg actor has a collision event setup to destroy itself when it collides with the car, or else the same egg will reduce the car's health as it continues to collide with the car.

PostPosted: Fri Jul 27, 2007 4:23 am
by arcreamer
thanks D-soldier it worked