PDA

View Full Version : Climbing script



Joe123
10-16-2007, 12:19 PM
Please look further down this thread before reading this post, as I've revised the script a good few times and it's much better now



Ever wanted vines that you climb rather than just walk slowly on?

EDIT: Make sure you check down two posts before just using this script, the one on that post is a lot better though out, and easier to use.


ffc script climbing{
void run(int btrtx, int btrty, int dummy){
while(true){
if( (Link->X >= this->X) && (Link->Y >= this->Y) && (Link->X <= btrtx) && (Link->Y <= btrty) ){
if(!Link->Item[dummy]){ Link->Item[dummy] = true;}
Link->InputA = false;
Link->InputB = false;
//Link->InputL = false; //delete the two backslashes infont of the command here if you want to
//disable the L button whilst Link is on the ladder, incase
//you're using that for a function via a script or whatever
}else{
if(Link->Item[dummy]){ Link->Item[dummy] = false;}
}
Waitframe();
}
}
}

Well here they are :P
C-Dawg made this for me a while back, and I've revised it, and I thought it would be more obvious to people to find it here.

It does, however, require some setup. Firstly, you need to set up an item with a Link Tile Modifier that will move Link's tiles along to a place where all of his movement tiles (ie, when walking in all directions) are facing upwards; the rest of his tiles won't matter because A and B buttons are disabled from use. Obviously you need to set up the Link tiles to this configuration also.

Then in the screen you want your ladder/vines etc. set the FFC to take the script's coordinates to the top left hand corner of the ladder. Then set the the first two arguments of the script to the X and then Y coordinates of the bottom right hand corner of the ladder, then set the third argument to the reference number of the item (you'll find this in the item editor).

And hey presto, Link now climbs properly!

However, if you want more than one ladder/vine per screen, you will have to make an exactly identical custom item, with the same Link Tile Modifier but a different reference number for each ladder/vine, and set the argument to the other item's number.

Shoelace
10-18-2007, 07:17 AM
You are freakin' awesome. I will use this for sure. I was hoping this script would be made. <3's Joe

Joe123
11-08-2007, 01:49 PM
And with the Slow Walk script, I have rejiggered the Climbing Script to be more simple.

Now, what it does is check whether Link is on a certain combotype (which you can set to be anything you like via D2, but if you don't set it it will revert to Left Statue), and apply the same effects - but it will also slow down Link's walking speed. So this means that you can set it to any combotype you like, and won't be restricted to using up all the screen's slow walk combos.


ffc script climbing2{
void run(int speed, int combotype , int dummy){
int framedelay;
if(combotype == 0){combotype = 11;}
if(speed == 0){speed = 1;}
while(true){
if(Screen->ComboT[ComboAt(Link->X+8, Link->Y+9)] == combotype){
if(!Link->Item[dummy]){ Link->Item[dummy] = true;}
if(Link->InputLeft && Link->Dir == DIR_LEFT){
if(framedelay == speed){Link->X = Link->X+1; framedelay = 0;}
else{framedelay++;}
}
if(Link->InputRight && Link->Dir == DIR_RIGHT){
if(framedelay == speed){Link->X = Link->X-1; framedelay = 0;}
else{framedelay++;}
}
if(Link->InputUp && Link->Dir == DIR_UP){
if(framedelay == speed){Link->Y = Link->Y+1; framedelay = 0;}
else{framedelay++;}
}
if(Link->InputDown && Link->Dir == DIR_DOWN){
if(framedelay == speed){Link->Y = Link->Y-1; framedelay = 0;}
else{framedelay++;}
}
Link->InputA = false;
Link->InputB = false;
Link->InputL = false;
}else{if(Link->Item[dummy]){ Link->Item[dummy] = false;}
}
Waitframe();
}
}
}

D0: The amount with which you want Link's walking speed to be reduced by. 1 is the slowest, and any number higher than one will steadily reduce his speed less. If you set it to 0, it reverts to 1 (0 will stop Link from being able to walk)
D1: The combotype that you want to be 'Climbing' whilst on said screen. If you leave it as 0, it will revert to 11 (Left Statue)
D2: The item ID number of the dummy item that you're using.

See above for setup of item. However, you no longer need to use two dummy items for two lots of ladders on one screen :)

Russ
11-16-2007, 06:16 PM
Joe, I think there is a problem with the first script. Sometimes it doesn't take away the dummy item, so Link continues climb as if he is on a ladder, even when he steps off of it.

Joe123
11-16-2007, 07:07 PM
Oh. Well that's interesting. I can't say I've experienced that personally, do you know when it happens?

Russ
11-16-2007, 07:40 PM
Mainly when walking off it going up, especially when you walk up the ladder to another screen. Like shown here. http://www.freewebs.com/russad/ladder%20show

When you get to the next screen and off the ladder, he keeps walking like he was on the ladder.

Joe123
11-16-2007, 07:51 PM
Oh, I know that will happen. I thought it wasn't worth making it not do that, because if you're going to have a ladder from the top of a screen you'll have it on the bottom of the next screen. If you set up the next screen, put the script and the top of those vines it'll work fine.

EDIT: OOOOH the first script!
The second one is a lot easier to use, trust me, and a lot less buggy. However, if you do the same thing that I just said with the first one it should also work properly.

EDIT2: no actually that won't work. The way you'll have to do that is set up a script with the same custom item as the ladder in the first screen on the new screen, and don't give it any (x,y) coords for the ffc or for the arguments. Then you'd have to make another custom item and make it into the ladder. This is why the second script is so much better.

EDIT2: well actually it might work. I did have this working but I can't remmeber how, when I wrote the new script I just scrapped the old one from my quest. You can get it to work, but it'll require some fiddling around. It's not really a bug in the script, it's doing what I've told it to, I just hadn't covered that situation very well.

Russ
11-16-2007, 07:56 PM
Okay, I'll get the new one. Now to go back through and redo all the ladders. Again.

Edit: Didn't see your edit. How would I do this (sorry, I suck at scripting)?

Joe123
11-16-2007, 08:01 PM
Right well, I did lots of edits in the end.
I do apologise about this, but I really would just use the second script. As of the moment, the Link detection on it isn't good (in that it'll pick Link up the moment his first pixel touches the combo), but I'm pending on a way of making it better, C-Dawg says I can, I'm just waiting for him to tell me how to really, which will end in being a simple addition to the script, so if you base your ladders around the second script, and I'll update it and it'll be completely compatible, just work slightly better.

Russ
11-16-2007, 08:05 PM
O.K. Thanks for the great scripts.

Edit: How do I get the number for the combo type. I tried figuring out how left statue is 11, but I just don't get it.

Joe123
11-17-2007, 09:27 PM
OK, I've edited the script in the third post to dectect what combo Link's at much better now, so anyone who's using that one (I'm looking at you Russ) would probably want to update it.

Russ
11-18-2007, 02:25 AM
Okay, great. I assume you didn't see my edit, though. How do you get a combo's I.D. number? E.G. what makes the left statue number 11? And what number is slow walk?

Gleeok
11-18-2007, 02:47 AM
Okay, great. I assume you didn't see my edit, though. How do you get a combo's I.D. number? E.G. what makes the left statue number 11? And what number is slow walk?

Ell our builds come with std's in 'em, ay mate?

............

...Herrr, that was pretty bad, even for me............

Russ
11-18-2007, 03:33 AM
Ell our builds come with std's in 'em, ay mate?

............

...Herrr, that was pretty bad, even for me............
Oh, so they are in the std.zh. Thanks Gleeok.

Joe123
11-18-2007, 05:57 AM
Put the combo on the screen, then press 'Q' twice. It'll flag up it's combo ID number.

No need to use slow walk though, the script makes Link walk slower as it is.
I made it like this, so you can use a junk combo like Left Statue (which is 11 I think) which means that you can then use slow walk for something else on the screen.

You can also change how much it slows down Link, by editing the value of D0 ;)

Russ
11-18-2007, 04:13 PM
And what number would be equal to the average slow walk combo's speed reduction number?

Joe123
11-18-2007, 04:32 PM
I have nooo idea. Sorry.
1 is the slowest, numbers higher than 1 slow down Link's speed less.
If you leave it as 0, it is set to 1 by default. Link cannot move if it is set to 0.

Russ
11-18-2007, 07:20 PM
If you leave it as 0, it is set to 1 by default. Link cannot move if it is set to 0.

Link can't move when it is set to zero? This gives me an idea for a ffc boss. One that stuns Link and then attacks him. Maybe I could pair that with Gleeok's crab boss script. I can already see how evil it will be. :evil:

Anyways, thanks for the awesome scripts Joe.

Joe123
11-18-2007, 07:29 PM
You can stun Link much more easily than how that script does it.
Just put Link->InputUp = false; etc for all directions.

Gleeok
11-19-2007, 07:56 AM
Link can't move when it is set to zero? This gives me an idea for a ffc boss. One that stuns Link and then attacks him. Maybe I could pair that with Gleeok's crab boss script. I can already see how evil it will be. :evil:


Feel the power of the dark side of the force. :mega:

Joe123
10-11-2008, 05:36 AM
const int ClimbingFlag = 99;

global script Slot_2{
void run(){
while(true){
//Other Global functions called before Waitdraw(); go here...


Waitdraw();
//Climbing script functions...
if((Screen->ComboF[ComboAt(Link->X+8, Link->Y+9)] == ClimbingFlag || Screen->ComboI[ComboAt(Link->X+8, Link->Y+9)] == ClimbingFlag) && Link->Z == 0){
Link->InputA = false;
Link->InputB = false;
Link->InputL = false;
Link->Dir = 0;
}
//Other Global Functions called after Waitdraw(); go here...


Waitframe();
}
}
}

And now for Climbing number 3!

This time, it's a global script, as Waitdraw() doesn't work in FFC scripts.
It's by far more simple to use. All you have to do is add this in as your global script, and then all instances in the game of Flag 99 will become ladders.
Be wary that it'll only work with Diagonal Movement checked though.
If you want to change the flag it uses, just edit the integer at the top.

And if you want any help combining it with another global script (as we can only really have one), then I'll be happy to help =)

lucas92
10-11-2008, 09:52 AM
Ohh thanks for that Joe123. :)

Joe123
10-11-2008, 10:06 AM
No problem

ShadowTiger
10-11-2008, 12:45 PM
And if you want any help combining it with another global script (as we can only really have one), then I'll be happy to help =)Well a general description of the process in a few minutes couldn't hurt. :)

Would they go after the //Other Global Functions called after Waitdraw(); go here... line but before the closing bracket?

Joe123
10-12-2008, 07:05 AM
Oh, sorry.

They would go after the '//Other Global functions called before Waitdraw(); go here...' line
And before 'Waitdraw();' line.

Unless they were functions that would be called after Waitdraw();, in which case they'd go where you said.
But they're more likely to go in the first place.

lucas92
10-13-2008, 01:36 PM
Yeah, hum, ComboAt doesn't seem to work in 864. Wouldn't it be ComboT instead?

EDIT-Never mind... Forgot to import std.zh.

Rastael
11-27-2010, 12:12 PM
I have some toubles with the scripts:

The ffc-scripts don't work, but it doesn't matter, cause I want to use the global script.
The problem with the global-script is that I can use the A and B button, even on flag 99 (but there are lots of bugs, when I use the weapos, because of the upwards-facing)


I'm using the newest windows build (actually 1330)

Can anybody help me?












Edit:
It worked, after I put "Waitdraw();" between "}" and "Waitframe();", don't know, why...







Edit2:
OK, when I put "Waitdraw();" between "}" and "Waitframe();", the function of stoping the input works, but Link isn't facing upwards all the time.
But when I let "Waitdraw();" on his orginal place, the facing-up function works, but the stop-input function not.
What should I do?

(sorry for my bad english)