My protect uses tiles to represent objects or equipment. These objects have sets of actions that can be applied to them which are dependent upon the current state of the item (ie: off, on setting 1, on setting 2, etc). These states also affect the points earned in different categories over time.
I've noticed in the openspace editor that custom parameters can be applied to each of the tiles, but I do not see a way to access these custom parameters at runtime (either getting or setting them) besides listening for a triggered event.
For my project, I need to be able to access and update these parameters for the tiles based on certain events that may triggered by time or other non interactive methods. Is there a way to access and set these parameters at runtime? Can the .map files store these parameters as well so I would be able to keep track of the current state of each tile (object)?
Data storage in tiles
This is not so easy to achieve... Tile objects are passed in events and you can access the Tile.customParams property. But OpenSpace 1 is not supposed to give direct access to tiles.
As a workaround you could give a name to the skin contained in the tile (but this means you can't have duplicate items on the map), then at runtime get a reference to it using the OpenSpace.getMapObject method. Once you have the skin displayobject, calling "parent" twice returns a reference to the Tile container.
But also using this workaround, you wouldn't be able to write those parameters at runtime, because there's no way to save them.
The only possibility is that you keep all the data in your own data structures, outside OpenSpace, and use a unique identifier to keep the reference with tiles.
In OS 2 this could be simpler. You still have to keep your data outside OpenSpace, in your own data structures, but in the Editor you can assign an instance name to each tile, and retrieve them easily by calling the OpenSpace.getTileByName method. In this way the instance name (must be unique) is the id linking your external data with the tile.
As a workaround you could give a name to the skin contained in the tile (but this means you can't have duplicate items on the map), then at runtime get a reference to it using the OpenSpace.getMapObject method. Once you have the skin displayobject, calling "parent" twice returns a reference to the Tile container.
But also using this workaround, you wouldn't be able to write those parameters at runtime, because there's no way to save them.
The only possibility is that you keep all the data in your own data structures, outside OpenSpace, and use a unique identifier to keep the reference with tiles.
In OS 2 this could be simpler. You still have to keep your data outside OpenSpace, in your own data structures, but in the Editor you can assign an instance name to each tile, and retrieve them easily by calling the OpenSpace.getTileByName method. In this way the instance name (must be unique) is the id linking your external data with the tile.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Return to “OpenSpace v1 discussions and help”
Who is online
Users browsing this forum: No registered users and 15 guests