Jump to content

Photo

Working, animated shovel


  • Please log in to reply
12 replies to this topic

#1 Rocksfan13

Rocksfan13

    Looks best in Blue

  • Members
  • Real Name:Doug
  • Gender:Male
  • Location:Earth

Posted 05 July 2018 - 09:26 AM

So, I am trying to run off of Mitsukara's script in Link and Zelda - Panoply of Calatia with the use of the shovel full with animations.

 

However, I am not able to parse anything.

 

Getting Line 6 : Syntax error, Unexpected IF, expecting $ END, on token IF

 

I am able to understand some of this stuff, but not a lot.

I have looked to see if it was a declared statement or integer and I see none.

 

Maybe someone can help me with this.

All I really want to do is have Link have a shovel animation when using it.

 

Jamian's script from the DB does work, but it uses no animation other than the default attack.

 

Here is what I have so far:

import "std.zh"

// --- Shovel
// See also: after "Waitdraw"

if (GetEquipmentA() == 131 && Link->PressA || GetEquipmentB() == 131 && Link->PressB){
    if (Link->Action < 3 && ArrayOne[16] == 0 && Link->Z == 0){
        LinkPause = 2;
        ArrayOne[16] = 16;
    }
}
if (ArrayOne[16] > 0){
    ArrayOne[16] --;
    NoAction();
}
if (ArrayOne[16] > 7 && ArrayOne[16] < 10){
    if (NumLWeaponsOf(LW_SPARKLE) == 0) lweapon DirtCloud = NextToLink (LW_SPARKLE,0);
    if (ArrayOne[16] == 9){
        DirtCloud->UseSprite(107);
        if (Link->Dir == DIR_UP && Screen->ComboT[ComboAt(Link->X+8,Link->Y-4)] != CT_SCRIPT1 || Link->Dir == DIR_DOWN && Screen->ComboT[ComboAt(Link->X+8,Link->Y+20)] != CT_SCRIPT1 || Link->Dir == DIR_LEFT && Screen->ComboT[ComboAt(Link->X-4,Link->Y+8)] != CT_SCRIPT1 || Link->Dir == DIR_RIGHT && Screen->ComboT[ComboAt(Link->X+20,Link->Y+8)] != CT_SCRIPT1 && !IsSideview()) Game->PlaySound(75);
    }
    if (Link->Dir == DIR_UP && Screen->ComboT[ComboAt(Link->X+8,Link->Y-4)] == CT_SCRIPT1){
        if (Screen->ComboS[ComboAt(Link->X+8,Link->Y-4)] != 0 && ArrayOne[16] == 8){
            Screen->ComboD[ComboAt(Link->X+8,Link->Y-4)] ++;
        }
        if (Screen->ComboS[ComboAt(Link->X+8,Link->Y-4)] == 0 && ArrayOne[16] == 9){
            Screen->ComboD[ComboAt(Link->X+8,Link->Y-4)] = 163;
            if (Screen->ComboF[ComboAt(Link->X+8,Link->Y-4)] != 13) ArrayOne[17] = Choose (0,0,0,1,1,2);
        }
        DirtCloud->UseSprite(106);
        DirtCloud->CSet = Screen->ComboC[ComboAt(Link->X+8,Link->Y-4)];
        Game->PlaySound(69);
    }
    if (Link->Dir == DIR_DOWN && Screen->ComboT[ComboAt(Link->X+8,Link->Y+20)] == CT_SCRIPT1){
        if (Screen->ComboS[ComboAt(Link->X+8,Link->Y+20)] != 0 && ArrayOne[16] == 8){
            Screen->ComboD[ComboAt(Link->X+8,Link->Y+20)] ++;
        }
        if (Screen->ComboS[ComboAt(Link->X+8,Link->Y+20)] == 0 && ArrayOne[16] == 9){
            Screen->ComboD[ComboAt(Link->X+8,Link->Y+20)] = 163;
            if (Screen->ComboF[ComboAt(Link->X+8,Link->Y+20)] != 13) ArrayOne[17] = Choose (0,0,0,1,1,2);
        }
        DirtCloud->UseSprite(106);
        DirtCloud->CSet = Screen->ComboC[ComboAt(Link->X+8,Link->Y+20)];
        Game->PlaySound(69);
    }
    if (Link->Dir == DIR_LEFT && Screen->ComboT[ComboAt(Link->X-4,Link->Y+8)] == CT_SCRIPT1){
        if (Screen->ComboS[ComboAt(Link->X-4,Link->Y+8)] != 0 && ArrayOne[16] == 8){
            Screen->ComboD[ComboAt(Link->X-4,Link->Y+8)] ++;
        }
        if (Screen->ComboS[ComboAt(Link->X-4,Link->Y+8)] == 0 && ArrayOne[16] == 9){
            Screen->ComboD[ComboAt(Link->X-4,Link->Y+8)] = 163;
            if (Screen->ComboF[ComboAt(Link->X-4,Link->Y+8)] != 13) ArrayOne[17] = Choose (0,0,0,1,1,2);
        }
        DirtCloud->UseSprite(106);
        DirtCloud->CSet = Screen->ComboC[ComboAt(Link->X-4,Link->Y+8)];
        Game->PlaySound(69);
    }
    if (Link->Dir == DIR_RIGHT && Screen->ComboT[ComboAt(Link->X+20,Link->Y+8)] == CT_SCRIPT1){
        if (Screen->ComboS[ComboAt(Link->X+20,Link->Y+8)] != 0 && ArrayOne[16] == 8){
            Screen->ComboD[ComboAt(Link->X+20,Link->Y+8)] ++;
        }
        if (Screen->ComboS[ComboAt(Link->X+20,Link->Y+8)] == 0 && ArrayOne[16] == 9){
            Screen->ComboD[ComboAt(Link->X+20,Link->Y+8)] = 163;
            if (Screen->ComboF[ComboAt(Link->X+20,Link->Y+8)] != 13) ArrayOne[17] = Choose (0,0,0,0,1,2);
        }
        DirtCloud->UseSprite(106);
        DirtCloud->CSet = Screen->ComboC[ComboAt(Link->X+20,Link->Y+8)];
        Game->PlaySound(69);
    }
}
if (ArrayOne[16] == 1 && CapeOn == false && FairyOn == false) Link->Invisible = 0;
if (ArrayOne[17] == 1) ArrayOne[18] = Choose(I_RUPEE1,I_HEART);
if (ArrayOne[17] == 2) ArrayOne[17] = Choose(3,4);
if (ArrayOne[17] == 3) ArrayOne[18] = Choose(2000,I_RUPEE5,I_RUPEE5,I_FAIRY,I_FAIRY,1000);
if (ArrayOne[17] == 4) ArrayOne[18] = 2000;
if (ArrayOne[17] > 0){
    if (ArrayOne[18] == 1000){
        npc DugEnemy = CreateNPCAt(177,Link->X,Link->Y);
        DugEnemy->Z = 8;
        DugEnemy->Stun = 64;
        if (Link->Dir == DIR_UP){
            DugEnemy->X = ComboX(ComboAt(Link->X+8,Link->Y-4));
            DugEnemy->Y = ComboY(ComboAt(Link->X+8,Link->Y-4));
        }
        if (Link->Dir == DIR_DOWN){
            DugEnemy->X = ComboX(ComboAt(Link->X+8,Link->Y+20));
            DugEnemy->Y = ComboY(ComboAt(Link->X+8,Link->Y+20));
        }
        if (Link->Dir == DIR_LEFT){
            DugEnemy->X = ComboX(ComboAt(Link->X-4,Link->Y+8));
            DugEnemy->Y = ComboY(ComboAt(Link->X-4,Link->Y+8));
        }
        if (Link->Dir == DIR_RIGHT){
            DugEnemy->X = ComboX(ComboAt(Link->X+20,Link->Y+8));
            DugEnemy->Y = ComboY(ComboAt(Link->X+20,Link->Y+8));
        }
    }
    if (ArrayOne[18] < 1000){
        item DugPrize = CreateItemAt(ArrayOne[18],Link->X,Link->Y-16);
        DugPrize->Pickup = IP_TIMEOUT;
        DugPrize->Z = 8;
        if (Link->Dir == DIR_DOWN) DugPrize ->Y = Link->Y+16;
        if (Link->Dir == DIR_LEFT){
            DugPrize->X = Link->X-16;
            DugPrize->Y = Link->Y;
        }
        if (Link->Dir == DIR_RIGHT){
            DugPrize->X = Link->X+16;
            DugPrize->Y = Link->Y;
        }
    }
    ArrayOne[17] = 0;
    ArrayOne[18] = 0;
}

Waitdraw();

// --- Shovel animation
if (ArrayOne[16] > 8 && ArrayOne[16] < 17){
    Link->Invisible = 1;
    if (Link->Item[251] == false){
        if (Link->Item[248] == true){
            if (Link->Item[179] == false){
                if (Link->Dir == DIR_UP) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10664, 6, 128);    
                if (Link->Dir == DIR_DOWN) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10666, 6, 128);
                if (Link->Dir == DIR_LEFT) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10668, 6, 128);        
                if (Link->Dir == DIR_RIGHT) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10670, 6, 128);    
            }
            else{
                if (Link->Dir == DIR_UP) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10684, 6, 128);    
                if (Link->Dir == DIR_DOWN) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10686, 6, 128);
                if (Link->Dir == DIR_LEFT) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10688, 6, 128);        
                if (Link->Dir == DIR_RIGHT) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10690, 6, 128);    
            }
        }
        else{
            if (Link->Item[179] == false){
                if (Link->Dir == DIR_UP) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20180,1,2,6,-1,-1,-1,-1,0,0,1,128);
                if (Link->Dir == DIR_DOWN) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20182,1,2,6,-1,-1,-1,-1,0,0,1,128);
                if (Link->Dir == DIR_LEFT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20184,1,2,6,-1,-1,-1,-1,0,0,1,128);
                if (Link->Dir == DIR_RIGHT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20186,1,2,6,-1,-1,-1,-1,0,0,1,128);
            }
            else{
                if (Link->Dir == DIR_UP) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20188,1,2,6,-1,-1,-1,-1,0,0,1,128);
                if (Link->Dir == DIR_DOWN) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20190,1,2,6,-1,-1,-1,-1,0,0,1,128);
                if (Link->Dir == DIR_LEFT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20192,1,2,6,-1,-1,-1,-1,0,0,1,128);
                if (Link->Dir == DIR_RIGHT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20194,1,2,6,-1,-1,-1,-1,0,0,1,128);
            }
        }
    }
    else{
        if (Link->Item[179] == false){
            if (Link->Dir == DIR_UP) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24260,1,2,6,-1,-1,-1,-1,0,0,1,128);
            if (Link->Dir == DIR_DOWN) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24262,1,2,6,-1,-1,-1,-1,0,0,1,128);
            if (Link->Dir == DIR_LEFT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24264,1,2,6,-1,-1,-1,-1,0,0,1,128);
            if (Link->Dir == DIR_RIGHT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24266,1,2,6,-1,-1,-1,-1,0,0,1,128);
        }
        else{
            if (Link->Dir == DIR_UP) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24268,1,2,6,-1,-1,-1,-1,0,0,1,128);
            if (Link->Dir == DIR_DOWN) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24270,1,2,6,-1,-1,-1,-1,0,0,1,128);
            if (Link->Dir == DIR_LEFT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24272,1,2,6,-1,-1,-1,-1,0,0,1,128);
            if (Link->Dir == DIR_RIGHT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24274,1,2,6,-1,-1,-1,-1,0,0,1,128);
        }
    }
}
if (ArrayOne[16] > 1 && ArrayOne[16] < 9){
    if (Link->Item[251] == false){
        if (Link->Item[248] == true){
            if (Link->Item[179] == false){
                if (Link->Dir == DIR_UP) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10665, 6, 128);
                if (Link->Dir == DIR_DOWN) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10667, 6, 128);
                if (Link->Dir == DIR_LEFT) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10669, 6, 128);    
                if (Link->Dir == DIR_RIGHT) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10671, 6, 128);
            }
            else{
                if (Link->Dir == DIR_UP) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10685, 6, 128);
                if (Link->Dir == DIR_DOWN) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10687, 6, 128);
                if (Link->Dir == DIR_LEFT) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10689, 6, 128);    
                if (Link->Dir == DIR_RIGHT) Screen->FastTile(3, Link->X, Link->Y-Link->Z, 10691, 6, 128);
            }
        }
        else{
            if (Link->Item[179] == false){
                if (Link->Dir == DIR_UP) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20181,1,2,6,-1,-1,-1,-1,0,0,1,128);
                if (Link->Dir == DIR_DOWN) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20183,1,2,6,-1,-1,-1,-1,0,0,1,128);
                if (Link->Dir == DIR_LEFT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20185,1,2,6,-1,-1,-1,-1,0,0,1,128);
                if (Link->Dir == DIR_RIGHT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20187,1,2,6,-1,-1,-1,-1,0,0,1,128);
            }
            else{
                if (Link->Dir == DIR_UP) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20189,1,2,6,-1,-1,-1,-1,0,0,1,128);
                if (Link->Dir == DIR_DOWN) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20191,1,2,6,-1,-1,-1,-1,0,0,1,128);
                if (Link->Dir == DIR_LEFT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20193,1,2,6,-1,-1,-1,-1,0,0,1,128);
                if (Link->Dir == DIR_RIGHT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,20195,1,2,6,-1,-1,-1,-1,0,0,1,128);
            }
        }
    }
    else{
        if (Link->Item[179] == false){
            if (Link->Dir == DIR_UP) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24261,1,2,6,-1,-1,-1,-1,0,0,1,128);
            if (Link->Dir == DIR_DOWN) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24263,1,2,6,-1,-1,-1,-1,0,0,1,128);
            if (Link->Dir == DIR_LEFT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24265,1,2,6,-1,-1,-1,-1,0,0,1,128);
            if (Link->Dir == DIR_RIGHT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24267,1,2,6,-1,-1,-1,-1,0,0,1,128);
        }
        else{
            if (Link->Dir == DIR_UP) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24269,1,2,6,-1,-1,-1,-1,0,0,1,128);
            if (Link->Dir == DIR_DOWN) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24271,1,2,6,-1,-1,-1,-1,0,0,1,128);
            if (Link->Dir == DIR_LEFT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24273,1,2,6,-1,-1,-1,-1,0,0,1,128);
            if (Link->Dir == DIR_RIGHT) Screen->DrawTile(3,Link->X,Link->Y-16-Link->Z,24275,1,2,6,-1,-1,-1,-1,0,0,1,128);
        }
    }
}

Edited by Rocksfan13, 05 July 2018 - 09:27 AM.


#2 cavthena

cavthena

    Apprentice

  • Members
  • Real Name:Clayton
  • Gender:Male
  • Location:I wish I knew

Posted 05 July 2018 - 08:54 PM

is this a snippit of code? Is this an ffc or global? You should post the entire function or declaration. It would help in this matter.



#3 ZoriaRPG

ZoriaRPG

    The Timelord

  • ZC Developers
  • Gender:Unspecified
  • Location:Prydon Academy

Posted 05 July 2018 - 09:35 PM

is this a snippit of code? Is this an ffc or global? You should post the entire function or declaration. It would help in this matter.


It's part of a gigantic, hardcoded wall of code from her active script.

#4 judasrising

judasrising

    I play guitar

  • Members
  • Gender:Male
  • Location:Sweden but born in Finland

Posted 06 July 2018 - 06:19 AM

Pm sent!



#5 Avataro

Avataro

    Quest maker

  • Members
  • Real Name:Robin
  • Gender:Male
  • Location:Germany

Posted 06 July 2018 - 07:36 AM

The one from vintage dreams is working and animated.



#6 Rocksfan13

Rocksfan13

    Looks best in Blue

  • Members
  • Real Name:Doug
  • Gender:Male
  • Location:Earth

Posted 06 July 2018 - 11:29 AM

Yes indeed.

I am working with judasrising on nailing this one down.

 

I did not know this existed!!


  • judasrising likes this

#7 Rocksfan13

Rocksfan13

    Looks best in Blue

  • Members
  • Real Name:Doug
  • Gender:Male
  • Location:Earth

Posted 11 July 2018 - 11:24 AM

Ok scripting gurus.

 

Judasrising has been awesome at helping me with this script and now it is working.

 

However, neither of us can figure out how to get the secrets to change the combo or to trigger the item.

 

This last line confuses us both.

 

Can anyone explain it to us:

ffc script Shovel_SP_DigPoint{
    void run(int Replace_Combo, int Replace_CSet, int Secret_Item){
        
        //    just script a FFC as "dig point" that changes it's combo to something specific when dug
        //    probably the best solution
        //    since you could define on the fly what you'd want it to be
        
        
        if(Screen->State[ST_SECRET] == false){
            
            
        }
        else{
            
            
            
        }
        
    }
}

This is kinda the whole reason for getting the shovel in the first place.

 

Any help is appreciated.

 

EDIT- UGH!! Sorry for the double post there.


Edited by Rocksfan13, 11 July 2018 - 11:26 AM.


#8 Avataro

Avataro

    Quest maker

  • Members
  • Real Name:Robin
  • Gender:Male
  • Location:Germany

Posted 11 July 2018 - 12:21 PM

Just an unfinished script that does nothing.

 

I forgot that that's the whole point of a shovel item :(


Edited by Avataro, 11 July 2018 - 12:22 PM.


#9 Rocksfan13

Rocksfan13

    Looks best in Blue

  • Members
  • Real Name:Doug
  • Gender:Male
  • Location:Earth

Posted 11 July 2018 - 12:29 PM

Hmm. Ok that explains why it doesn't work.

 

So, my next question would be if it could be finished so it does work?

Kinda really need it to dig special items and secrets. I am actually considering using it to dig a spot a couple times to get a deeper hole.

 

I honestly know little to nothing when it comes to coding language.



#10 Avataro

Avataro

    Quest maker

  • Members
  • Real Name:Robin
  • Gender:Male
  • Location:Germany

Posted 11 July 2018 - 05:04 PM

Well secrets already work. It uses a screen flag for that so you can shovel secrets. Maybe for items hide chests underground as secrets?



#11 Rocksfan13

Rocksfan13

    Looks best in Blue

  • Members
  • Real Name:Doug
  • Gender:Male
  • Location:Earth

Posted 11 July 2018 - 06:15 PM

I've tried to use the Script 2 (99) flag. But, nothing happens.

 

I am not sure how the secret is setup.

 

Is it an undercombo? It is a declared argument?

 

I am very confused as to how it works. Plus, I really need it to change to a warp type.

 

Idk, what I am missing.

 

I should note that I am not using the code I first posted.

 

This is the current script that I am working with now:

 

UPDATE: I am able to trick the script into turning the combo into the screen's undercombo.
However, due to this, there is no secret sound trigger. I am also not able to dig for special items unless the UnderCombo is a treasure chest.

import "std.zh"
import "ffcscript.zh"

//Huzzah, this script now uses a way more practical injection model for usage! ~Lunaria

//The combo type for generic digging on overworld.
const int Shovel_ComboType = 143;    //Script 2 (143) is default for this.


//The flag to dig on to trigger secrets. (Does not need to be on a digable combo type!)
const int Shovel_SecretFlag = 99;    //General Purpose 2     (99) is default for this.


//Digging on proper combos will change the combo to this one:
const int Shovel_DugCombo = 63;        //Change to 0 to use the screens undercombo instead.


//Start of 8 combos in a row for the dig animation. (Up 1, Down 1, Left 1, Right 1, Up 2, Down 2, Left 2, Right 2)
const int Shovel_Anima_Start = 4216;
//Start of 4 combos for the dirt clut
const int Shovel_FlyingDirt = 4224;



//FFC slot for the shovel script. This now uses an FFC slot because fancier animation, woo!
const int Shovel_FFC_Script = 7;


// This is the sound to be played when you successfully dig.
const int Shovel_Sound = 100;
// The sound to be played when you attempt to dig an undiggable combo.
const int Shovel_Fail = 101;
// The secret sound to be played when you dig a secret.
const int Shovel_SecretSFX = 27;

item script Shovel{
    void run(){
        
        if(Link->Z > 0) return;
        int args[] = {103,0,0,0,0,0,0,0};
        RunFFCScript(Shovel_FFC_Script, args);
        
    }
}




ffc script Shovel_Diggy{
  void run(){
    int chance;
    int itemdrop;
    int itemlocx;
    int itemlocy;
    // Link->Action=LA_ATTACKING;
    
    item ShovelLoot;
    
    bool DigSuccess = false;
    
    int DigComboX;
    int DigComboY;
    if(Link->Dir == 0){
        DigComboX = Link->X + 8;
        DigComboY = Link->Y - 2;
    }
    else if(Link->Dir == 1){
        DigComboX = Link->X + 8;
        DigComboY = Link->Y + 18;
    }
    else if(Link->Dir == 2){
        DigComboX = Link->X - 2;
        DigComboY = Link->Y + 8;
    }
    else if(Link->Dir == 3){
        DigComboX = Link->X + 18;
        DigComboY = Link->Y + 8;
    }
    
    int DigComboX2 = ComboAt(DigComboX,DigComboY) % 16;
    DigComboX2 = DigComboX2 * 16;
    int DigComboY2 = ComboAt(DigComboX,DigComboY) / 16;
    DigComboY2 = Floor(DigComboY2);
    DigComboY2 = DigComboY2 * 16;
    
    
    for(int i; i != 10; i ++){
        Link->Invisible = true;
        
        Screen->FastCombo(2, Link->X, Link->Y, Shovel_Anima_Start + Link->Dir, 6, OP_OPAQUE);
        NoAction();
        
        Waitframe();
        Link->Invisible = false;
    }

    
    if(Screen->ComboT[ComboAt(DigComboX,DigComboY)] != Shovel_ComboType
    && Screen->ComboI[ComboAt(DigComboX,DigComboY)] != Shovel_SecretFlag
    && Screen->ComboF[ComboAt(DigComboX,DigComboY)] != Shovel_SecretFlag){
       Game->PlaySound(Shovel_Fail);
    }
    else{
        
       Game->PlaySound(Shovel_Sound);
       DigSuccess = true;
       
       chance=Rand(100)+1;
       
       if(Screen->ComboT[ComboAt(DigComboX,DigComboY)] == Shovel_ComboType && Screen->ComboI[ComboAt(DigComboX,DigComboY)] == Shovel_SecretFlag){
           
           Screen->ComboD[ComboAt(DigComboX,DigComboY)] = Screen->UnderCombo;
           chance = 101;
           
       }
       else if(Screen->ComboF[ComboAt(DigComboX,DigComboY)] == Shovel_SecretFlag || Screen->ComboI[ComboAt(DigComboX,DigComboY)] == Shovel_SecretFlag){
           Game->PlaySound(Shovel_SecretSFX);
           Screen->TriggerSecrets();
           Screen->State[ST_SECRET] = true;
           chance = 101;
       }
       else{
           Screen->ComboD[ComboAt(DigComboX,DigComboY)] = Screen->UnderCombo;
           
           if(Shovel_DugCombo > 0){
               Screen->ComboD[ComboAt(DigComboX,DigComboY)] = Shovel_DugCombo;
           }
       }
       
        //Drop ratio is the current number minus the last one.
       if(chance<=10){        //10%
           itemdrop = 0;    //1 rupee
       }
       else if(chance<=20){    //10%
           itemdrop = 2;    //Recovery heart
       }
       else if(chance<=23){    //3%
           itemdrop = 34;    //Fairy
       }
       else if(chance<=27){    //4%
           itemdrop = 1;    //5 Rupee
       }
       else if(chance<=28){    //1%
           itemdrop = 87;    //100 Rupee
       }
       else{
           itemdrop = - 999;    //No item drop
       }

       if(Link->Dir==0){    //Spawn location
           itemlocx=Link->X;
           itemlocy=Link->Y-16;
       }
       if(Link->Dir==1){
           itemlocx=Link->X;
           itemlocy=Link->Y+16;
       }
       if(Link->Dir==2){
           itemlocx=Link->X-16;
           itemlocy=Link->Y;
       }
       if(Link->Dir==3){
           itemlocx=Link->X+16;
           itemlocy=Link->Y;
       }

       if(itemdrop != -999){
           ShovelLoot=Screen->CreateItem(itemdrop);
           ShovelLoot->X=itemlocx;
           ShovelLoot->Y=itemlocy;
           ShovelLoot->Z=2;
           ShovelLoot->Jump = 2;
           ShovelLoot->Pickup=IP_TIMEOUT;
       }
    }
    
    int shovel_item_dir = Link->Dir;
    int DirtClutX = DigComboX2;
    int DirtClutY = DigComboY2;
    
    
    for(int i; i != 10; i ++){
        Link->Invisible = true;
        
        Screen->FastCombo(2, Link->X, Link->Y, Shovel_Anima_Start + 4 + Link->Dir, 6, OP_OPAQUE);
        NoAction();
        
        if(i < 5){
            
            if(shovel_item_dir == 0)DirtClutY --;
            if(shovel_item_dir == 1 && i % 2 == 0)DirtClutY ++;
            
            //sideways
            if(shovel_item_dir > 1)DirtClutY --;
            if(shovel_item_dir == 3)DirtClutX = DigComboX + (i / 2);
            if(shovel_item_dir == 2)DirtClutX = DigComboX - (i / 2);
            
        }
        else{
            
            if(shovel_item_dir == 0 && i % 2 == 0)DirtClutY --;
            if(shovel_item_dir == 1)DirtClutY ++;
            
            //sideways
            if(shovel_item_dir > 1)DirtClutY ++;
            if(shovel_item_dir == 3)DirtClutX = DigComboX + (i / 2);
            if(shovel_item_dir == 2)DirtClutX = DigComboX - (i / 2);
            
        }
        if(DigSuccess)Screen->FastCombo(2, DirtClutX, DirtClutY, Shovel_FlyingDirt + shovel_item_dir, 6, OP_OPAQUE);
        
        
        if(Screen->ComboS[ComboAt(ShovelLoot->X + 8, ShovelLoot->Y + 8)] == 0){
            
            if(shovel_item_dir == 0)ShovelLoot->Y --;
            else if(shovel_item_dir == 1)ShovelLoot->Y ++;
            else if(shovel_item_dir == 2)ShovelLoot->X --;
            else if(shovel_item_dir == 3)ShovelLoot->X ++;
            
        }
        
        
        Waitframe();
        Link->Invisible = false;
    }
    
    while(ShovelLoot->Z > 0){
        
        if(Screen->ComboS[ComboAt(ShovelLoot->X + 8, ShovelLoot->Y + 8)] == 0){
            
            if(shovel_item_dir == 0)ShovelLoot->Y --;
            else if(shovel_item_dir == 1)ShovelLoot->Y ++;
            else if(shovel_item_dir == 2)ShovelLoot->X --;
            else if(shovel_item_dir == 3)ShovelLoot->X ++;
            
        }
        
        Waitframe();
        
    }
    
  }
}

