I am working on having removable roofs for buildings in my current game, rather than use doors to transport to them. To do this, I am trying to use a map layer dedicated to roofs and zones on those tiles. Reading up in the dictionary, I'm struggling to find the possible commands, if any, to locate x and y values of a zone given a zone ID. I also can't find anything on the wiki. I assume it may not be easily possible.
Regardless, my next question would be what is the best way to toggle map layer visibility. If removing portions of a roof layer by zone is too complicated or impossible, I think making the entire layer invisible instead would suffice. However, I'm struggling with that as well. In custom, it's possible to disable layers in the editor, and I'd like to do something like that. I could write the map blocks all to 0, but I am wary about setting them back to their original values.
To clarify, I have a building with a stepon NPC in the doorway. When the player activates the NPC, the 'roof' of the building should disappear so the player can see 'inside.'
Finding Area & Location of Specified Zone / Layer Visibility
Moderators: marionline, SDHawk
Finding Area & Location of Specified Zone / Layer Visibi
My pronouns are they/them
Ps. I love my wife
Ps. I love my wife
- Bob the Hamster
- Lord of the Slimes
- Posts: 7658
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
Hiding the entire roof layer will be very much the easiest way to do this.
Then you don't even need to find all the tiles in the zone, all you need to know is whether or not the hero is on the zone right now.
If you do really still want to find all the tiles in a zone, the easiest way to do this is simply to loop over the whole map.
Then you don't even need to find all the tiles in the zone, all you need to know is whether or not the hero is on the zone right now.
Code: Select all
if(read zone(1, hero X(me), hero Y(me))) then(
# under a roof
)else(
# out in the open
)
Code: Select all
variable(x, y)
for(y, 0, map height -- 1) do(
for(x, 0, map width -- 1) do(
if(read zone(1, x, y)) then(
# something that happens for all tiles in zone 1
)
)
)
Last edited by Bob the Hamster on Tue Apr 05, 2016 8:08 pm, edited 1 time in total.
- Bob the Hamster
- Lord of the Slimes
- Posts: 7658
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact: