Page 1 of 1

Q: How to create actor based on timer status.

PostPosted: Wed Jun 07, 2006 9:05 pm
by zupernoc
- 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

PostPosted: Wed Jun 07, 2006 9:17 pm
by makslane
You can use your count variable. If you increment each second, try this:

Code: Select all
if(count == 120)
{
    //CreateActor action here
}

PostPosted: Wed Jun 07, 2006 9:41 pm
by zupernoc
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.

PostPosted: Wed Jun 07, 2006 9:50 pm
by Novice
Code: Select all
 if (actor_clock.textNumber = 2)

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

= is
== equals
Common mistake :wink:

PostPosted: Thu Jun 08, 2006 12:57 am
by zupernoc
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