This script requires std.zh and ffcscript.zh, so be sure you're importing them. There's a lot of constants in this script, so you'll want to either set them all in order from top to bottom or set them in the order I list them off here and use Ctrl+F to find them.
Items:
First we need to set up a bunch of items.
To start with, we need to create the four empty bottle items. Each bottle needs to have a unique level number (1-4) and tile. The tiles should be the first in each row in the tile layout in the first image. The top left tile in this block is what TIL_BOTTLE constant should be set to. All four of these bottles should be accessible in your subscreen with item override. Because of how the script is set up, bottles cannot be animated. Set the constants I_BOTTLE1-I_BOTTLE4 to these items. Set IC_BOTTLE to the itemclass these items all use.
Next, we make the six pickup items for the three potions, water, fairies, and bees. When you catch something in a bottle or buy a potion from a shop, it gives you one of these. Since they're pickup items it doesn't matter what class they are. The potions need to use the PotionFill script. D0 is the string to play and D1 is what type of potion it is (Red = 1, Green = 2, Blue = 3). The rest do not need anything other than a regular item message script. They exist just so Link can hold up an item. I_WATERBOTTLE, I_FAIRYBOTTLE, and I_BEEBOTTLE should be set to the collectibles for these items.
Graphics:
Some combos, tiles and sprites you'll need to make:
- TIL_BOTTLESWING: A right facing open bottle tile (or bug net if you want to ALttP) used for when Link swings a bottle.
- CMB_FAIRY/CS_FAIRY: Animated combo and CSet used for the fairy that appears when you use a fairy in a bottle.
- CMB_BEE/CS_BEE: Animated combo and cset used for the bee script.
- SPR_BOTTLEWATER: Animated sprite in Weapons/Misc used for the water dumping animation.
- C_WHITE: The color white in your quest, in hexadecimal. The first digit represents the CSet and the second the color in that CSet. For most tilesets it'll be in cset 0.
- C_BLACK: Similar to the last one, but for black.
Sounds:
Various constants set SFX for things. If you don't want a sound for something, you can set it to 0.
- SFX_BOTTLEWATER: Sound when you dump water on the ground.
- SFX_FAIRY: Sound when a fairy appears.
- SFX_HEARTREFILL: Sound when you recover a heart with a potion or fairy
- SFX_MAGICEFILL: Sound that plays when your MP is refilling
- SFX_ERROR: Sound that plays when you try to use a healing item at max health or MP
- SFX_BOTTLESWING: Sound when you swing a bottle
- SFX_BEE: Sound of a bee buzzing. Plays every half second.
Screen Freezing:
This quest uses screen freezing combos for the potion and fairy refills. If you already have a screen freezing function from another script, you can just replace these functions with those. Othewise, you'll want to set some constants.
- FFC_SFA/FFC_SFB: Set these to two FFCs that go unused in your quest. Probably 31 and 32. Order doesn't matter.
- CMB_SFA/CMB_SFB: Set these to an invisible Screen Freeze (FFCs only) and Screen Freeze (Except FFCs) combo. Once again order doesn't matter.
Scripts:
Global:
For your Slot 2 global script, you'll want to have the RefreshBottles(); function before your while loop and EmptyBottleGlobal(); before waitdraw, like in the example script. If you don't have another global, you can just use the example script since there's nothing to combine.
Shop:
The shop script has two constants STR_CANTAFFORD and STR_NOBOTTLE for when you can't afford an item or don't have a free bottle. Set these to the strings for those messages. Place down an FFC with the script on your desired screen in the desired spot and set its graphic to that of the item being sold. Set the arguments like so:
- D0: Item to sell.
- D1: Description that displays when you stand below it and press the L key.
- D2: Price of the item.
- D3: If the item is a potion, set this to 1. It will only sell it if you have an empty bottle.
Bee/Tall grass:
Above the Bottle_Bee script, set LW_BEE and EW_BEE to unique lweapon and eweapon types for your quest. Set DAMAGE_BEE to how much damage the bee should deal. If you have other scripts using FFC->Misc, set FFCM_BEE_SELFDESTRUCT to something safe.
You can place the BeeGrass on any combo that changes on the screen. When the combo changes it has a 1/D0 chance of spawning a Bottle_Bee script that attacks Link.
WaterTrigger:
Place this anywhere on the screen and any water weapon that collides with it will trigger flags 16-31 on that screen and set the secret state.
Balance Tweaks:
There are a few more constants that will change the healing values and speeds of the potions and fairies. These are REDPOTION_HEARTS, GREENPOTION_MP, BLUEPOTION_HEARTS, BLUEPOTION_MP, and FAIRY_HEARTS. There's also FREQ_HEARTREFILL and FREQ_MAGICSOUND which change how fast hearts refill and how often the magic refilling sound plays.