Jump to content

Photo

LA style sideview ladders?


  • Please log in to reply
40 replies to this topic

#16 Isdrakthül

Isdrakthül

    Apprentice

  • Members

Posted 23 July 2011 - 06:09 PM

Oops. It is now fixed.

#17 Old-Skool

Old-Skool

    Hero of Time

  • Members
  • Location:Missouri

Posted 23 July 2011 - 06:36 PM

looks good, Isdrakthul! It's far more useable this way, however it still has problems when performing a scrolling warp to another screen. Link will let go of the ladder automatically once he's done scrolling over, and then will just fall back down.

Also, I'm having trouble using my other global script with this: one which turns Counters script2 and script3 into life and magic counters. Where were other global scripts supposed to fit in with this? I applied it once right after "void run - while(true)", but this caused the ladder to behave incorrectly. I tried placing it later in that same set, only to have the counters not count!

Edited by King Aquamentus, 23 July 2011 - 06:54 PM.


#18 Isdrakthül

Isdrakthül

    Apprentice

  • Members

Posted 23 July 2011 - 07:56 PM

I'll look into the scrolling warp issue. As for the issue with the other scripts, it should work with others. If you don't mind making your script file available to me, I might be able to find the problem.

#19 Old-Skool

Old-Skool

    Hero of Time

  • Members
  • Location:Missouri

Posted 23 July 2011 - 11:04 PM

QUOTE(Isdrakthül @ Jul 23 2011, 07:56 PM) View Post

I'll look into the scrolling warp issue. As for the issue with the other scripts, it should work with others. If you don't mind making your script file available to me, I might be able to find the problem.


Next time I get to working on it, I'll try and remember to do that. Thanks for everything, Isdrakthul. icon_smile.gif

and Blackbishop

#20 Isdrakthül

Isdrakthül

    Apprentice

  • Members

Posted 24 July 2011 - 10:52 AM

You're welcome.

I think I may have eliminated the problem, altough it's hard for me to tell since I'm not experiencing it.

#21 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 24 July 2011 - 06:55 PM

Can you modify the script so that Link will only face one direction while he is climbing up or down the ladder like in LA?

#22 Isdrakthül

Isdrakthül

    Apprentice

  • Members

Posted 24 July 2011 - 07:07 PM

Well, King Aquamentus requested that, but I'm having a problem with it. The Waitdraw() required to set Link's direction creates a fairly serious glitch while scrolling. I think I may have to wait until I get to the computer that has a script I wrote a while back on it to make a working version, although I just had an idea that might fix it. EDIT: My idea did not work.

Basically, yes, but it could be a week or so.

Edited by Isdrakthül, 24 July 2011 - 08:53 PM.


#23 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 24 July 2011 - 08:33 PM

Ah it's no biggie. The script is already effective as is. Excellent work icon_smile.gif

#24 King Harkinian

King Harkinian

    This site is still a thing?

  • Members
  • Real Name:THE KING
  • Location:Hyrule

Posted 24 July 2011 - 09:04 PM

I actually found a really old script that does this.

http://zctut.com/ladder.php

But this is from 2008, and Zscript has improved so much from this, that it might not even compile.

#25 Old-Skool

Old-Skool

    Hero of Time

  • Members
  • Location:Missouri

Posted 24 July 2011 - 10:30 PM

QUOTE(Christian @ Jul 24 2011, 08:33 PM) View Post

Ah it's no biggie. The script is already effective as is. Excellent work icon_smile.gif


Of interesting note, my request has Link facing downward, so he appears to be on an elevator, looking at you. I'm assuming you want him facing northward, but it shouldn't be that big a deal to change. icon_razz.gif

#26 Isdrakthül

Isdrakthül

    Apprentice

  • Members

Posted 25 July 2011 - 10:19 AM

I got it to work, although it now requires a bit more in the way of setup.

This version sets Link's direction to down and uses flags instead of combos (per King Aquamentus' request):
CODE

int scrolltile = 31264;

int SaveX;
int SaveY;
int SaveS;
int SaveM;
bool WasOnLadder = false;

bool HookGrab(){
    int HSFor;
    for(HSFor = 1; HSFor <= Screen->NumLWeapons(); HSFor++){
        lweapon HSCheck = Screen->LoadLWeapon(HSFor);
        if(HSCheck->ID == LW_HOOKSHOT && Screen->ComboT[ComboAt (HSCheck->X, HSCheck->Y)] == CT_HSGRAB || Screen->ComboT[ComboAt (HSCheck->X+15, HSCheck->Y)] == CT_HSGRAB || Screen->ComboT[ComboAt (HSCheck->X, HSCheck->Y+15)] == CT_HSGRAB || Screen->ComboT[ComboAt (HSCheck->X+15, HSCheck->Y+15)] == CT_HSGRAB){
            return(true);
        }
    }
    return(false);
}

bool OnLadder()
{
    if(ComboFI(Link->X, Link->Y+8, CF_SCRIPT1) || ComboFI(Link->X+15, Link->Y+8, CF_SCRIPT1) || ComboFI(Link->X, Link->Y+17, CF_SCRIPT1) || ComboFI(Link->X+15, Link->Y+17, CF_SCRIPT1)){
        return(true);
    }
    return(false);
}

bool OnLadderDown()
{
    if(!ComboFI(Link->X, Link->Y+8, CF_SCRIPT1) && !ComboFI(Link->X+15, Link->Y+8, CF_SCRIPT1) && (ComboFI(Link->X, Link->Y+17, CF_SCRIPT1) || ComboFI(Link->X+15, Link->Y+17, CF_SCRIPT1))){
        return(true);
    }
    return(false);
}

bool isLSolidHorz(int y)
{
    int x;
    for(x=Link->X; x<=Link->X+16; x+=8)
    {
        if(x==Link->X+16) x--;
        if(Screen->isSolid(x, y)) return(true);
    }
    return(false);
}

bool isFiringHS(){
    int HSFor;
    for(HSFor = 1; HSFor <= Screen->NumLWeapons(); HSFor++){
        lweapon HSCheck = Screen->LoadLWeapon(HSFor);
        if(HSCheck->ID == LW_HOOKSHOT){
            return(true);
        }
    }
    return(false);
}

bool isJumping(){
    if((GetEquipmentA() == I_ROCSFEATHER && Link->InputA == true) || (GetEquipmentB() == I_ROCSFEATHER && Link->InputB == true) || Link->Jump > 1){
        return(true);
    }
    return(false);
}

bool aboutToScroll(){
    if(Link->Y<=1 && Link->InputUp) return true;
    else if(Link->Y>=159 && Link->InputDown) return true;
    else if(Link->X<=1 && Link->InputLeft) return true;
    else if(Link->X>=239 && Link->InputRight) return true;
    else return false;
}

global script Slot2{
    void run(){
    while(true){
        if(Game->GetCurDMapScreen()!=SaveS || Game->GetCurDMap()!=SaveM){
            Link->Invisible=false;
            while(Link->Action==LA_SCROLLING){ //Waitframes(49);
                if(OnLadder() == true && HookGrab() == false && isJumping() == false){
                    Waitdraw();
                    Link->Dir=DIR_DOWN;
                }
                Waitframe();
            }
            SaveX=Link->X;
            SaveY=Link->Y;
        }
        if(OnLadder() == true && HookGrab() == false && isJumping() == false){
            if(WasOnLadder == false){
                Link->Jump = 1;
                if(OnLadderDown()){
                    Link->Y++;
                    SaveY = Link->Y;
                }
            }
            else{
                Link->Jump = 0;
            }
            if(!isFiringHS()){
                if(Link->InputUp == true && !isLSolidHorz(Link->Y+7)){
                    SaveY--;
                }
                else if(Link->InputDown == true && !isLSolidHorz(Link->Y+16)){
                    SaveY++;
                }
                if(Link->InputLeft == true && !Screen->isSolid(Link->X-1, Link->Y+8) && !Screen->isSolid(Link->X-1, Link->Y+15)){
                    SaveX--;
                }
                else if(Link->InputRight == true && !Screen->isSolid(Link->X+16, Link->Y+8) && !Screen->isSolid(Link->X+16, Link->Y+15)){
                    SaveX++;
                }
            }
            Link->X = SaveX;
            Link->Y = SaveY;
            WasOnLadder = true;
            SaveS=Game->GetCurDMapScreen();
            SaveM=Game->GetCurDMap();
            if(!aboutToScroll()){
                Waitdraw();
                Link->Dir=DIR_DOWN;
            }
            else{
                Link->Invisible=true;
                Screen->FastTile(3, Link->X, Link->Y, scrolltile, 6, 128);
            }
        }
        else{
            if(WasOnLadder == true){
                Link->Jump = 0;
                WasOnLadder = false;
            }
            SaveX = Link->X;
            SaveY = Link->Y;
        }
        SaveS=Game->GetCurDMapScreen();
        SaveM=Game->GetCurDMap();
        Waitframe();
    }
    }
}

item script Roc{
    void run(){
        if(OnLadder() == true){
            Link->Jump = 3;
        }
    }
}

item script NewScrollTile{
    void run(int newtile){
        scrolltile = newtile;
    }
}

This version uses combos and sets the direction to up:
CODE

int scrolltile = 31260;

int SaveX;
int SaveY;
int SaveS;
int SaveM;
bool WasOnLadder = false;

bool HookGrab(){
    int HSFor;
    for(HSFor = 1; HSFor <= Screen->NumLWeapons(); HSFor++){
        lweapon HSCheck = Screen->LoadLWeapon(HSFor);
        if(HSCheck->ID == LW_HOOKSHOT && Screen->ComboT[ComboAt (HSCheck->X, HSCheck->Y)] == CT_HSGRAB || Screen->ComboT[ComboAt (HSCheck->X+15, HSCheck->Y)] == CT_HSGRAB || Screen->ComboT[ComboAt (HSCheck->X, HSCheck->Y+15)] == CT_HSGRAB || Screen->ComboT[ComboAt (HSCheck->X+15, HSCheck->Y+15)] == CT_HSGRAB){
            return(true);
        }
    }
    return(false);
}

bool OnLadder()
{
    if(Screen->ComboT[ComboAt (Link->X, Link->Y+8)] == CT_SCRIPT1 || Screen->ComboT[ComboAt (Link->X+15, Link->Y+8)] == CT_SCRIPT1 || Screen->ComboT[ComboAt (Link->X, Link->Y+17)] == CT_SCRIPT1 || Screen->ComboT[ComboAt (Link->X+15, Link->Y+17)] == CT_SCRIPT1){
        return(true);
    }
    return(false);
}

bool OnLadderDown()
{
    if(Screen->ComboT[ComboAt (Link->X, Link->Y+8)] != CT_SCRIPT1 && Screen->ComboT[ComboAt (Link->X+15, Link->Y+8)] != CT_SCRIPT1 && (Screen->ComboT[ComboAt (Link->X, Link->Y+17)] == CT_SCRIPT1 || Screen->ComboT[ComboAt (Link->X+15, Link->Y+17)] == CT_SCRIPT1)){
        return(true);
    }
    return(false);
}

bool isLSolidHorz(int y)
{
    int x;
    for(x=Link->X; x<=Link->X+16; x+=8)
    {
        if(x==Link->X+16) x--;
        if(Screen->isSolid(x, y)) return(true);
    }
    return(false);
}

bool isFiringHS(){
    int HSFor;
    for(HSFor = 1; HSFor <= Screen->NumLWeapons(); HSFor++){
        lweapon HSCheck = Screen->LoadLWeapon(HSFor);
        if(HSCheck->ID == LW_HOOKSHOT){
            return(true);
        }
    }
    return(false);
}

bool isJumping(){
    if((GetEquipmentA() == I_ROCSFEATHER && Link->InputA == true) || (GetEquipmentB() == I_ROCSFEATHER && Link->InputB == true) || Link->Jump > 1){
        return(true);
    }
    return(false);
}

bool aboutToScroll(){
    if(Link->Y<=1 && Link->InputUp) return true;
    else if(Link->Y>=159 && Link->InputDown) return true;
    else if(Link->X<=1 && Link->InputLeft) return true;
    else if(Link->X>=239 && Link->InputRight) return true;
    else return false;
}

global script Slot2{
    void run(){
    while(true){
        if(Game->GetCurDMapScreen()!=SaveS || Game->GetCurDMap()!=SaveM){
            Link->Invisible=false;
            while(Link->Action==LA_SCROLLING){ //Waitframes(49);
                if(OnLadder() == true && HookGrab() == false && isJumping() == false){
                    Waitdraw();
                    Link->Dir=DIR_UP;
                }
                Waitframe();
            }
            SaveX=Link->X;
            SaveY=Link->Y;
        }
        if(OnLadder() == true && HookGrab() == false && isJumping() == false){
            if(WasOnLadder == false){
                Link->Jump = 1;
                if(OnLadderDown()){
                    Link->Y++;
                    SaveY = Link->Y;
                }
            }
            else{
                Link->Jump = 0;
            }
            if(!isFiringHS()){
                if(Link->InputUp == true && !isLSolidHorz(Link->Y+7)){
                    SaveY--;
                }
                else if(Link->InputDown == true && !isLSolidHorz(Link->Y+16)){
                    SaveY++;
                }
                if(Link->InputLeft == true && !Screen->isSolid(Link->X-1, Link->Y+8) && !Screen->isSolid(Link->X-1, Link->Y+15)){
                    SaveX--;
                }
                else if(Link->InputRight == true && !Screen->isSolid(Link->X+16, Link->Y+8) && !Screen->isSolid(Link->X+16, Link->Y+15)){
                    SaveX++;
                }
            }
            Link->X = SaveX;
            Link->Y = SaveY;
            WasOnLadder = true;
            SaveS=Game->GetCurDMapScreen();
            SaveM=Game->GetCurDMap();
            if(!aboutToScroll()){
                Waitdraw();
                Link->Dir=DIR_UP;
            }
            else{
                Link->Invisible=true;
                Screen->FastTile(3, Link->X, Link->Y, scrolltile, 6, 128);
            }
        }
        else{
            if(WasOnLadder == true){
                Link->Jump = 0;
                WasOnLadder = false;
            }
            SaveX = Link->X;
            SaveY = Link->Y;
        }
        SaveS=Game->GetCurDMapScreen();
        SaveM=Game->GetCurDMap();
        Waitframe();
    }
    }
}

item script Roc{
    void run(){
        if(OnLadder() == true){
            Link->Jump = 3;
        }
    }
}

item script NewScrollTile{
    void run(int newtile){
        scrolltile = newtile;
    }
}


For both versions, int scrolltile is a tile of Link facing his assigned direction. item script NewScrollTile is a pickup script that sets scrolltile to the desired number, which is set by D0.

Edited by Isdrakthül, 26 July 2011 - 09:17 AM.


#27 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 25 July 2011 - 01:39 PM

Sorry if this comment is out of date, but the main reason I didn't use your ladder
script before was that it was really difficult to get off of the ladder to an adjacent
unwalkable combo. I needed Link to stand "on top" of the ladder.

Edited by Cukeman, 25 July 2011 - 01:40 PM.


#28 Isdrakthül

Isdrakthül

    Apprentice

  • Members

Posted 25 July 2011 - 02:47 PM

I've updated the scripts to fix that. King Aquamentus, I did not update yours because, as I understand it, it would not make sense for Link to be able to stand on top of the ladder combo given the use to which you are putting it. If it should be updated, please let me know.

#29 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 25 July 2011 - 05:55 PM

Mind on explaining a bit more on the item part? Link seems to feel forced when he is climbing down the ladder and the animation of him actually climbing down the ladder doesn't seem to show.

Edited by Christian, 25 July 2011 - 05:55 PM.


#30 Isdrakthül

Isdrakthül

    Apprentice

  • Members

Posted 25 July 2011 - 06:18 PM

The item is the rough equivalent of a LTM. It allows you to update the tile to match any shields, etc. Link gets.
The tile itself is just for the frame directly before Link begins to scroll. I can't set Link's direction in that frame, so I needed to add it to prevent Link from turning to face a different direction for a moment.

I'm not entirely sure what you mean by the second sentence, though. I'll test it and see if I experience any glitches that could be described along those lines. EDIT: I tested it and it appears to be working.

Edited by Isdrakthül, 25 July 2011 - 06:26 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users