Gameboy-Zelda Style Bottomless Pits/Lava Script
Code:
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
const int invis = 0; // set here the item ID of an item with Link Tile Modifier to make Link completely invisible
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 timer; bool switch;
int x; int y; bool falling;
while(true){
if(Screen->ComboT[ComboAt(Link->X+8, Link->Y+8)] == combotype && Link->Z == 0){
if(Link->Action != LA_FROZEN && !falling){
falling = true;
}
while(falling && Screen->ComboT[ComboAt(Link->X+8, Link->Y+8)] == combotype && Link->Z == 0 && timer < 5){
timer++;
Waitframe();
}
for(timer = 0; timer < 40; timer++){
if(!switch){Game->PlaySound(sfx); switch = true; x = Link->X; y = Link->Y;}
Link->Item[invis] = true;
Link->Action = LA_FROZEN;
if(lava == 0) Screen->DrawTile(2, x, y, tile+Floor(timer/8), 1, 1, 6, 1, 0, 0, 0, 0, true, 128);
else Screen->DrawTile(2, x, y, tile+Floor(timer/8), 1, 1, 6, 1, 0, 0, 0, 0, true, 128);
Waitframe();
}
switch = false;
Link->Item[invis] = false;
Link->X = warpx; Link->Y = warpy;
Link->Action = 0;
Link->HP -= 8;
Game->PlaySound(19);
}
Waitframe();
}
}
}
Make sure to set the Constant Integers at the beginning, and also to include them into the script file.
Arguments:
D0: If D0 is equal to '0', the script makes pits. If D0 is not equal to '0', the script makes lava.
D1 && 2: D1 && 2 are the coordinates to have Link re-spawn at after falling into a pit. If left at 0, he will respawn where he entered the screen.
D3: The combotype for 'Pit' combos. If left at '0', they will be 'centre statue' combos, by default.
D4: The tile to be used for the 'Link Falling' animation. If left at '0', the ones set in the integers are the beginning will be used.
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Awesome! Joe, you are an amazing scripter!
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Thanks :)
[advertising]If you wanted a demonstration of this script in action, The Legend of Zelda: The Fort Knights is a good way of finding out how it works :)[/advertising]
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Hmm... Well, depending on how well it works, I might use it! Way to go on this! :)
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Instead of manually moving Link and changing his HP, you could just set his Action to LA_DROWNING. It's like I said in build 643:
Quote:
If you set it to LA_DROWNING, and Link isn't on a water tile, then he will 'drown', but his sprite won't be drawn at all.
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Cool. If I ever get this quest off the ground, I might use it.
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Do I not need to worry about the invisible LTM then?
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Hey! I tried compiling it in Zquest, and I got multiple errors. This is in b718, btw...
Line 10- Function waitframes is undeclared
Line 18- Function comboat is undeclared
Line 19- Variable LA_Frozen is undeclared
Line 22- Function comboat is undeclared
Line 29- Variable LA_Frozen is undeclared
Line 30- Function floor is undeclared
Line 31- Function floor is undeclared
So I guess the problems are "waitframes", "comboat", "LA_Frozen", and "floor". Waitframes is supposed to be "waitframe", isn't it? That's the only thing I could make out. :tongue:
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
*sigh*
Don't go and change all the 'Waitframes();' to 'Waitframe();', that won't do you any good.
How many scripts are you using?
It it's more than one, make sure they're all in the same .z file.
Also, it'd probably be a good idea for you to put
on the first line of the file ;)
The things that aren't compiling were declared within std.zh, and you haven't told ZScript to load it, therefore it doesn't know what they are.
What I don't understand is why they're not just loaded by default.
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
ah, so that's the problem. Thanks!
Quote:
Don't go and change all the 'Waitframes();' to 'Waitframe();', that won't do you any good.
Yeah, I thought so.
Edit: Ugh, what now? The script compiled fine, but it's not working! At all! Someone must really not want me to use scripts in my quest. :tongue: