Page 1 of 2

Creating different actors based on collision

PostPosted: Tue Jul 18, 2006 6:33 am
by Hyperyon
How do I create different actors based on a collision with the same actor?

PostPosted: Tue Jul 18, 2006 1:09 pm
by Hyperyon
For example, when I collide the first time, create actor1 then when I collide again, create a different actor; actor2, moreover, create another actor, actor 3 when I collide the 3rd time..and so on :?

PostPosted: Tue Jul 18, 2006 1:09 pm
by makslane
What's the condition to create the actors?

PostPosted: Tue Jul 18, 2006 1:12 pm
by Hyperyon
Whenever my actor attacks an enemy actor I want wounds to appear on it. A different wound at every collision.

PostPosted: Tue Jul 18, 2006 1:17 pm
by makslane
You need create a count variable, increment the count in each collision and test the value to create the right actor:

Code: Select all
count++;

if(count == 1)
{
    //Create actor 1
}
else if(count == 2)
{
    //Create actor 2
}

PostPosted: Tue Jul 18, 2006 1:27 pm
by Hyperyon
Ok, heres an annoying question :?
After I activate the collision, I type the exact code in script editor?
sorry :?

PostPosted: Tue Jul 18, 2006 2:38 pm
by makslane
Create the count variable, in the Variables button.
The type is Actor, Integer.

Copy the code, and use the 'variable/funcitons' list to select the CreateActor action. The code for CreateActor will be generated in the panel.

PostPosted: Wed Jul 19, 2006 5:16 am
by Hyperyon
It gave me:
Error line1: cannot apply inc/dec
line2: undeclared ident
line2:possible non relational operation...and a few more:(

What I did was, create 3 actors. collide actor, actor1, actor2.
Then I added on my main player collision with 'collide actor' then in script editor (still in my main player) i created the count variable. Then i put the code and clicked on variable/functions. Now was the count variable suppose to appear on the list? :?

PostPosted: Wed Jul 19, 2006 12:08 pm
by makslane
Please, post the code here.

PostPosted: Wed Jul 19, 2006 2:13 pm
by Hyperyon
count++;

if(count == 1)
{
//Create actor 1
}
else if(count == 2)
{
//Create actor 2
}

Thats the code I put. The one you gave me. (sorry if im waisting youre valuable time!... :oops: I know yur busy :? )

PostPosted: Wed Jul 19, 2006 2:18 pm
by makslane
Go to the 'Variables' button, Click 'Add' to add a new variable, use the 'count' as name of new variable, change Global to 'Actor variable', click Add to finish.

Now, the code must compile.

PostPosted: Wed Jul 19, 2006 3:44 pm
by Hyperyon
Thanks Makslane. I appreciate help!

PostPosted: Wed Jul 26, 2006 10:39 am
by Hyperyon
Is it possible to loop the code? Like to redo counts after the last.

PostPosted: Wed Jul 26, 2006 2:07 pm
by nappie
maybe add this:

else if(count == 2)
{
//count = 0
}


(this code is mostlikely wrong :P
but you get my point)

PostPosted: Wed Jul 26, 2006 2:08 pm
by makslane
Do you mean using for or while commands?
You can, but keep in your mind the screen don't will be updated until finish the script.