About Store Forum Documentation Contact



Post Reply 
How to use obj IDs?
Author Message
Kevin Offline
Member

Post: #1
How to use obj IDs?
Hi,
First of all I would like to say thanks for this amazing engine.
I've been looking for a good engine for a few month now, but it seems that I've found what I've been looking for.
This is definitely my favorite engine among those I tested (Irrlicht, Ogre, Visual3D.net, etc.) wink
Well, I'm trying to implement an AI System for my RPG Game.
I have a StateMachine, States, Messages, etc.
Now I want to access objects by their ID for using them in the message system, like this:

Code:
Game::Obj sender = IDManager->GetObjFromID(senderID);
  Game::Obj receiver = IDManager->GetObjFromID(receiverID);

Basicaly sender could be a Goblin (Game::Chr) which is hitting the receiver, who is a Player (Game::Chr).
How can I do that, how can I get the objects behind its ID?
Is there any more elegant way of doing that?
Thanks in advance.

regards,
Kevin
11-21-2009 11:47 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: How to use obj IDs?
Hi,

you can iterate through all object containers, and in those object containers iterate all objects and match their id,

but instead of using IDs, I'd recommend using references (Reference) there is a tutorial for that in "game basics" folder "18 - Object References.cpp"
11-21-2009 11:54 PM
Find all posts by this user Quote this message in a reply
Kevin Offline
Member

Post: #3
RE: How to use obj IDs?
(11-21-2009 11:54 PM)Esenthel Wrote:  Hi,

you can iterate through all object containers, and in those object containers iterate all objects and match their id,

but instead of using IDs, I'd recommend using references (Reference) there is a tutorial for that in "game basics" folder "18 - Object References.cpp"

Ok, thanks.
Now it works with references fine.
11-22-2009 04:32 PM
Find all posts by this user Quote this message in a reply
Post Reply