ffc script Shovel_SP_DigPoint{
    void run(int Replace_Combo, int Replace_CSet, int Secret_Item){
        
        //    just script a FFC as "dig point" that changes it's combo to something specific when dug
        //    probably the best solution
        //    since you could define on the fly what you'd want it to be
        
        
        if(Screen->State[ST_SECRET] == false){
            
            
        }
        else{
            
            
            
        }
        
    }
}




Edited by Rocksfan13, 12 July 2018 - 06:59 AM.


#12 Avataro

Avataro

    Quest maker

  • Members
  • Real Name:Robin
  • Gender:Male
  • Location:Germany

Posted 12 July 2018 - 07:51 AM

Well the flag 99 function triggers screen secrets. So you can use flag 16, etc to change combos.


Edited by Avataro, 12 July 2018 - 07:51 AM.

  • judasrising likes this

#13 Rocksfan13

Rocksfan13

    Looks best in Blue

  • Members
  • Real Name:Doug
  • Gender:Male
  • Location:Earth

Posted 12 July 2018 - 08:02 AM

Avataro, you genius. I had overlooked the fact that it was a trigger flag.

I can just set a combo with an inherent 16-31 tile flag to change it to that. It plays the secret sound too!!

 

Now, if only I could dig items directly....

 

Currently I can work around it by digging up a chest instead.


  • judasrising likes this


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users