PDA

View Full Version : Sideview Ladder - FFC Script



Sephiroth
04-20-2010, 09:13 PM
Ok all, what I am requesting is a sideview ladder script that can be attached to a FFC (I don't want to use a global script, for I'll only be using sideview gravity on a teeeeny tiny amount of screens (like maybe 8 or 9 through the entire quest) and I would like to keep an FFC script for it.

The current FFC script I have is:
const int ladderflag = 100;

ffc script ladder{
void run(int speed, int combotype , int dummy){
int framedelay;
int lc;
if(combotype == 0){combotype = 11;}
if(speed == 0){speed = 1;}
while(true){
lc = ComboAt(Link->X+8, Link->Y+15);
if(Screen->ComboF[lc] == ladderflag || Screen->ComboI[lc] == ladderflag){
if(Link->Jump < 0) Link->Jump = 0;
if(Link->InputDown && !isSolid(Link->X, Link->Y+16)) Link->Y += 1;
if(Link->InputUp && !isSolid(Link->X, Link->Y - 1)) Link->Y -= 1;
//[[Sets up the antigravity effect]]
if(!Link->Item[130]){ Link->Item[130] = true;}
if(Link->InputLeft && Link->Dir == 2){
if(framedelay == 3){Link->X = Link->X+1; framedelay = 0;}
else{framedelay++;}
}
if(Link->InputRight && Link->Dir == 3){
if(framedelay == speed){Link->X = Link->X-1; framedelay = 0;}
else{framedelay++;}
}
if(Link->InputUp && Link->Dir == 0){
if(framedelay == speed){Link->Y = Link->Y+1; framedelay = 0;}
else{framedelay++;}
}
if(Link->InputDown && Link->Dir == 1){
if(framedelay == speed){Link->Y = Link->Y-1; framedelay = 0;}
else{framedelay++;}
}
Link->InputA = false;
Link->InputB = false;
Link->InputL = false;
Link->InputR = false;
}else{if(Link->Item[130]){ Link->Item[130] = false;}
}
Waitframe();
}
}
}

bool isSolid(int x, int y) {
if(x<0 || x>255 || y<0 || y>175) return false;
int mask=1111b;
if(x%16<8)
mask&=0011b;
else
mask&=1100b;
if(y%16<8)
mask&=0101b;
else
mask&=1010b;
return (!(Screen->ComboS[ComboAt(x, y)]&mask)==0);
}

Forgot where I got it, maybe that one ZScript site that I can't even seem to locate again, but blah.

What I'm wanting to fix is depicted in this video (http://www.youtube.com/watch?v=LmXdRBU90TE). See how link "flickers"? How can I prevent this and have a smooth animation while on the ladders? (Preferrably keeping Link faced to the north)

Saffith
04-21-2010, 12:39 PM
Not certain it'll work, but try changing line 11 to this:

if(Link->Jump < 0.16) Link->Jump = 0.16;
Assuming you have gravity set to 0.16.

Sephiroth
04-21-2010, 03:43 PM
That works very well, now if only I could get Link to always face up on a ladder and to have some animation while on the ladder as well.