Entity Variables

For the corresponding entity functions go here

int entities;
int entity.x[entity];
int entity.y[entity];
int entity.specframe[entity];
int entity.frame[entity];
int entity.hotx[entity];
int entity.hoty[entity];
int entity.hotw[entity];
int entity.hoth[entity];
int entity.movecode[entity];
int entity.face[entity];
int entity.speed[entity];
int entity.visible[entity];
int entity.obstruct[entity];
int entity.obstructable[entity];
string entity.script[entity];
string entity.chr[entity];
int entity.lucent[entity];
int entity.framew[entity], entity.frameh[entity];
string entity.description[entity];

entities - (read only) The number of entities currently on the map. Use this an the upper bound any time you need to loop through and check entites for something.

entity.x, entity.y - (read/write) The coordinates of the entity on the map. This is a pixel value from the top left corner of the map to the top left corner of the entity's hotspot. To get an x,y coord of the entity on the screen subtract xwin and ywin.

entity.specframe - (read/write) Similar to setting a z movecode, this sets a frame to display. Remember to set it back to 0 if you want movement animations.

entity.frame - (?read only?) ?Just stores the entities current frame?

entity.hot(x/y/w/h) - (read only) These four variables specify a rectangle on the entity's frame used for collision detection, x,y coords from the top left corner of the frame, width and height. They are read-only. Why, I don't know. You'll need to set them in the .mak when you create your .chr file.

entity.movecode - (read only) reflects the current wandermode of the entity. 0 is not moving, 1 is wander zone, 2 is wander rect, and 3 is movecode. Attempting to setting this variable manually will crash the system, so if you want to change the wandermode, please use one of the following functions: EntityStop(), EntitySetWanderZone(), EntitySetWanderRect(), or EntityMove().

entity.face - (read/write) Returns a number that corresponds to the direction the entity is facing. Changing this will change the direction the entity is facing. Setting it to an invalid value can crash the system.

      (up) 1
(left) 3 --+-- 4 (right)
           2 (down)           

entity.speed - (read/write) how fast this entity will move, in pixels per second (PPS). If you want an entity to crawl aroud at a tile per second (really slow) set this to 16. We commonly set it to 100 or so, although 128 may be a better 'normal speed' for characters.

entity.visible - (read/write) [NEW!] Whether or not the entity will be drawn to the screen. A little testing seems to show it affects BlitEntityFrame() as well as Render() and 0 is invisible.

entity.obstruct - (read/write) 1 if the entity's hotspot is an obstruction, 0 if not.

entity.obstructable - (read/write) 1 if this entity cares about obstructions when moving, 0 if not.

entity.script - (read/write) The script event name used for handling activations, as set by onActivate in maped.

entity.chr - (read/write) Added to allow read/write access to the CHR for entities. Setting it is the same as ChangeCHR()

entity.lucent - (read/write) The lucency percentage of the entity, 0 is opaque, 100 is invisible.

entity.frame[w/h] - (read-only) The width/height of each frame in the CHR file.

entity.description (read/write) Information about this sprite, usually used in MapEd, to help you figure out which entity is which. You could possibly use the entity's description to locate specific entities on the map by their description instead of an arbitrary index number.


Post a new comment?

Talkback #7 written by resident on 2008-05-21.

entity.description appears to be a string, not an int.

Talkback #6 written by pthaloearth on 2008-01-17.

entity.script does NOT hold movescript data. entity.script: the entities "onActivate" setting from MapEd

Talkback #5 written by jrhee on 2005-04-04.

I asked this in Verge Help, but isn't entity.script meant for attaching a script for activation rather than for attaching a movescript?

Talkback #4 written by Gayo on 2004-08-07.

GetObs doesn't tell you if a tile is obstructed at all, actually. It's just a GetTile for the obstruction layer, telling you what obstruction tile is being used at any given location. If you want to make your own obstruction system, you'll have to work out for yourself what "shape" a given obstruction has.

The only way I know of to check if a given area is obstructed by an entity is to run through every entity, checking hotspots and obstructability.

Talkback #3 written by resident on 2004-08-06.

So, how does that affect GetObs()? Does it only return a 1 if there's a tile based obstruction? or does a single obstruction pixel from an obstructed entity in a tile mean the square is returned as obstructed?

Talkback #2 written by Gayo on 2004-08-04.

Pretty much, but remember that this isn't tile-based; entity-obsctruct actually blocks movement into an area the size of the entity's hotspot, with the upper left coordinate of that area being the entity's x/y coordinates.

Talkback #1 written by resident on 2004-08-03.

Would I be right in assuming that entity.obstruct makes the entity block passage through the tile it's standing on, while entity.obstructable makes the entity pay attention to obstructions?

Post a new comment?

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.