Given x,y (and z?) coordinates, is there a way to return a tile object for that position on the map?
For instance:
var px:int = 10;
var py:int = 11;
var pz:int = 0;
var room:Room = sfs.getActiveRoom();
var tile:Tile = room.getTile(px,py,pz);
trace("show skins: " + tile.skins);
Hard to imagine this would not be provided. What am I missing?
Thanks in advance.
Getting access to an instance of a tile on the map
From the official documentation there's nothing like this.
I am not aware of undocumented functions but I doubt they exist.
Bax is the lead developer of the project so he will be the best person to respond here. He will be back from vacation next week, so I'll let him answer.
By the way, can you better explain what you are trying to do exactly?
Once you have determined that a certain tile is walkable what would you do?
I am not aware of undocumented functions but I doubt they exist.
Bax is the lead developer of the project so he will be the best person to respond here. He will be back from vacation next week, so I'll let him answer.
By the way, can you better explain what you are trying to do exactly?
Once you have determined that a certain tile is walkable what would you do?
I am trying to 'wiggle' an avatar out of a certain spot in case they somehow get stuck. ideally I would like to get the avatar's tile, and then get the surrounding tiles. If walkable, teleport there.
right now I am trying to teleport to tiles, and if it does not work I know that that tile is not walkable, so I try to teleport to another tile. This works ok, but I would like to be more specific about it.
In addition I would like to get an avatars position, and then look at the skins on the tile above it (using my current x,y, and adding 1 to each) to see if an exit skin exists on that tile. I know that I can get the object for each one of these skins, but again this is not as explicit as getting the skins of a specific tile. Can one even get the tile that a skin is on based on the skin object returned from openspace?
right now I am trying to teleport to tiles, and if it does not work I know that that tile is not walkable, so I try to teleport to another tile. This works ok, but I would like to be more specific about it.
In addition I would like to get an avatars position, and then look at the skins on the tile above it (using my current x,y, and adding 1 to each) to see if an exit skin exists on that tile. I know that I can get the object for each one of these skins, but again this is not as explicit as getting the skins of a specific tile. Can one even get the tile that a skin is on based on the skin object returned from openspace?
Sorry I don't follow you.I am trying to 'wiggle' an avatar out of a certain spot in case they somehow get stuck. ideally I would like to get the avatar's tile, and then get the surrounding tiles. If walkable, teleport there.
Why would an avatar get stuck? Are there traps in your maps?
If a user can get in a location it should be able to get out... at least that's how we presume maps are created. Can you elaborate?
You can use Avatar Events.In addition I would like to get an avatars position, and then look at the skins on the tile above it (using my current x,y, and adding 1 to each) to see if an exit skin exists on that tile.
For example you register your avatar for an ENTER_TILE event. Each time your avatar enters a new Tile you get an event with a reference to that object which you can use to identify exits and whatnot.
Check the docs for the AvatarEvent class under the com.smartfoxserver.openspace.events package
-
Paul Scherbak
- Posts: 4
- Joined: 23 Feb 2009, 08:09
- Location: Ukraine, Kharkiv
- Contact:
Yes, I have the same trouble. I do a bot for testing of loading for a server. The bot should be able to walk the room.Lapo wrote:From the official documentation there's nothing like this.
I am not aware of undocumented functions but I doubt they exist.
Bax is the lead developer of the project so he will be the best person to respond here. He will be back from vacation next week, so I'll let him answer.
By the way, can you better explain what you are trying to do exactly?
Once you have determined that a certain tile is walkable what would you do?
I use function moveMyAvatar to move a bot to a new position of a room, and I process event AvatarEvent.STOP_MOVEMENT to start to move a bot again.
Problem in that if to transfer in moveMyAvatar an impassable point, event AvatarEvent.STOP_MOVEMENT will not fired. Means it is necessary to check a point on passableness to a function call moveMyAvatar.
Now I can check up only a point in which there is my character, by function getCurrentTile().
Very much there is no similar function getTile(point).
I need this too.
I need this too.
I can't believe it's not available, it seems so basic.
I can't believe it's not available, it seems so basic.