About Store Forum Documentation Contact



Post Reply 
Dynamically created objects
Author Message
Harry Offline
Member

Post: #1
Dynamically created objects
Is object created in game by objCreate function automatically stored in Memx containers for objects for example to Items container? How can I get it to single Item item; variable? Bu id or something?
(This post was last modified: 11-03-2010 08:40 PM by Harry.)
11-03-2010 08:40 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Dynamically created objects
yes, it gets stored, unless it gets flushed to disk (please check comments on objCreate)

you should use objCreateNear if you want to access created object as it returns pointer to the object
11-03-2010 10:01 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #3
RE: Dynamically created objects
Ok, thanks. When I'll have got free time I'll check this. But now I use this code:

Code:
Game::ObjParams &obj=*Game::Objs(itemPath); // get weapon object parameters
    Game::World.objCreate(obj,Matrix(obj.scale(),waypoint->point(targetNumber).pos));    // create new object
    item=&Items[Items.validElms()-1]; // save last item from container to Item variable

Is it ok? Or has it any disadvantages?
11-04-2010 05:15 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Dynamically created objects
that's bad
you should use objCreateNear
11-04-2010 05:54 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #5
RE: Dynamically created objects
I use objCreateNear and asign result to Game::Obj variable, but I can't assign it to Item. Is it possible?
11-06-2010 11:11 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #6
RE: Dynamically created objects
Code:
Item *item = CAST(Item, obj);

This should work I believe.
11-07-2010 03:35 AM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #7
RE: Dynamically created objects
Yes it works, thank you.
11-07-2010 11:53 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #8
RE: Dynamically created objects
One more question. How can I check that I have grabbed item on the list or in slot. I don't mean any object but the specific one. For example I created object which is one of targets in mission, and I want check if it is in my inventory.
11-12-2010 06:34 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
RE: Dynamically created objects
add a unique parameter to it.
11-12-2010 07:10 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #10
RE: Dynamically created objects
Ok, I thought that there is another way.
11-12-2010 08:47 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply