RedcrowProd
Member
|
ObjectPtr question
hey so i was just wondering can a ObjectPtr return its id even if its not a correct one ?
i have a
ObjectPtr obj;
i do a Game.World.objCreate(*obj, m, s_id);
it does return false from time to time, but obj.id().asCString() return the correct id number ?
how's so ?
Thanks
|
|
09-02-2015 10:09 PM |
|
Esenthel
Administrator
|
RE: ObjectPtr question
Hello,
ObjectPtr points to an Object data allocated in the memory (in Objects Cache), this is not a Game.Obj object in the world.
Object and Game.Obj are 2 different things.
|
|
09-03-2015 08:41 AM |
|
RedcrowProd
Member
|
RE: ObjectPtr question
oh i should have ask this in another way
when does Game.World.objCreate(*obj, m, s_id); return false ?
i was saying more in a way that, i feel that my objcreate fails because of the ptr ?
|
|
09-03-2015 02:08 PM |
|
Tottel
Member
|
RE: ObjectPtr question
I guess it returns false because it failed to spawn the object in your world. Probably because the coordinates you are trying to spawn it belong to an area that has an inactive state.
|
|
09-03-2015 02:57 PM |
|
RedcrowProd
Member
|
RE: ObjectPtr question
i dont think its because because of the pos ( that works fine i believe ) : /
(This post was last modified: 09-03-2015 03:37 PM by RedcrowProd.)
|
|
09-03-2015 03:35 PM |
|
Tottel
Member
|
RE: ObjectPtr question
What is the pos that you spawn it at, and what is the position that you use to update the world?
|
|
09-03-2015 04:20 PM |
|
RedcrowProd
Member
|
RE: ObjectPtr question
this happens only when i have the same objptr in the inventory i made, and in the world at the same time, that's why i supposed it was more the fact that the objptr must be messed up at some point
i do update on my cam( so on my char )
edit: don't worry tottel, i gonna try tp do it in another way
(This post was last modified: 09-03-2015 04:38 PM by RedcrowProd.)
|
|
09-03-2015 04:36 PM |
|
Esenthel
Administrator
|
RE: ObjectPtr question
If the object would be in an inactive area, then the method will still succeed and return true.
It will fail only if object wasn't created at all, this can happen if your object type wasn't associated with a game object container.
Source code available here:
https://github.com/Esenthel/EsenthelEngi...Object.cpp
see:
Game.World.setObjType
Object.type
and also the tutorials
|
|
09-05-2015 12:03 AM |
|
RedcrowProd
Member
|
RE: ObjectPtr question
thanks esenthel for that answer, ill double check my objtype
but i do the setobjtype, and the item is only not showing when i have it at the same time in my inventory and in the world at the same time upon creating both of them.
the objtype might be set off at some point ill def. have a look into this !
|
|
09-05-2015 05:40 AM |
|