Title: Altering Other Rooms - Script Tutorial Post by: Fatories on December 19, 2011, 02:51:49 AM So let's say that you had a room where you want some tile changes to happen. However, you only want these tile changes to happen after a switch has been pressed in a completely different room. That is exactly what this tutorial is about.
There are multiple ways to go about doing this (some save space, others don't) and I can tell you now this isn't the most efficient way, but that doesn't matter it isn't a big deal. If you are worried about saving space; then you must figure it out yourself. To start off with this script you will need a total of at least two actual scripts. One in the room with the switch and one in the room with the tile changes. We shall start with the one in switch room: This script is pretty self-explanatory. You can either do a checkmemory CCAO (switch bit) or you can just do a checktile to see if the switch has been pressed. The important part is that after the switch has been pressed you would do a setroomflag 80 command. The reason being is the other room will check to see if the room flag has been set and then alter the tiles. Now here is the main part. In the room where you want the tile changes you would set your script up as is shown: Code: writelocation X setinteraction72 xx jumproomflago M G 80 Y// M is the map where your switch is located. G is the map group for the map where your switch is located (found at the bottom of the ZOLE window). Y is some free memory [b]different[/b] from your first writelocation. writelocation Y In the code I have explained what the variables represent. After the second writelocation you would just have your script containing the tile changes wanted. The value 80 in the jumproomflago command is used because that is the roomflag that you should have set. This is a very simple script and can lead to powerful things. Title: Re: Altering Other Rooms - Script Tutorial Post by: Jigglysaint on December 26, 2011, 03:58:54 AM It would be even easier if you were able to use map scripts, since then all you need to do is create a script that checks to see if a button is pushed, and set the resulting room flag. When you get to the new room, the room flag will trigger the map script and the change will alter the room before it's fully loaded(that is, no suddenly appearing tiles).
Title: Re: Altering Other Rooms - Script Tutorial Post by: Fatories on December 26, 2011, 05:27:01 AM It would be even easier if you were able to use map scripts, since then all you need to do is create a script that checks to see if a button is pushed, and set the resulting room flag. When you get to the new room, the room flag will trigger the map script and the change will alter the room before it's fully loaded(that is, no suddenly appearing tiles). Oh yeah for sure and the map scripts are just as easy if not easier to do than this way. However you need to know some simple ASM to do that or at the very least know all the opcodes and hex edit like a pro. I am not teaching anybody that. |