About Store Forum Documentation Contact
Donations:
364$/mo



Post Reply 
about ObjCreate
Author Message
yvanvds Offline
Silver Supporter

Post: #1
about ObjCreate
After all that is written about ObjCreate, I still have some questions :-)

The comments say that if you create an object "method succeeds if 'matrix' is out of active range but pointer to object isn't returned"

Now what happens if, afterwards, you move the player within active range of the object? Can I get a pointer to the object or not?

The reason I ask about this. I am sending a list with object from the server to the client when it logs in. They are created with ObjCreate, because some of them could be at the other side of the world. Now these objects should be selectable. I'm selecting objects with (quite trivial) code on mouseclick:

PHP Code:
if (Physics.ray(posdir D.viewRange(), &selectorIndexToFlag(AG_SOUNDBALL))) {
                    if (
cSoundBall ball CAST(cSoundBallselector.obj)) {
... 

All is good as long as I'm trying to select an object that was created near to where the player starts. But objects that where created far away do return a pointer, but not with the correct information.

Is this normal? Is there something I should do when created objects enter the active range?

Regards,

yvan
07-29-2011 03:10 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: about ObjCreate
Quote:But objects that where created far away do return a pointer, but not with the correct information.
what do you mean by that?
objects that are outside of active range are not accessible at all, until you move close to them

Quote:Now what happens if, afterwards, you move the player within active range of the object? Can I get a pointer to the object or not?
yes you can access them
07-31-2011 11:50 AM
Find all posts by this user Quote this message in a reply
yvanvds Offline
Silver Supporter

Post: #3
RE: about ObjCreate
Yes, I got it now. I just realized that an object's load and save routines are not only used to create a savegame, but also to swap far away objects to disk.

The object information that was incorrect was not included in the save/load functions because it was not important for a savegame, but for swapping objects that are out of range they did matter. That is why I said that some information was incorrect.
07-31-2011 02:33 PM
Find all posts by this user Quote this message in a reply
Post Reply