How To Make a Guardia Style Door:
A guardia style door is quite a bit different than the doors you make with 'door trigger'. They require putting code in "atleast" three different objects I personally like to make it 4 objects (I try to put all the logic of a room in one object). I'm going to show how to do it my way
First off you're going to need to put the "open door" tiles on your map. Just copy them off in the corner somewhere...to make it easy copy both layer 1 and 2 the situations where you copy just one layer are pretty rare. The open door is right next to the closed door on the tileset.
Now start with some blank events
Object 00 //pre room load events
Object 1-7 //PC's
Object 8 // logic
you need to atleast 2 more objects whose touch will trigger the door to open. Place them beneath the door and behind the door (behind really = on the door since it's 2D). When we touch them were going to do some logic so have it call object 8's arbitrary 0 (we'll put the logic there later)
Object 00 //pre room load events
Object 1-7 //PC's
Object 8 // logic
Object 9
StartUp
SetObject( in front of door)
Activate
return
Touch
call object 8 arbitrary 0
Object A
StartUp
SetObject( behind door)
Activate
return
Touch
call object 8 arbitrary 0
To debug you can just have the touch print out a textbox. OK now we need to add the logic of opening the door. First off we only want to call this once (you can't open an open door) so we'll need to do some sort of flag. I personally use 7F0202/204 for my PC's coordinates and 7F0206 for flags. So we'll say 7F0206 bit 1 being set means that the door has been open. We also want to play the door open sound...that's easy.
We need to copy over the tiles. There are two variants to the CopyTile, E4 and E5. E4 is used for "before the screen is drawn" E5 is used for After the screen is drawn. Since the screen is drawn when we touch these objects were going to use E5. Geiger has done a swell job of taking out some of the ambiguity of the final parameter of CopyTile, Personally I suggest setting Everything that can be set to "true" as true and simply make sure that the corner where you drew the open door has the Properties you want (as in solidity/zplane/wind/etc).
Finally don't forget to set our flag! Ok that took alot of explaining but it's not that much code, lets see what our code looks like now
Object 00 //pre room load events
Object 1-7 //PC's
Object 8 // logic
Arbitrary 0
if( 7F0206 & 1) //it's open already!
return
Play door open sound
CopyTiles VARIANT E5 ( upperX, upperY, lowerX, lowerY, FF) //the FF just means everything is true
SetBit ( 7F0206 & 1)
return
Object 9
StartUp
SetObject( in front of door)
Activate
return
Touch
call object 8 arbitrary 0
Object A
StartUp
SetObject( behind door)
Activate
return
Touch
call object 8 arbitrary 0
Not to bad right? If it's open it'll just return immediately. Remember to set the variant to E5! That's a very easy mistake to make....but not the easiest!
If you run the game now the door opens. And most rom hackers would just say their job is finished. But not you! You read the How-To thread, so you know that when you go to the menu and return the entire screen is redrawn! Go ahead and try it, oh noes your door came back! And what's worse is that you set your bit so you can't open it again. Whatever will you do??
Well the trick is that there's a special spot in the code that gets reran every time the screen is drawn! What spot? Object 00's activate. Let's copy over our logic there, but this time use variant E4 of CopyTile since were copying the tiles before the screen is drawn. Remember this time you draw it ONLY if 7F0206 bit 1 is set otherwise it'll draw the open door before you open it!
Object 00 //pre room load events
Activate
if( 7F0206 & 1) //it's open already!
Play door open sound
CopyTiles VARIANT E5 ( upperX, upperY, lowerX, lowerY, FF) //the FF just means everything is true
Object 1-7 //PC's
Object 8 // logic
Arbitrary 0
if( 7F0206 & 1) //it's open already!
return
Play door open sound
CopyTiles VARIANT E5 ( upperX, upperY, lowerX, lowerY, FF) //the FF just means everything is true
SetBit ( 7F0206 & 1)
return
Object 9
StartUp
SetObject( in front of door)
Activate
return
Touch
call object 8 arbitrary 0
Object A
StartUp
SetObject( behind door)
Activate
return
Touch
call object 8 arbitrary 0
Thats it you should now have a fully functioning Guardia style door!
--JP