PDA

View Full Version : [Summer 08] Bottomless Pits and Lava



Joe123
07-20-2008, 08:14 AM
How to use the Bottomless Pit script
By Joe123
I wrote this guide out for someone at Pure, so I thought I'd add the script to the Expo.


const int linkfalling = 0; // set here the first tile of your 5 tile Link Falling animation
const int linklava = 0; // set here the first tile of your 5 tile Link Drowning animation
const int fallingsfx = 0; // set here the SFX that plays when Link falls
const int lavasfx = 0; // set here the SFX that plays when Link drowns in lava

ffc script hole{
void run(int lava, int warpx, int warpy, int combotype, int tile){
int sfx = fallingsfx;
if(warpx == 0 && warpy == 0){Waitframes(5); warpx = Link->X; warpy = Link->Y;}
if(tile == 0){tile = linkfalling;}
if(combotype == 0){combotype = 35;}
if(lava != 0){if(tile == linkfalling){tile = linklava;}sfx = lavasfx;}
int i; int x; int y; bool falling;

while(true){
falling = false;
while(Screen->ComboT[ComboAt(Link->X+8, Link->Y+8)] != combotype || Link->Z > 0 || Link->Action == LA_FROZEN) Waitframe();

i = 0;
while(Screen->ComboT[ComboAt(Link->X+8, Link->Y+8)] == combotype && Link->Z == 0 && Link->Action != LA_FROZEN && i < 5){
i++;
if(i==5) falling = true;
Waitframe();
}

if(falling){
Screen->ClearSprites(3);
Game->PlaySound(sfx);
x = Link->X; y = Link->Y;
for(i=0;i<40;i++){
Waitframe();
Link->Action = LA_DROWNING;
if(lava == 0) Screen->DrawTile(2, x, y, tile+Floor(i/8), 1, 1, 6, 1, 0, 0, 0, 0, true, 128);
else Screen->DrawTile(2, x, y, tile+Floor(i/8), 1, 1, 6, 1, 0, 0, 0, 0, true, 128);
}
Link->X = warpx; Link->Y = warpy;
Link->Action = 0;
Link->HP -= 8;
Game->PlaySound(19);
}
}
}
}


Part one - Setting up your graphics
Firstly, find the graphics that you want to be your bottomless pits. Make them into walkable combos, and give them the 'Centre Statue' attribute.
Then, find your 5-tile Link Falling animation. Rip it into your tilesheet, and make a note of the number of the first tile.
Find your 5-tile Link Drowning in Lava animation. Rip that into your tilesheet, and make a note of the number of the first tile of that too.
Find your 'Link Falling' and 'Link Drowning' Sound effects, add those to the sound effect editor, and make a note of the numbers of those too.
Part two - Compiling the script
Open up Notepad.
On the first line, write
import "std.zh"
Leave a line, then copy in the script.
On the first 4 lines of the script, there are four 'integers' declared. They're noted (// before them) with what they do. Change the '0's here to match up with the four numbers you took down in the previous section.
Go to 'Save As', and type in a file name ending in '.z'. Then change the 'save as type' field to 'all files'. Save in your Zelda Classic folder.
Open up ZQuest, and go to 'Quest->Scripts->Compile ZScript'. Then select 'Import', and find your file.
Select 'Compile', and 'ok'.
The script should appear on the right hand side of the two dialog boxes. Click the arrow to assign it to a slot.
Part three - Applying the script
Take the bottomless pit (or lava) combos you made earlier, and place them on your screen.
Go to Screen->Freeform Combos, and select the first FFC.
Give it a transparent combo which is not combo 0
On the 'script' drop-down menu, apply the script you assigned earlier.
Go to the 'Arguments' Tab.
D0: If you want the bottomless pits to be 'lava', set this to be '1'. Otherwise, leave as '0'.
D1 & D2: If you want the pit to warp you to a specific place on the screen when you fall in it, enter the coordinates here in the for (D1,D2). Otherwise, Link will be warped to where he enterd the screen.
All combos that you made into 'Centre Statue' combos are now 'Bottomless Pit' combos.
That's all there is to it.


Pow!

Anthus
07-20-2008, 11:18 AM
This is very useful. I've been waiting for something like this.