Jump to content

Photo

Updated Pegasus Boots Script


  • Please log in to reply
68 replies to this topic

#31 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Location:Minas Gerais, Brazil

Posted 01 January 2015 - 10:05 AM

My test file is updated again:

https://dl.dropboxus...me_testfile.rar

 

Well, I think the script is now 100% ready to send to the database. Or is missing something?



#32 justin

justin

    Adept

  • Members

Posted 01 January 2015 - 10:13 AM

i still have the flipper bug where Link dives (?) when dashing into water.  and i'd like to do a bit more testing.  but ya, i think it is getting really close.



#33 ywkls

ywkls

    Master

  • Members

Posted 01 January 2015 - 11:15 AM

I combined the script you sent me with your revisions on changing the shattered flag 98 block to the under combo and everything seems to work. Strangely enough, although I have my water set to walkable and the rule active where Link drowns in walkable water; he just stops directly on top of the water and only drowns when I try to move. Otherwise, it works fine including the section that makes it compatible with pits and lava. One combo type people may use that you left out was CT_SLASHNEXTITEM. So I added it into the correct sections.


                int loc = ComboAt(TouchedX()+InFrontX(mysword->Dir,4),TouchedY()+InFrontY(mysword->Dir,4));
                bool playsound = true;
                if(Screen->ComboT[loc] == CT_BUSH) Screen->ComboD[loc] = Screen->UnderCombo;
                else if(Screen->ComboT[loc] == CT_TALLGRASS) Screen->ComboD[loc] = Screen->UnderCombo;
                else if(Screen->ComboT[loc] == CT_BUSHNEXT) Screen->ComboD[loc] += 1;
                else if(Screen->ComboT[loc] == CT_TALLGRASSNEXT) Screen->ComboD[loc] += 1;
                else if(Screen->ComboT[loc] == CT_SLASHNEXTITEM) Screen->ComboD[loc] += 1;
                else playsound = false;
if(Screen->ComboT[loc] == CT_BUSH || Screen->ComboT[loc] == CT_TALLGRASS ||
Screen->ComboT[loc] == CT_BUSHNEXT || Screen->ComboT[loc] == CT_TALLGRASSNEXT || Screen->ComboT[loc] == CT_SLASHNEXTITEM) 
return true;

For those trying to use this, find the lines that include everything I listed but CT_SLASHNEXTITEM and add in the relevant code. I don't think there's any point in including flowers, Slash->Item or plain slash combos since bushes and flowers are almost the same thing and Slash->Next (Item) is easier to set up and far superior to the other slash combo types.



#34 justin

justin

    Adept

  • Members

Posted 01 January 2015 - 11:48 AM

Oh, did you set the CanDrown variable to true?

And I was thinking of adding the rest of the slash combo types.

I did a forum search to try and figure out when the Roc item was added to the Pegasus script, but couldn't find it. So if anyone knows where it came from or how to set it up please let me know.

I did find the Zephino was the one who updated the original script with the sword hold out code.

#35 ywkls

ywkls

    Master

  • Members

Posted 01 January 2015 - 12:13 PM

Yeah, I've got it just after 'const int NPC_ITEMSET' (where I tell the game which enemy to use for the item to be dropped). By the way, I wasn't sure if I needed to give that Dummy enemy any HP or just leave it at Zero. If you like, I could post or send you a copy of my revised code so you can see what it looks like now and maybe together we can figure out why I'm not drowning when I run into water even though I should be. As for the Roc's feather stuff, the copy of the code I originally posted came from a downloadable file which contained a partially finished quest which used the code (presumably they got it from Zepinho's code).

 

I haven't been able to find the thread where I got that link again and I no longer have the files related to that download, but I think that the download was created by MoscowModder as help to someone on that thread. And even he said that the quest in question was made for someone else (and I don't remember who that was, other than the person who posted the link said they had disappeared from the site). If it helps finding it (and I don't know that it will) the quest in question was called 'The Magic Instruments.' I know this doesn't help figure out who originated the Roc's Feather stuff, but unless you can equip items to both buttons or jump with L, R or one of the EX buttons; you probably won't be using both at the same time. But if you wanted to... then somebody would definitely need to set up that code.


Edited by ywkls, 01 January 2015 - 12:13 PM.


#36 justin

justin

    Adept

  • Members

Posted 01 January 2015 - 01:08 PM

Yeah, I've got it just after 'const int NPC_ITEMSET' (where I tell the game which enemy to use for the item to be dropped). By the way, I wasn't sure if I needed to give that Dummy enemy any HP or just leave it at Zero. If you like, I could post or send you a copy of my revised code so you can see what it looks like now and maybe together we can figure out why I'm not drowning when I run into water even though I should be. As for the Roc's feather stuff, the copy of the code I originally posted came from a downloadable file which contained a partially finished quest which used the code (presumably they got it from Zepinho's code).

 

I haven't been able to find the thread where I got that link again and I no longer have the files related to that download, but I think that the download was created by MoscowModder as help to someone on that thread. And even he said that the quest in question was made for someone else (and I don't remember who that was, other than the person who posted the link said they had disappeared from the site). If it helps finding it (and I don't know that it will) the quest in question was called 'The Magic Instruments.' I know this doesn't help figure out who originated the Roc's Feather stuff, but unless you can equip items to both buttons or jump with L, R or one of the EX buttons; you probably won't be using both at the same time. But if you wanted to... then somebody would definitely need to set up that code.

 

ya, send me the file.  i didn't actually test the code i pm'd you, but it was just the same code i had tested minus those extra scripts accel2me is trying to combine.  so i can't see it being an issue.

 

i think the hp should be 0, or maybe 1.  the script kills it right after spawning.  that part isn't setup right in the test quest i'm using.  

 

thanks for the Magical Instruments lead.  i'll see if i can find anything there.



#37 ywkls

ywkls

    Master

  • Members

Posted 01 January 2015 - 03:10 PM

ya, send me the file.  i didn't actually test the code i pm'd you, but it was just the same code i had tested minus those extra scripts accel2me is trying to combine.  so i can't see it being an issue.

 

i think the hp should be 0, or maybe 1.  the script kills it right after spawning.  that part isn't setup right in the test quest i'm using.  

 

thanks for the Magical Instruments lead.  i'll see if i can find anything there.

 

I've sent you a PM through the one you sent me with my current code. This includes the hole/lava ffc script I have. The question is, where is bool CanDrown defined? I mean,  I know the code sets it to true but is that enough to make it work properly? The hole/lava generates a sprite WSP_FALLING when you fall in a pit and another when you enter lava. Would it be necessary to have the Pegasus Boots script do the same whenever it contacts water. The script is perfectly useable as it is now, but it is details of minor improvements like these that have bothered me since I learned how to code the most basic of programs when I was in school. I did try to learn C++ once... and I am picking up some Zscript, slowly but surely... but I know I still have a long ways to go.


Edited by ywkls, 01 January 2015 - 03:11 PM.


#38 justin

justin

    Adept

  • Members

Posted 01 January 2015 - 04:39 PM

@ywkls, pm with working code sent.  ignore this below because i'm just gonna say the same thing...

 

New version of the Utilities.z script below.  Updates:

- fixed immediate dive bug when dashing into water with flippers

- added more functionality to dash-slash combo code.  

   . new constants for different slash sprites.

   . more slashcombo types each using the correct slash sprite, and item set. 

   . see the CanDashSlash and DoDashSlash functions, and read the comments for more customization

 

Additionally, i figured out the Roc item code.  Thanks for The Magic Instruments tip ywkls - the demo is still online and unpassworded.  If you can equip to A and B, you can have the Pegasus and Roc item's work together to jump further when dashing.  Setup a custom item, Roc class, Level 2, Height2.  Set the constant I_ROCSFEATHER_INCREASER to the correct item#.  (And make sure your regular Roc Feather is its default item# 91).  That's it.

 

Add this to constants.z

// set these to whatever sprites they should correspond to
// sprites with 0 for either NumFrames or AniSpeed will not show.
const int SPRITE_BUSH_CUT = 52;
const int SPRITE_FLOWER_CUT = 53;
const int SPRITE_GRASS_CUT = 54;

[hidden]

 
 
// ====================================================================================================================================================================================
// UTILITIES
// ====================================================================================================================================================================================
 
bool SelectPressInput(int input){
    if(input == 0) return Link->PressA;
    else if(input == 1) return Link->PressB;
    else if(input == 2) return Link->PressL;
    else if(input == 3) return Link->PressR;
}
 
void SetInput(int input, bool state){
    if(input == 0) Link->InputA = state;
    else if(input == 1) Link->InputB = state;
    else if(input == 2) Link->InputL = state;
    else if(input == 3) Link->InputR = state;
}
 
// ..................................................................................................................................................................
 
float DistanceLink(float x, float y){
    return Distance(CenterLinkX(), CenterLinkY(), x, y);
}
 
float DistanceLink(ffc f){
    return Distance(CenterLinkX(), CenterLinkY(), CenterX(f), CenterY(f));
}
 
float DistanceLink(npc n){
    return Distance(CenterLinkX(), CenterLinkY(), CenterX(n), CenterY(n));
}
 
float DistanceLink(lweapon l){
    return Distance(CenterLinkX(), CenterLinkY(), CenterX(l), CenterY(l));
}
 
float DistanceLink(eweapon e){
    return Distance(CenterLinkX(), CenterLinkY(), CenterX(e), CenterY(e));
}
 
// ..................................................................................................................................................................
 
void Update_HoleLava(int x, int y, int dmap, int scr, int dir){
    lweapon hookshot = LoadLWeaponOf(LW_HOOKSHOT);
    if(hookshot->isValid()) return;
 
    if(Falling)
    {
    PegasusDash = false;
 
        if(IsSideview()) Link->Jump=0;
        Falling--;
        if(Falling == 1)
        {
            int buffer[] = "Holelava";
            if(CountFFCsRunning(Game->GetFFCScript(buffer)))
            {
                ffc f = Screen->LoadFFC(FindFFCRunning(Game->GetFFCScript(buffer)));
                Warping = true;
                if(f->InitD[1]==0)
                {
                    f->InitD[6] = x;
                    f->InitD[7] = y;
                }
            }
            else
            {
                Link->X = x;
                Link->Y = y;
                Link->Dir = dir;
                Link->DrawXOffset -= Cond(Link->DrawXOffset < 0, -1000, 1000);
                Link->HitXOffset -= Cond(Link->HitXOffset < 0, -1000, 1000);
                Link->HP -= HOLELAVA_DAMAGE;
                Link->Action = LA_GOTHURTLAND;
                Link->HitDir = -1;
                Game->PlaySound(SFX_OUCH);
                if(Game->GetCurDMap()!=dmap || Game->GetCurDMapScreen()!=scr)
                    Link->PitWarp(dmap, scr);
            }
            NoAction();
            Link->Action = LA_NONE;
        }
    }
    else if(Link->Z==0 && OnPitCombo() && !Warping)
    {
    PegasusDash = false;
 
        Link->DrawXOffset += Cond(Link->DrawXOffset < 0, -1000, 1000);
        Link->HitXOffset += Cond(Link->HitXOffset < 0, -1000, 1000);
        int comboflag = OnPitCombo();
        SnaptoGrid();
        Game->PlaySound(Cond(comboflag == CF_PIT, SFX_LINK_FALL, SFX_LINK_LAVA));
        lweapon dummy = CreateLWeaponAt(LW_SCRIPT10, Link->X, Link->Y);
        dummy->UseSprite(Cond(comboflag == CF_PIT, WPS_LINK_FALL, WPS_LINK_LAVA));
        dummy->DeadState = dummy->NumFrames*dummy->ASpeed;
        dummy->DrawXOffset = 0;
        dummy->DrawYOffset = 0;
        Falling = dummy->DeadState;
        NoAction();
        Link->Action = LA_NONE;
    }
}
 
 
int OnPitCombo(){
    int comboLoc = ComboAt(Link->X+8, Link->Y + Cond(BIG_LINK==0, 12, 8));
    if(Screen->ComboT[comboLoc] != CT_HOLELAVA)
        return 0;
    else if(Screen->ComboI[comboLoc] == CF_PIT || Screen->ComboI[comboLoc] == CF_LAVA)
        return Screen->ComboI[comboLoc];
    else if(Screen->ComboF[comboLoc] == CF_PIT || Screen->ComboF[comboLoc] == CF_LAVA)
        return Screen->ComboF[comboLoc];
    else
        return 0;
}
 
 
void SnaptoGrid(){
    int x = Link->X;
    int y = Link->Y + Cond(BIG_LINK==0, 8, 0);
    int comboLoc = ComboAt(x, y);
 
    //X Axis
    if(Screen->ComboT[comboLoc] == CT_HOLELAVA && Cond(x % 16 == 0, true, Screen->ComboT[comboLoc+1] != CT_HOLELAVA))
        Link->X = ComboX(comboLoc);
    else if(Screen->ComboT[comboLoc+1] == CT_HOLELAVA && Cond(x % 16 == 0, true, Screen->ComboT[comboLoc] != CT_HOLELAVA))
        Link->X = ComboX(comboLoc+1);
    if(Cond(y % 16 == 0, false, Screen->ComboT[comboLoc+16] == CT_HOLELAVA) && Cond(x % 16 == 0, true, Screen->ComboT[comboLoc+17] != CT_HOLELAVA))
        Link->X = ComboX(comboLoc+16);
    else if(Cond(y % 16 == 0, false, Screen->ComboT[comboLoc+17] == CT_HOLELAVA) && Cond(x % 16 == 0, true, Screen->ComboT[comboLoc+16] != CT_HOLELAVA))
        Link->X = ComboX(comboLoc+17);
 
    //Y Axis
    if(Screen->ComboT[comboLoc] == CT_HOLELAVA && Cond(y % 16 == 0, true, Screen->ComboT[comboLoc+16] != CT_HOLELAVA))
        Link->Y = ComboY(comboLoc);
    else if(Screen->ComboT[comboLoc+16] == CT_HOLELAVA && Cond(y % 16 == 0, true, Screen->ComboT[comboLoc] != CT_HOLELAVA))
        Link->Y = ComboY(comboLoc+16);
    if(Cond(x % 16 == 0, false, Screen->ComboT[comboLoc+1] == CT_HOLELAVA) && Cond(y % 16 == 0, true, Screen->ComboT[comboLoc+17] != CT_HOLELAVA))
        Link->Y = ComboY(comboLoc+1);
    else if(Cond(x % 16 == 0, false, Screen->ComboT[comboLoc+17] == CT_HOLELAVA) && Cond(y % 16 == 0, true, Screen->ComboT[comboLoc+1] != CT_HOLELAVA))
        Link->Y = ComboY(comboLoc+17);
}
 
 
// ..................................................................................................................................................................
 
void PegasusBoots(){
    lweapon mysword;
 
    // this fixes the bug that makes Link dive immediately after dashing into water with flippers
    if(DashCounter < 0){
        DashCounter++;
 
        if(Link->Action == LA_SWIMMING){
            NoAction();
        }else if(Link->Action == LA_DIVING){
            Link->Action == LA_SWIMMING;
            NoAction();
}else{
            DashCounter = 0;
        }
    }
 
    if(PegasusDash){
        if(!PegasusCollision){
            int loc = ComboAt(Link->X+8,Link->Y+8);
            if( ((StoreInput == 1 && !Link->InputA) || (StoreInput == 2 && !Link->InputB)) 
                || StoreHP < Link->HP
                || Link->Action == LA_DROWNING || Link->Action == LA_SWIMMING || Link->Action == LA_DIVING
                || (!CanDrown && Screen->ComboT[TouchedComboLoc()] == CT_WATER) ){
 
                    PegasusDash = false;
                    DashCounter = 0;
 
                    if(Link->Action == LA_SWIMMING) DashCounter = -20;
            }
 
            if( Screen->ComboT[TouchedComboLoc()] == CT_SIDEVIEWLADDER || ComboFI(TouchedX(),TouchedY(),CF_LADDER) ){
                    PegasusDash = false;
                    DashCounter = 0;
            }
 
            
 
            if(!(GetEquipmentA() == I_ROCSFEATHER_INCREASER && Link->InputA) && !(GetEquipmentB() == I_ROCSFEATHER_INCREASER && Link->InputB))
                NoAction();
 
            if(DashCounter > 10){
                if(Link->Dir == DIR_UP && DashCheck(Link->X+8,Link->Y+6,true) != 2){
                    Link->Y--;
                    Link->InputUp = true;
                }
                else if(Link->Dir == DIR_DOWN && DashCheck(Link->X+8,Link->Y+18,true) != 2){
                    Link->Y++;
                    Link->InputDown = true;
                }
                else if(Link->Dir == DIR_LEFT && DashCheck(Link->X,Link->Y+12,false) != 2){
                    Link->X--;
                    Link->InputLeft = true;
                }
                else if(Link->Dir == DIR_RIGHT && DashCheck(Link->X+16,Link->Y+12,false) != 2){
                    Link->X++;
                    Link->InputRight = true;
                }
                else{
                    PegasusCollision = true;
                    DashCounter = 0;
                }
            }//end DashCounter if
 
            if(ComboFI(Link->X+8,Link->Y+8,CF_DASH) && Screen->ComboS[loc] == 1111b){
                Screen->ComboD[loc]=INV_COMBO_ID;
                if(Screen->ComboF[loc] == CF_DASH) Screen->ComboF[loc] = 0;
                Game->PlaySound(SFX_PEGASUSBREAK);
            }
 
            lweapon Dust;
            if(DashCounter%4 == 0){
                for(int j=1;j<=Screen->NumLWeapons();j++){
                    Dust = Screen->LoadLWeapon(j);
                    if(Dust->ID != LW_SCRIPT10) continue;
                    if(Link->Dir < 1) Dust->Y-=3;
                    else if(Link->Dir < 2) Dust->Y+=3;
                    else if(Link->Dir < 3) Dust->X-=3;
                    else if(Link->Dir < 4) Dust->X+=3;
                }//end for loop
                Dust = Screen->CreateLWeapon(LW_SCRIPT10);
                Dust->OriginalTile = T_DUST;
                Dust->CSet = DustCSet;
                Dust->Y = Link->Y+8;
                Dust->X = Link->X;
                Dust->NumFrames = DustAFrames;
                Dust->ASpeed = DustASpeed;
                Dust->DeadState = DustAFrames*DustASpeed;
            }//end dust if
 
            if(DashCounter%DashSFXLength == 0) Game->PlaySound(SFX_DASH);
 
            if(Link->Item[I_ROCSFEATHER] && !Link->Item[I_ROCSFEATHER_INCREASER]){
               Link->Item[I_ROCSFEATHER_INCREASER]=true;
            }
 
        
            if(LinkSwordEquip() > -1 && DashCounter>10){
                mysword = LoadLWeaponOf(LW_SCRIPT3);
                    if(!mysword->isValid()){
                        mysword = Screen->CreateLWeapon(LW_SCRIPT3);
                        mysword->Damage = 8;
                    }
 
                    if(LinkSwordEquip()==I_SWORD4){
                        mysword->UseSprite(SPRITE_SWORD4);
                    }else if(LinkSwordEquip()==I_SWORD3){
                        mysword->UseSprite(SPRITE_SWORD3);
                    }else if(LinkSwordEquip()==I_SWORD2){
                        mysword->UseSprite(SPRITE_SWORD2);
                    }else{
                        mysword->UseSprite(SPRITE_SWORD1);
                    }//end sprite if
       
                    mysword->X = Link->X+InFrontX(Link->Dir, 6);
                    mysword->Y = Link->Y+InFrontY(Link->Dir, 6);
                    mysword->Dir = Link->Dir;
                    if(mysword->Dir < 2){
                        if(mysword->Dir == DIR_DOWN) mysword->Flip = 3;
                    }
                    else{
                        mysword->OriginalTile += 1;
                        mysword->Tile = mysword->OriginalTile;
                        if(mysword->Dir == DIR_LEFT) mysword->Flip = 1;
                        mysword->Y += 3;
                    }//end dir if
 
                    DoDashSlash(ComboAt(TouchedX()+InFrontX(mysword->Dir,4),TouchedY()+InFrontY(mysword->Dir,4)));
               }
               else{
                    Remove(mysword);
               }//end mysword if
        }//end !PegasusCollision if
 
        else{ //is PegasusCollision
            NoAction();
 
            if(DashCounter == 1){
                Screen->ClearSprites(SL_LWPNS);
                 Game->PlaySound(SFX_HITWALL);
                 Screen->Quake = 10;
            }
            else if(DashCounter == 10){
                 PegasusDash = false;
                 PegasusCollision = false;
                 DashCounter = 0;
            }
 
            if(Link->Dir == 0 && DashCheck(Link->X+8,Link->Y+6,true) == 0) Link->Y++;
            else if(Link->Dir == 1 && DashCheck(Link->X+8,Link->Y+18,true) == 0) Link->Y--;
            else if(Link->Dir == 2 && DashCheck(Link->X+18,Link->Y+8,false) == 0) Link->X++;
            else if(Link->Dir == 3 && DashCheck(Link->X-2,Link->Y+8,false) == 0) Link->X--;
 
            if(DashCounter < 5) Link->Z++;
        }// end PegasusCollision if/else
        
        DashCounter++; 
     }// end PegasusDash if
 
    else{ // !PegasusDash
        mysword = LoadLWeaponOf(LW_SCRIPT3);
        Remove(mysword);
        if(Link->Item[I_ROCSFEATHER_INCREASER]) Link->Item[I_ROCSFEATHER_INCREASER]=false;
    }//end PegasusDash if/else
}//end function
 
 
// Check whether Link can dash onto a combo
int DashCheck(int x, int y, bool xy){
    int xoffset; int yoffset;
    bool Solid;
    
    if(xy) xoffset = 4;
    else yoffset = 3;
 
    if(isSolid(x-xoffset,y-yoffset) || isSolid(x+xoffset,y+yoffset)) Solid = true;
 
    if(Solid && CanDashSlash(x,y) ) Solid = false;
 
    if(!Solid && !ComboFI(x-xoffset,y-yoffset,CF_DASH) && !ComboFI(x+xoffset,y+yoffset,CF_DASH)) return 0;
    
    else if(Solid && (ComboFI(x-xoffset,y-yoffset,CF_DASH) || ComboFI(x+xoffset,y+yoffset,CF_DASH))) return 1;
    
    else return 2;
}
 
//fixes a bug where you can't initiate a dash next to a slashable solid combo
bool CanDashSlash(int x, int y){
    if(LinkSwordEquip() == -1) return false;
 
    int loc;
    loc = ComboAt(x, y);
 
    // can add more combo types here by adding     || Screen->ComboT[loc] == CT_ 
    // CT_ types you might consider CT_SLASH, CT_SLASHNEXT, CT_SLASHNEXTITEM if those are solid in your quest
 
    if(Screen->ComboT[loc] == CT_BUSH || Screen->ComboT[loc] == CT_BUSHNEXT ) 
         return true;
 
    return false;
}
 
 
// replaces the code in old Pegasus boots function for dash cutting through slashable combos.
// allows easier customization to suit your needs.
void DoDashSlash(int loc){
   int ctype = Screen->ComboT[loc];
   int sprite;
   int itmset = IS_COMBOS; // item set 12 (tall grass by default)
   
   bool playsound = false;
   
   // add sprites to certain types
   if(ctype == CT_BUSH || ctype == CT_BUSHNEXT) sprite = SPRITE_BUSH_CUT;
   else if(ctype == CT_TALLGRASS || ctype == CT_TALLGRASSNEXT) sprite = SPRITE_GRASS_CUT;
   else if(ctype == CT_FLOWERS) sprite = SPRITE_FLOWER_CUT;
 
   // no sprite is typically associated with Slash type combos, but it could be added.
 
   // itemset is changed here to the default for these types.  could add more item sets based on type
   if(ctype == CT_SLASHITEM || ctype == CT_SLASHNEXTITEM) itmset = 10; // default for these combo types
 
   //these types default to undercombo
   if(ctype == CT_BUSH || ctype == CT_TALLGRASS || ctype == CT_FLOWERS || ctype == CT_SLASH || ctype == CT_SLASHITEM){
      Screen->ComboD[loc] = Screen->UnderCombo;
      playsound = true;
   }
 
   //these types default to next combo
   if(ctype == CT_BUSHNEXT || ctype == CT_TALLGRASSNEXT || ctype == CT_FLOWERS || ctype == CT_SLASHNEXT || ctype == CT_SLASHNEXTITEM){
      Screen->ComboD[loc] += 1;
      playsound = true;
   }
 
   //no functionality added for Continuous type combos.
 
   if(playsound){
      CreateGraphicAt(sprite,ComboX(loc),ComboY(loc));
 
      Game->PlaySound(SFX_GRASSCUT); // could have different sounds for different types too by modifyng above.
      ItemSetAt(itmset,loc);
   }//end playsound if
}
 
//returns the item# of an equipped sword.  checks and returns A button first, then B button.  returns -1 if no sword equipped.
int LinkSwordEquip(){
    itemdata itm = Game->LoadItemData( GetEquipmentA() );
 
    if(itm->Family==IC_SWORD) return GetEquipmentA();
 
    itm = Game->LoadItemData(GetEquipmentB());
 
    if(itm->Family==IC_SWORD) return GetEquipmentB();
 
    return -1;
}
 
// ..................................................................................................................................................................
 
int TouchedComboLoc(){
    int loc;
    loc = ComboAt( TouchedX(), TouchedY() );
    return loc;
}
 
 
int TouchedX(){
    int x;
    if(Link->Dir == DIR_UP)         x = Link->X+8;
    else if(Link->Dir == DIR_DOWN)  x = Link->X+8;
    else if(Link->Dir == DIR_LEFT)  x = Link->X-2;
    else if(Link->Dir == DIR_RIGHT) x = Link->X+18;
    return x;
}
 
 
int TouchedY(){
    int y;
    if(Link->Dir == DIR_UP)         y = Link->Y+6;
    else if(Link->Dir == DIR_DOWN)  y = Link->Y+18;
    else if(Link->Dir == DIR_LEFT)  y = Link->Y+8;
    else if(Link->Dir == DIR_RIGHT) y = Link->Y+8;
    return y;
}
 
 
int CreateGraphicAt(int sprite, int x, int y){
    eweapon e = Screen->CreateEWeapon(EW_SCRIPT1);
    e->HitXOffset = 500;
    e->UseSprite(sprite);
    e->DeadState = Max(1,e->NumFrames*e->ASpeed);
    e->X = x;
    e->Y = y;
    return e->DeadState;
}
 
void ItemSetAt(int itemset,int loc){
    npc e = Screen->CreateNPC(NPC_ITEMSET);
    e->ItemSet = itemset;
        if(e->isValid()){
        e->X = loc%16*16;
        e->Y = loc-loc%16;
        }
    e->HP = HP_SILENT;
}
 
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);
}

Edited by justin, 01 January 2015 - 04:39 PM.


#39 ywkls

ywkls

    Master

  • Members

Posted 01 January 2015 - 05:02 PM

Two small bugs I just noted when trying out the script you sent... first, when you dash from one screen to the next the dust appears in front of you on the new screen for a second. The only solution I can see for this is having some way to detect that you're moving from one screen to the next. It does this no matter what way your run, although it is most noticeable when you go left or right.

 

The second bug is that instead of stopping by the edge of the water or diving in if you don't have the flippers; Link runs across walkable water as if it was solid ground some of the time. (It seems to depend on how far away from the edge you start your run.. If you're right next to the water, you don't always do this.) By the way, I tried the version of the script I'd uploaded with my example quest that I never posted and it does the same thing with the dust animation as you cross screens so it was apparently part of the original script and not a mistake on your part. Maybe if the animation automatically stopped when you got to the edge of a screen? But from other topics I've read, detecting that Link has left the screen is kind of difficult. So I can live with that bug if it can't be fixed.

 

But the water part... I'd rather Link just stop at the edge of the water or bounce off a flag 98 I placed there than to have him run from one screen to the next on walkable water and have him end up automatically drowning and being unable to reach land without dying. (That's one example I found could happen with this bug. I'm sure there are others.)


Edited by ywkls, 01 January 2015 - 05:03 PM.


#40 justin

justin

    Adept

  • Members

Posted 01 January 2015 - 06:01 PM

I can probably fix the dust bug, I hadn't noticed it before, i'll have to look at the dust code.

The swim bug I hadn't noticed, and I played around a lot with the water. How many tiles or pixels would you say you were away from the water to make it happen? Is it from all directions?

I can easily revert the water code to the old version where link just stopped beside it. I just thought it looked weird so I added the drowning and swimming. I could make link collide with water, but it would look really strange.

Other notes
-surprisingly the Pegasus boots play nice with the ladder
- unsurprisingly they don't play nice with the other buggy item, the raft. It seems sometimes the raft works fine, and other times link keeps rafting when he's no longer on raft flags. I'll just add something to kill the peg script when rafting.  

 

 

Edit:

@ywkls, you're gonna have to send me the test quest, and specific instructions on how to recreate those bugs.  

1. in the test quest i'm playing with the Quest Rule - Animation "No Screen Scrolling" was checked.  and i noticed no issue with the dust clouds (it happens so fast i don't know how anyone could).  I tried it with that quest rule checked off, and the pegasus boots stop working when scrolling (no dust, no sword, no dashing immediately on new screen) which I'm not sure how to fix.

 

2. i can't reproduce the water bug.

 

3. i fixed the raft issue.  but won't bother uploading it just yet.


Edited by justin, 01 January 2015 - 08:44 PM.


#41 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Location:Minas Gerais, Brazil

Posted 02 January 2015 - 08:23 AM

Edit:

@ywkls, you're gonna have to send me the test quest, and specific instructions on how to recreate those bugs.  

1. in the test quest i'm playing with the Quest Rule - Animation "No Screen Scrolling" was checked.  and i noticed no issue with the dust clouds (it happens so fast i don't know how anyone could).  I tried it with that quest rule checked off, and the pegasus boots stop working when scrolling (no dust, no sword, no dashing immediately on new screen) which I'm not sure how to fix.

 

I think this function solves the scrolling problem:

//function by Saffith

if(Link->Action==LA_SCROLLING){
    if(scrollDir==-1)
    {
        if(Link->Y>160)
        {
            scrollDir=DIR_UP;
            scrollCounter=45;
        }
        else if(Link->Y<0)
        {
            scrollDir=DIR_DOWN;
            scrollCounter=45;
        }
        else if(Link->X>240)
        {
            scrollDir=DIR_LEFT;
            scrollCounter=65;
        }
        else
        {
            scrollDir=DIR_RIGHT;
            scrollCounter=65;
        }
    }
    
    if(scrollDir==DIR_UP && scrollCounter<45 && scrollCounter>4)
        drawY+=4;
    else if(scrollDir==DIR_DOWN && scrollCounter<45 && scrollCounter>4)
        drawY-=4;
    else if(scrollDir==DIR_LEFT && scrollCounter<65 && scrollCounter>4)
        drawX+=4;
    else if(scrollDir==DIR_RIGHT && scrollCounter<65 && scrollCounter>4)
        drawX-=4;
    
    scrollCounter--;
}
else
{
    drawX=Link->X;
    drawY=Link->Y;
    if(scrollDir!=-1)
        scrollDir=-1;
}

Edited by accela2me, 02 January 2015 - 08:35 AM.


#42 justin

justin

    Adept

  • Members

Posted 02 January 2015 - 11:24 AM

ya, i've seen that function. but not really sure how to use it.  i'll ask for an example in the thread about that function.  

basically, i've included it, and am trying to have the dust and sword be drawn based on the drawX/drawY variables, which works for anytime that i'm not actually scrolling.  i can't get anything to draw when i'm scrolling - and then when the scrolling is done it draws the dust/sword in a weird spot.

 

edit:  i think the scrolling issue is going to be a lot harder to solve.  since i'm pretty sure lweapon's aren't drawn during scrolling.  the dust and sword are both lweapons.

 

 

anyways, today i've made it so that when Link is jumping it no longer draws dust or makes the dash sound.  and he won't smash pegasus blocks when jumping over.  he'll still be stopped by dash combos not placed on pegasus blocks.


Edited by justin, 02 January 2015 - 11:40 AM.


#43 ywkls

ywkls

    Master

  • Members

Posted 02 January 2015 - 03:43 PM

Okay, here is a link to the quest I created just to show how the Pegasus Boots work and they are set up.

http://www.2shared.c...0e/passage.html

 

I've got it set up where you're initially equipped with them so you can test them out. If I stand at the top of the water on the first screen south of where I start and dash downward, I can run right over the walkable water you're supposed to drown in. To test how it works when scrolling in any direction shouldn't be too hard either. Although I didn't have the rule No Screen Scrolling checked on that quest when I created it, I did a quick check by activating it and issue with the dust animation vanished. (The copy at the link has that rule activated.) So the only things I can see that are still a little strange is running into the water and what you said about the raft. (The ladder might also be buggy, but I haven't really checked it out.)



#44 accela2me

accela2me

    Illustrious

  • Members
  • Real Name:Juliano
  • Location:Minas Gerais, Brazil

Posted 02 January 2015 - 08:39 PM

This video is very good for us to see the features of the pegasus boots:
https://www.youtube....h?v=bSvooDiFYH8


Edited by accela2me, 02 January 2015 - 08:39 PM.


#45 justin

justin

    Adept

  • Members

Posted 02 January 2015 - 10:19 PM

@ywkls, would you mind uploading to a site that I don't need to register for?

I have code that fixes the raft. I didn't notice any issues with the ladder.

I'm currently reworking the dust drawing code to draw when scrolling, I've got something sorta working (needs fine tuning to look the same) by just drawing the tiles instead of using the lweapons. The sword out will be easier, but will require changing some constants.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users