Enemy problem

Non-platform specific questions.

Enemy problem

Postby arcreamer » Fri Jul 27, 2007 3:25 am

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?
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score

Postby Rux » Fri Jul 27, 2007 3:31 am

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
I'm not good at coming up with signatures...
User avatar
Rux
 
Posts: 645
Joined: Sun Apr 29, 2007 9:26 pm
Location: Sitting on your moniter invisable.
Score: 35 Give a positive score

Postby d-soldier » Fri Jul 27, 2007 4:17 am

.. 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.
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby arcreamer » Fri Jul 27, 2007 4:19 am

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?
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score

Postby arcreamer » Fri Jul 27, 2007 4:19 am

ill try that dsd
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score

Postby d-soldier » Fri Jul 27, 2007 4:19 am

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.
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby arcreamer » Fri Jul 27, 2007 4:23 am

thanks D-soldier it worked
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest