Q: How to create actor based on timer status.

Game Editor comments and discussion.

Q: How to create actor based on timer status.

Postby zupernoc » Wed Jun 07, 2006 9:05 pm

- I have an actor called "level_01" which creates various actors and events upon its creation.

- I have an actor called "level_01_clock", that is created when level_01 is created.

- I have a timer called "timer_level_01_clock" that is created when "level_clock" is created.

- "Level_01_clock" increments itself by 1 each second and outputs the text to the screen, so I know its working.

My question is, how do I create actors based on the timer_level_01_clock? Example, at 120 seconds, create this alienblah, and at 5 minutes into the game create this alienblah2.

Thank you.
-Eric
zupernoc
 
Posts: 17
Joined: Thu Jun 01, 2006 9:12 pm
Score: 0 Give a positive score

Postby makslane » Wed Jun 07, 2006 9:17 pm

You can use your count variable. If you increment each second, try this:

Code: Select all
if(count == 120)
{
    //CreateActor action here
}
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby zupernoc » Wed Jun 07, 2006 9:41 pm

Thank you.

Previously, within the actor_clock script, I had
Code: Select all
actor_clock.textNumber  = actor_clock.textNumber +1;


Per this suggestion, I have added the line
Code: Select all
 if (actor_clock.textNumber = 2)  //2 seconds
 {
   //create actorblah
 }


The good news is it does indeed create this actorblah upon reaching a counter of 2. Yet, it continues to create the actor over and over, and the actor_clock does not increment.

Any ideas? Granted the entire code is not listed here, however I am curious if the solution to the above problem is obvious, and something I am overlooking.
zupernoc
 
Posts: 17
Joined: Thu Jun 01, 2006 9:12 pm
Score: 0 Give a positive score

Postby Novice » Wed Jun 07, 2006 9:50 pm

Code: Select all
 if (actor_clock.textNumber = 2)

Should be
Code: Select all
 if (actor_clock.textNumber == 2)

= is
== equals
Common mistake :wink:
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Postby zupernoc » Thu Jun 08, 2006 12:57 am

Thank you. That did part of the trick.

I was previously incrementing actor_clock.textNumber. This time I added an integer "counter" along with it (incrementing both), and did

Code: Select all
if (counter == 7)


Thank you again. Perhaps i was comparing a string to number?

:D
zupernoc
 
Posts: 17
Joined: Thu Jun 01, 2006 9:12 pm
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest