T4 Modules Howto Guide/Entities

From Tales of Maj'Eyal
Revision as of 05:47, 29 May 2013 by 66.225.111.10 (Talk)

Jump to: navigation, search

and Egos: Everything comes from here

Entity Definitions

These variables are valid for all entities, that is, grid, actors, objects, stores or traps.


Variable Default Effect
display '.' Character to display in ASCII mode.
image nil Image to use as a tile.
color 0,0,0 Display color. No effect on images. A table of r,g,b. Sets color_r, color_g and color_b.
back_color -1,-1,-1 Back display color. No effect on images. A table of r,g,b. Sets color_br, color_bg and color bb.
tint 1,1,1 Color to tint the display texture with. Has an effect on both image and ASCII displays. Sets tint_r, tint_g and tint_b.
unique unset If true, only one of these will ever be generated.
changed unset Gets set to true whenever an entity undergoes changes.

Egos: Adding some variety

Egos are defined as 'special' versions of usually items that grant additional properties or effects to the user beyond the normal.

Egos are a very generic system in T-Engine. NPCs, objects, traps, grids or even stores can potentially have egos.

In the entity definitions, 3 ego-related variables are recognized:


Property Effect
egos String pointing to a lua file containing ego definitions.
egos_chance Number between 0 and 100 defining the chance of this entity being an ego entity.
force_ego Forces the entity to be generated with the ego named by this variable.

Egos are defined the same way as normal entities, in a newEntity{...} block. Unlike other entities though they do not have a base (unless the base is another ego). In addition, the following variables are recognized:


Property Effect
name This is the suffix the ego will add to the base entity. If prefix is set to true, this is a prefix instead.
prefix If true, the ego is a prefix instead of a suffix.

This allows one ego to apply to a wide range of entities, such as a +strength ego apply to weapons and armor. It also makes silliness possible such as a 'sharpened troll'. Take care.


Ego Grids


Note that while its possible to have ego grids, the way the map works at the moment all grids that are the same are the same object. This means that the ego chance doesn't get evaluated per grid tile, it gets evaluated once per tile type for the whole level.

It may be possible and has been suggested to force every grid to be a unique object in future versions, but this is still not advised due to increased memory use and larger resulting save files.

Go back to T4modules-module-howto-guides