Jump to content

Photo

Trouble with Swimming


  • Please log in to reply
1 reply to this topic

#1 AgentLym

AgentLym

    • Zelda and Pokémon Master •

  • Members
  • Location:Skyloft

Posted 18 May 2008 - 08:39 AM

QUOTE
Well, Link kinda swims... (I am using build 798)

I have made this river (obviously swimmable). You can go into the water, but when you sit still, there is no animation for Link. He just sits there with a water ring around him. That's not right.

Also, when you try to move while in the water, Link's sprite alternately switches between his walking and swimming animation each frame. So it looks like Link is being jerked in and out of the water... constantly.

And what's weirder is that you can use items while you're swimming! I don't know why/how/what caused the problem. All I can think the problem could spawn from is:

1) I have altered the Gravity constants. I need too; otherwise, the Roll script I have will not work.
2) I have a global script (besides the roll script which is also global) in my quest... Here both of them are, but I doubt they are the problem...
CODE
global script main_script {
    void run() {
    while(true) {
//Put other global scripts here

if (hold_time == 0) {Link->Action = 0;} else {hold_time -= 1;}
Waitframe();
}
}
}
//======================
bool isSolid(int x, int y) {

    // x=23, y=130
    // Obviously in range...
    if(x<0 || x>255 || y<0 || y>175)
                    return false;
    int mask=1111b;
        
    // x % 16 = 7, so
    // mask = 1111 & 0011 = 0011
    if(x%16<8)
        mask&=0011b;
    else
        mask&=1100b;
    
    // y % 16 = 2, so
    // mask = 0011 & 0101 = 0001
    if(y%16<8)
        mask&=0101b;
    else
        mask&=1010b;

    // All but the top-right quarter of the combo is solid, so ComboS = 1011
    // mask & ComboS = 0001 & 1011 = 0001
    // The result wasn't 0, so return false
    return (!(Screen->ComboS[ComboAt(x, y)]&mask)==0);

}



global script roll {

    void run() {

        int counter;
        bool justRolled = false;
        int DustTile = 20; //the starting animation tile of the 5-frame dust animation.
        int DustCSet = 7; //the CSet of the tile animation.
        int xca; int xcb; int xcc; int xcd; int xce;
        int yca; int ycb; int ycc; int ycd; int yce;
        int DustFrame;

        while(true) {

            if(Link->InputL && Link->Action == LA_WALKING) {

                Link->Jump = 2;
                counter = 20;
                DustFrame = 1;
                xca = -1;
                xcb = -1;
                xcc = -1;
                xcd = -1;
                xce = -1;
                yca = -1;
                ycb = -1;
                ycc = -1;
                ycd = -1;
                yce = -1;
                Game->PlaySound(66); //Change/Disable SFX if needed

                while(counter > 0) {

                    Link->Z = 0;
                    Link->InputUp = false;
                    Link->InputDown = false;
                    Link->InputLeft = false;
                    Link->InputRight = false;
                    Link->InputA = false;
                    Link->InputB = false;
                    Link->InputR = false;
                    Link->InputL = false;

                    if(Floor(counter/2) == counter/2) { //trigger animation every other frame

                        xce = xcd;
                        xcd = xcc;
                        xcc = xcb;
                        xcb = xca;

                        yce = ycd;
                        ycd = ycc;
                        ycc = ycb;
                        ycb = yca;

                        xca = Link->X;
                        yca = Link->Y;

                        if(DustFrame >= 5) {

                            xca = -1;
                            yca = -1;

                        }

                        DustFrame ++;

                    }

                    if(!(xca == -1) && !(yca == -1)) {Screen->DrawTile(2, xca, yca, DustTile, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
                    if(!(xcb == -1) && !(ycb == -1)) {Screen->DrawTile(2, xcb, ycb, DustTile + 1, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
                    if(!(xcc == -1) && !(ycc == -1)) {Screen->DrawTile(2, xcc, ycc, DustTile + 2, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
                    if(!(xcd == -1) && !(ycd == -1)) {Screen->DrawTile(2, xcd, ycd, DustTile + 3, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
                    if(!(xce == -1) && !(yce == -1)) {Screen->DrawTile(2, xce, yce, DustTile + 4, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}

                    if(Link->Dir == DIR_UP) {

                        if(!isSolid(Link->X+4, Link->Y+6) && !isSolid(Link->X+12, Link->Y+6) && (Screen->ComboF[ComboAt(Link->X+8, Link->Y+6)] != 98)) {Link->Y -= 2;}

                    } else if(Link->Dir == DIR_DOWN) {

                        if(!isSolid(Link->X+4, Link->Y+18) && !isSolid(Link->X+12, Link->Y+18) && (Screen->ComboF[ComboAt(Link->X+8, Link->Y+18)] != 98)) {Link->Y += 2;}

                    } else if(Link->Dir == DIR_LEFT) {

                        if(!isSolid(Link->X-2, Link->Y+12) && (Screen->ComboF[ComboAt(Link->X-2, Link->Y+4)] != 98)) {Link->X -= 2;}

                    } else if (Link->Dir == DIR_RIGHT) {

                        if(!isSolid(Link->X+18, Link->Y+12) && (Screen->ComboF[ComboAt(Link->X+18, Link->Y+4)] != 98)) {Link->X += 2;}

                    } //end if

                counter --;
                justRolled = true;

                Waitframe();

                } //end while

            } //end if

        if(justRolled) {

            Link->Jump = 0;
            justRolled = false;

        }

        Link->InputL = false;

        Waitframe();

        } //end while

    } //end void run

} //end script

Both of those codes are not mine, by the way. They are made by ShadowMancer and Beefster, respectively.

And I have not put in any other scripts, whether they be FFC or Item, into my quest yet.
I haven't read of any problems that have to do with swimming concerning these two scripts, but you never know.

The third problem could be:

A bug. An annoying and needless bug.

Any help would be greatly appreciated, and why would there be a bug where there has not been one? I don't know either.


That was my post from Quest Editor. But I think I may have found another thing that could be the problem...

That 'main_script' at the top of the code is supposed to contain all your global scripts (so that stuff will happen while the advanced shop script runs [I got the main_script from the advanced shop script made by ShadowMancer] ... It's at AGN if anyone wants to look at the whole thing)

Just imagine that whole Roll script inside the 'main_script'. It doesn't compile. I don't know why.

I tried taking out the 'main_script' but Link still can't swim.

And another break-through I found out: Link does NOT roll! He used to. I don't know why he doesn't now.

Any help!? I am rather overwhelmed by this whole problem and very confused... Any help at all would be immensely appreciated!!

Edited by AgentLym, 18 May 2008 - 08:41 AM.


#2 AgentLym

AgentLym

    • Zelda and Pokémon Master •

  • Members
  • Location:Skyloft

Posted 18 May 2008 - 12:20 PM

Sorry for the double post, but I found my own problem!

The problem was with my 'main_script' global script. I don't know why or how, but I narrowed it down till I finally found the answer! icon_razz.gif


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users