Class: MobSpawnEntity

Class contents

Methods list

These are special functions (or methods) that you may call on the object. these functions typically instruct the object to perform a certain operation.

Public properties list

Properties are attributes of the object, this directly affect the object in question. Some of them can be read or written, or both.
Name Type Description
name string The name of the object
x float The X value of the object's 3D world position
y float The Y value of the object's 3D world position
z float The Z value of the object's 3D world position

Events list

Events are functions you add to your objects, that will be called by Cubiverse when certain things (events) occur.

Class Information

Constructor

new MobSpawnEntity()

Creates an instance of a MobSpawnEntity, which is passed to the registerMobSpawnEntity API call to register it with Cubiverse.

This should normally be created inside a "Mob Spawn" Entity cube, which is added to the world using the World Editor.

If you decide to create a MobSpawnEntity outside the normal "Mob Spawn" Entity cube then Cubiverse cannot guarantee that the spawn point is available when the world is instigated. During world instigation only "Mob Spawn" Entity cubes are guaranteed to be created BEFORE any mobs join the server. Therefore if you use any other cube (or way) to create this entity there is a chance the entity will not be created until a later time (resulting in the entity not spawning mobs until it's creation).

This:

Properties:

Name Type Description
name string The name of the object
x float The X value of the object's 3D world position
y float The Y value of the object's 3D world position
z float The Z value of the object's 3D world position

Methods

spawnMob()

Spawns a mob into the world

This method is used to spawn a mob ONLY WHEN a new mob joins the world. If you perform this API call at any other time then nothing will happen (or you world may be killed in later revisions).

Normally you will call this funtion from the onMobSpawn event

This:

Events

onMobSpawn

Called when a mob needs spawned in the world.

This event can be triggered through a number of different methods. Normally this is a mob joining the world and requiring an initial spawn location, but it can also be due to the death of a mob or through a reset of the world (such as when a team wins the round).

Normally you will want to call the spawnMob API call to have the mob spawned.

Parameters:
Name Type Description
mobSpawned boolean Indicates whether the mob has already been spawned, calling spawnMob when this flag is true will result in no operation.
Example
<b>Normal usage for single spawn point</b><br>
function MobSpawnObject.onMobSpawn( mobSpawned )
{
  if (!mobSpawned)
     this.spawnMob() ;
}