Jump to content

Freeform LttP Doors and Shutters

Overview
Creator: Moosh Updated: 13 May 2023 Tags: FFC Downloads: 84
Rating[?]: Rating: 4.33/5 (2 ratings)
View Script Download Example
(2.22 MB)
Information

Description Setup Reviews Comments

First, you'll want to set up the constants at the top of the script:
  • SHUTTER_INVISIBLE_COMBO: Set this to a combo that when placed on a 4x4 FFC will be invisible.
  • CMB_BOMBWALL_MARKER / CS_BOMBWALL_MARKER: Set to the combo/cset of the bomb lens marker. 0 for none.
  • D_LTTPDOORS: Set to the Screen->D[] (0-7) index used for directional doors
  • D_LTTPDOORID: Set to the Screen->D[] (0-7) index used for ID'd doors
  • SFX_*: Various sounds for the doors. All are set to the default shutter sound by default.
  • LENS_MP_COST: If you have bomb markers, set this to the MP cost of the lens.
  • SHUTTER_USE_FFC_CSET: If you want your door combos to be set to the FFC's CSet set this to 1. It's mostly only useful for layered doors.
Next set up the combos for your doors. These are made up of tile blocks arranged in vertical tiles. If your doors are less than three tiles wide, you can fit two columns next to each other. See the included images for example setups. The usual setup is:
  • Closed door
  • Opened door
  • Animation frames of the door opening going from closed to open
Bomb walls are a little different as they don't have a closed door block or animations and have a 1x1 rubble tile following the opened block instead.

All door FFC scripts should have the top left combo of the first of the door's combo blocks as the FFC's gfx. The Tile Width and Tile Height of the FFC should be the size of the door. Under flags, Run Script at Screen Init should be checked. If your door is on a return screen from a warp or the first screen of a dungeon, you'll want to set Is A Changer to make it invisible.

Arguements for each of the doors:

Shutter Arguments:
  • D0: The direction of the wall the door is up against. 0 = Up, 1 = Down, 2 = Left, 3 = Right
  • D1: The trigger type for the shutter. This will determine when it opens:
    • 0: One Way (Never Opens)
    • 1: Kill All Enemies
    • 2: Push Block - Will open when a block is pushed, or when a block puzzle is solved if there are block trigger flags onscreen
    • 3: Combo Change - Will open when a combo position specified by D2 changes. If it changes back to the combo it originally was, the door will close again.
    • 4: Permanent Secret - Will open when the screen's permanent secret state is set. It will never close again even when reentering the screen.
  • D2: Effect changes based on D1:
    • If the door is an enemy shutter, set to 1 to make it permanent. Will use lock door ID 16.
    • If the door is a combo change shutter, this is the combo position to check to control the shutter's open state.
  • D5: The layer to put the door combos on. If >0, be sure that layer is enabled for the screen or it will not work.
  • D6: If you're using an opening animation and for whatever reason don't want its position to be relative to the door's combos in the editor, you can put the starting combo of the animation here.
  • D7: If you're using an opening animation, set this to the number of frames.
Locked Door Arguments:
  • D0: The direction of the wall the door is up against. 0 = Up, 1 = Down, 2 = Left, 3 = Right
  • D1: The ID of the door. If you only have one door against the wall, this can be left at 0 and it will use the door's direction to identify it. Otherwise you want each door to have a unique ID from 1 to 16 and the corresponding door on the other side to have an identical one.
  • D5: The layer to put the door combos on. If >0, be sure that layer is enabled for the screen or it will not work.
  • D6: If you're using an opening animation and for whatever reason don't want its position to be relative to the door's combos in the editor, you can put the starting combo of the animation here.
  • D7: If you're using an opening animation, set this to the number of frames.
Boss Locked Door Arguments:
(Yeah it's set up just the same as the normal locked door)
  • D0: The direction of the wall the door is up against. 0 = Up, 1 = Down, 2 = Left, 3 = Right
  • D1: The ID of the door. If you only have one door against the wall, this can be left at 0 and it will use the door's direction to identify it. Otherwise you want each door to have a unique ID from 1 to 16 and the corresponding door on the other side to have an identical one.
  • D5: The layer to put the door combos on. If >0, be sure that layer is enabled for the screen or it will not work.
  • D6: If you're using an opening animation and for whatever reason don't want its position to be relative to the door's combos in the editor, you can put the starting combo of the animation here.
  • D7: If you're using an opening animation, set this to the number of frames.
Bomb Wall Arguments:
  • D0: The direction of the wall the door is up against. 0 = Up, 1 = Down, 2 = Left, 3 = Right
  • D1: The ID of the door. If you only have one door against the wall, this can be left at 0 and it will use the door's direction to identify it. Otherwise you want each door to have a unique ID from 1 to 16 and the corresponding door on the other side to have an identical one.
  • D5: The layer to put the bomb wall combos on. If >0, be sure that layer is enabled for the screen or it will not work. Note that if the bomb spot is on a layer the wall behind it should also be on that same layer so it opens a walkable path.
General Troubleshooting:
I thought I should have a section on this because door scripts have a history of causing people grief. Here's some common problems I imagine may come up and the solutions:

Just a general thing for most cases where doors are goofing up is to check the direction argument (D0) and ID argument (D1). Forgetting to change one of these when copying doors is the most common mistake I make.

Remember:
0: Top Wall
1: Bottom Wall
2: Left Wall
3: Right Wall

Link is getting teleported when I walk to a certain spot on the screen.
This is caused by a door facing the wrong direction or a path going through the back of a door. The door's hitbox extends from the wall face it's attached to all the way to the edge of the screen.

The door's graphics are broken.
A few possibilities for this one.
  • Is the door only broken in ZQuest? In most cases the graphics of the door FFCs visible in ZQuest won't be seen in-game. It's okay for them to be garbled, although you can fix this by moving tiles around in the editor.
  • Is the door broken when it animates? This indicates it's the animation that's broken. Check if D6 is set to something wrong. If it isn't, compare against the example images.
  • Is the door broken all the time? In this case, you should check the FFC's gfx. If it's set to the right combo, compare against the example images.
When I scroll to the next screen the door there isn't open.
The most likely cause is the door on the other side has the wrong direction or ID. If it's not using an ID, pairs of doors should have opposite directions (0-1, 2-3). If it is using an ID, pairs of doors need to match up. A less common possibility is if your side warp crossed the boundary of a map/dmap. The states of doors are saved to the DMap, so in these cases, you'll need a script to carry the state over.

When I scroll to the next screen, a door I didn't open is open.
This happens if two doors share the same direction and ID. Doors need to have unique ID numbers if they're not supposed to be linked. Only one door per direction can have an ID of 0, but ID's greater than 0 are shared for all directions.

I bombed a bomb wall and there's a broken graphic in front of it.
Below the combo block for an open bomb wall is a 1x1 combo of rubble that's supposed to appear when the wall is blown up. See the example image. If you don't want the rubble, you can just make it an invisible combo.

These scripts require std.zh.