-
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:
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Okay, this just prompted me to make an all-new favorites folder for organizing scripts I intend to use, because there are just too many awesome ones out there.
Way to go Joe!
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Did you:
Make all out your pit combos walkable, Centre State combos?
Make sure that the FFC that it's applied to has a non-zero combo
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Ok, well I had already made the pit combos walkable center statues. And they have to be applied to the FFC? I could have sworn I did that already, but I'll try again just in case. I saw a thread in the bug forum about FFCs not working in builds 704-718, so maybe that's the issue... Can't be sure yet though.
Edit: Nope, didn't work. It must be a bug.
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
What?
No, don't make the combos into the ffc's combo...
Right:
1) Compile the script
2) Set the script to a slot
3) Go to 'ffc 1' for the room you want the pits in
4) Set that script to the ffc, and set it's combo to a transparent combo that is not combo 0
5) Make all your pit combos into walkable centre statue combos
6) Place them on the screen
7) Open in Zelda Classic and play.
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Ok, well that helps. I'll try that. :)
Edit: Finally! I didn't know what I was doing wrong before, but it's definately working now! Thankyou so much, I know I've been a pain.
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Okay, slight problem. I set it up right? Assign script to FFC, set arguments, draw combos, etc. Then I go to test it. Run ZC, and nothing happens when I step on the combos. So I open up ZQ and lo and behold, the FFC has reset itself to blank. Any ideas? I have other FFC's running on the same screen, so it's something specific.
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Quote:
Originally Posted by
Amaster42
Okay, slight problem. I set it up right? Assign script to FFC, set arguments, draw combos, etc. Then I go to test it. Run ZC, and nothing happens when I step on the combos. So I open up ZQ and lo and behold, the FFC has reset itself to blank. Any ideas? I have other FFC's running on the same screen, so it's something specific.
You have to set the freeform combo to a combo that is not combo number zero. I you don't set a combo for the FFC, it will reset.
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Hmmmm....I thought I did, but I'll check.
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Quote:
Originally Posted by
Beta Link
Edit: Finally! I didn't know what I was doing wrong before, but it's definately working now! Thankyou so much, I know I've been a pain.
That's alright, don't worry about being a pain, I appear to have to have limitless amounts of time to devote to helping around here :shrug:
And if that's what happened, Amaster, I'd be willing to put quite a lot of money on that you haven't assinged the ffc to a non-zero combo.
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Nope. Definitely a non-zero transparent combo. I'm stumped.
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
I guess I encountered some odd bug with this script in The Fort Knights. Somehow I died while Link disappeared after I fell down a pit but before Link reappeared on the surface. The result? When Link resurfaced, he was invisible. The only way to remedy this was to fall down the pit again.
Quote:
Originally Posted by Joe123
Do I not need to work about the invisible LTM then?
I hope this isn't what I was talking about, and therefore I would look like an idiot... ;)
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Quote:
Originally Posted by
Amaster42
Nope. Definitely a non-zero transparent combo. I'm stumped.
Well, I made a few minor changes to the script between last using it and posting it up, so I'll go and check it again but I don't think I could've broken it.
Quote:
I guess I encountered some odd bug with this script in The Fort Knights. Somehow I died while Link disappeared after I fell down a pit but before Link reappeared on the surface. The result? When Link resurfaced, he was invisible. The only way to remedy this was to fall down the pit again.
Oh yeah, I've fixed that one.
Quote:
Quote:
Do I not need to work about the invisible LTM then?
I hope this isn't what I was talking about, and therefore I would look like an idiot...
Funny, I meant to put 'worry' there, not 'work'.
Anyway, at the moment the script requires making Link invisible via LTM, but _L_ was suggesting another method.
He didn't reply though, so at the moment, LTM still.
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Well, step by step heres what I do:
1.)Open Scripts.z
2.)Set the 5 variables at the top of the script.
3.)Save and Quit
4.)Open up ZC and my quest.
5.)Go to "Import ZScript"
6.) Import and Compile
7.) Assign to slot 4.
8.)Go to FFC 5.
9.)Set the combo ot a non-zero blank.
10.) Assign it script 4
11.) Set the arguments.(For the record, the only one I set is the combo number)
12.)Save and quit
13.) Open ZC and my quest.
14.) Walk on the combos. Nothing happens.
15.) Open ZC. The FFC is blank. WTH?
If it matters, my pit combo is entirely blank property wise.
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
You set the combo number?
And what number are you setting there?
The Combo ID number of a combo that looks like a pit?
Don't be doing that.
What you want to do is make all of your pits have the combo type number (so, 35 for centre statue) that is set in that box.
Centre Statue is default.
So don't make your pit combos blank propertywise, and don't set an absurdly high value in that box, because it ain't a combo ID.
That doesn't solve the dissapearing FFC problem though.
Hrm.
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
Ohhhhhhhhh...
I get it now. That makes sense. I had the two confused. Off to test.
EDIT: She works! As for the reseting, well I had to similar test screens set up, and on only one had I set it to a non-zero. There's the problem.
-
Re: Gameboy-Zelda Style Bottomless Pits/Lava Script
And now Mark 2:
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
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);
}
}
}
}
No need for silly Link Tile Modifiers anymore!
All other set up is the same though.
-
I got the error "Line 204, error T21: Couldn't match type signature Drawtile(Screen, Float, Float, Float, Float, Float, Float, Float, Float, Float, Float, Float, Float, Bool, Float)
-
The script is old so there's an updated script at pzc I believe.
Otherwise DrawTile needs a corresponding y_scale argument:
Code:
Screen->DrawTile(2, x, y, tile+Floor(i/8), 1, 1, 6, 1, 1 // <------here
, 0, 0, 0, 0, true, 128);
-
I did this, it now works fine :D thanks
-
Oh my, we're using 2.11-era code files?...
Actually, I think this was one of the things I had to fix in the Starshooter script to get Starshooter to work, and not crash, on a release build of 2.5. I know it was some series of drawing functions that had been revised, with more args in newer ZC versions.
@Tamamo
maintains the update of the holes script though, so it might be good to post the latest version here.