ent_create(STRING* filename, VECTOR* position, EVENT action): ENTITY*

ent_createlocal(STRING* filename, VECTOR* position, EVENT action): ENTITY*

Creates a model, sprite, terrain or map entity, either from an external file, or from a predefined primitve shape. The given action will start immediately after creation, with the my pointer set to the created entity, and you set to the creating entity (if any). The instruction returns a pointer to the created entity that can be used for setting further entity parameters after the entity function was run.

ent_create creates a global entity on the server and on all connected clients. ent_createlocal creates the entity on the local machine only. A local entity is not transmitted to the server, and thus not visible on other clients. The local entity function runs on the local machine only. Local entities can be used for advanced particle effects, player weapons or the like. In a single player system, both instructions are identical.

Parameters:

filename - name of the entity file to be created (char* or STRING*); or a primitive entity shape (see below); or NULL for creating a dummy entity.
position - inital position of the entity.
action - action of the entity, or NULL for no action.

Returns:

Pointer to the created entity.

Modifies:

hit (when preload_mode is at 7 or above).

Speed:

Slow with hard disk access when the entity file was not yet used in this level; medium when the file is loaded from the level cache.

Remarks:

Example:

you = ent_create ("flash.pcx", temp, flash_action); 

See also:

ENTITIES, ent_morph, ent_purge, ent_preload, ent_remove, ent_createterrain, ent_createlayer, level_load, preload_mode

► latest version online