Creating different actors based on collision

Game Editor comments and discussion.

Creating different actors based on collision

Postby Hyperyon » Tue Jul 18, 2006 6:33 am

How do I create different actors based on a collision with the same actor?
Lets keep our dreams alive!
Hyperyon
 
Posts: 148
Joined: Sat Jun 24, 2006 1:29 pm
Score: 0 Give a positive score

Postby Hyperyon » Tue Jul 18, 2006 1:09 pm

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 :?
Last edited by Hyperyon on Tue Jul 18, 2006 1:09 pm, edited 1 time in total.
Lets keep our dreams alive!
Hyperyon
 
Posts: 148
Joined: Sat Jun 24, 2006 1:29 pm
Score: 0 Give a positive score

Postby makslane » Tue Jul 18, 2006 1:09 pm

What's the condition to create the actors?
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Hyperyon » Tue Jul 18, 2006 1:12 pm

Whenever my actor attacks an enemy actor I want wounds to appear on it. A different wound at every collision.
Lets keep our dreams alive!
Hyperyon
 
Posts: 148
Joined: Sat Jun 24, 2006 1:29 pm
Score: 0 Give a positive score

Postby makslane » Tue Jul 18, 2006 1:17 pm

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
}
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Hyperyon » Tue Jul 18, 2006 1:27 pm

Ok, heres an annoying question :?
After I activate the collision, I type the exact code in script editor?
sorry :?
Lets keep our dreams alive!
Hyperyon
 
Posts: 148
Joined: Sat Jun 24, 2006 1:29 pm
Score: 0 Give a positive score

Postby makslane » Tue Jul 18, 2006 2:38 pm

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.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Hyperyon » Wed Jul 19, 2006 5:16 am

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? :?
Lets keep our dreams alive!
Hyperyon
 
Posts: 148
Joined: Sat Jun 24, 2006 1:29 pm
Score: 0 Give a positive score

Postby makslane » Wed Jul 19, 2006 12:08 pm

Please, post the code here.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Hyperyon » Wed Jul 19, 2006 2:13 pm

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 :? )
Lets keep our dreams alive!
Hyperyon
 
Posts: 148
Joined: Sat Jun 24, 2006 1:29 pm
Score: 0 Give a positive score

Postby makslane » Wed Jul 19, 2006 2:18 pm

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.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Hyperyon » Wed Jul 19, 2006 3:44 pm

Thanks Makslane. I appreciate help!
Lets keep our dreams alive!
Hyperyon
 
Posts: 148
Joined: Sat Jun 24, 2006 1:29 pm
Score: 0 Give a positive score

Postby Hyperyon » Wed Jul 26, 2006 10:39 am

Is it possible to loop the code? Like to redo counts after the last.
Lets keep our dreams alive!
Hyperyon
 
Posts: 148
Joined: Sat Jun 24, 2006 1:29 pm
Score: 0 Give a positive score

Postby nappie » Wed Jul 26, 2006 2:07 pm

maybe add this:

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


(this code is mostlikely wrong :P
but you get my point)
get 2 slices of bread, put a bunch of cheese and 1 slice of ham between it. put butter on the outsides of the slices of bread, and put them into a grill for 2 min. ---> TOSTI!
nappie
 
Posts: 15
Joined: Sun Jul 23, 2006 9:10 pm
Score: 0 Give a positive score

Postby makslane » Wed Jul 26, 2006 2:08 pm

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.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Next

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron