PDA

View Full Version : Sideview Ladder



Sephiroth
10-09-2008, 12:06 AM
Well, I know of the global script for sideview ladders, however I want an FFC version of it. Is there any chance on getting an FFC version of it, seeing as I don't plan on having too many sideview sections in my quest, and I don't want to be using up a global script slot (Seeing as we only have two).

Edit: Oh shoot, I posted this in the wrong place. Can I get someone to move it to requests?

Edit2: I tried the ladder FFC script CJC wrote, however for some reason in 864 link flickers, and acts as if he's falling when he's moving around on a ladder.

_L_
10-09-2008, 03:51 AM
The reason he flickers is because of how sideview gravity is coded. I might make a slight change in that regard. Otherwise, use this:



const float GRAVITY = 0.16;

// Use Slow Walk combos for the ladder.
ffc script SideviewLadder {
void run {
if (Screen->ComboT[ComboAt(Link->X, Link->Y+15)]==CT_WALKSLOW)
{
Link->Jump = GRAVITY; // Negate gravity
if (Link->InputUp && WalkableAt(Link->X+16, Link->Y+8) && WalkableAt(Link->X, Link->Y+8))
Link->Y-=1;
else if (Link->InputDown && WalkableAt(Link->X, Link->Y+16) && WalkableAt(Link->X+16, Link->Y+16))
Link->Y+=1;
if (WalkableAt(Link->X, Link->Y+16)) {
Link->InputA = false;
Link->InputB = false;
// Change tiles
}
}
}
}
You'll also need the WalkableAt method (or similar) defined somewhere.

// Determines whether a coordinate is walkable.
bool WalkableAt(int x, int y)
{
int x2 = Link->X % 16;
int y2 = Link->Y % 16;
int mask;

if (x2 >= 8)
mask = 1;
else
mask = 2;
if (y2 >= 8)
mask << 2;
return ((Screen->ComboS[ComboAt(x,y)] & mask)==0);
}
I might add WalkableAt to std.zh soon.

_L_
10-09-2008, 03:54 AM
and I don't want to be using up a global script slot (Seeing as we only have two).
Don't think of global scripts in the same way that you think of FFC scripts. If you want a whole lot of mini-scripts to run every frame, you make them into methods within the global script, then have the run() method call them every frame. Like so:


global script Global {
void FireSword() {
// imagine that there's code here
}
void RevivingEnemies() {
// imagine that there's code here
}
void SpecialPowerTimer() {
// imagine that there's code here
}
void run() {
FireSword();
RevivingEnemies();
SpecialPowerTimer();
Waitframe();
}
}

_L_
10-09-2008, 04:25 AM
The reason he flickers is because of how sideview gravity is coded. I might make a slight change in that regard. Otherwise, use this:



const float GRAVITY = 0.16;

// Use Slow Walk combos for the ladder.
ffc script SideviewLadder {
void run {
if (Screen->ComboT[ComboAt(Link->X, Link->Y+15)]==CT_WALKSLOW)
{
Link->Jump = GRAVITY; // Negate gravity
if (Link->InputUp && WalkableAt(Link->X+16, Link->Y+8) && WalkableAt(Link->X, Link->Y+8))
Link->Y-=1;
else if (Link->InputDown && WalkableAt(Link->X, Link->Y+16) && WalkableAt(Link->X+16, Link->Y+16))
Link->Y+=1;
if (WalkableAt(Link->X, Link->Y+16)) {
Link->InputA = false;
Link->InputB = false;
// Change tiles
}
}
}
}
You'll also need the WalkableAt method (or similar) defined somewhere.

// Determines whether a coordinate is walkable.
bool WalkableAt(int x, int y)
{
int x2 = Link->X % 16;
int y2 = Link->Y % 16;
int mask;

if (x2 >= 8)
mask = 1;
else
mask = 2;
if (y2 >= 8)
mask << 2;
return ((Screen->ComboS[ComboAt(x,y)] & mask)==0);
}
I might add WalkableAt to std.zh soon.

Joe123
10-09-2008, 09:13 AM
I might add WalkableAt to std.zh soon.

If you do, would you mind calling it isSolid rather than WalkableAt?

_L_
10-10-2008, 01:54 AM
Well, if you insist.