ActorCount

From Game Editor

Jump to: navigation, search
int ActorCount(char *actorName);


This function returns the number of actors currently in the game. Actors in other activation regions, and disabled actors are counted as well.


Actor Count Input

actorName

  • "Event Actor": Actor that is receiving the current event.
  • "Parent Actor": Event Actor's parent, if actor has a parent.
  • "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
  • "Collide Actor": Actor that collided with the event Actor.
  • Any Actor name or clonename in the game.


Example:

Have a spawn point spawn new enemies if there are currently less than 5 enemies.

spawn -> Draw Actor -> Script Editor

if(ActorCount("enemy")<5)
{
    CreateActor("enemy", "enemyAnim", "(none)", "(none)", 0, 0, false);
}