Posted By: kholis
entity id - 05/05/10 06:26
i add 2 cube in WED and also add action two both.
in SED i can retrieve cube position with my.x, my.y, and my.z
but how can i retrieve cube id to distinguish from the others?
guessing like my.id or my.idname but its not work.
thanks
Posted By: DJBMASTER
Re: entity id - 05/05/10 06:58
The entity type doesn't have an 'id' member by default. What it does have is a set of skills that you can set your own custom id...
me.skill1 = 50;
... So when checking ids you can easily check the entity skill.
The skill method would require you to manually set the ids. You can use the handle of the entity also. A handle is a number unique to the object which is automatically set by the engine.
Use the 'handle' function (check in manual) or directly access it with 'my.link.index'.
Posted By: Widi
Re: entity id - 05/05/10 09:29
cube 1 skill1 = 1; // set this in WED
cube 2 skill1 = 2; // the same...
ENTITY* cube_1; // Entity Pointer
ENTITY* cube_2;
action cube_action()
{
if (my.skill1 == 1) cube_1 = me;
if (my.skill1 == 2) cube_2 = me;
...
}
Now you can access to that two entities with this two Pointers:
cube_1.x = 20;
cube_2.x = -100;
set (cube_1,PASSABLE);
and so on...
Posted By: Espér
Re: entity id - 05/05/10 14:19
or you use an array of entities...
ENTITY* ent[n]; //n = size
now you can use an id as array-position..
Posted By: EvilSOB
Re: entity id - 05/05/10 15:34
If you want to be lazy, and are NEVER taking this project to multiplayer,
you could hi-jack the multiplayer property "my.client_id"...
Or if you are NOT using it with view-entities, you can use "my.layer"...