Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////////////////
- /// Digging Game for ZC 2.50.2 ///
- /// for JudasRising ///
- /// By: ZoriaRPG ///
- /// v0.2 ///
- /// 7th April, 2018 ///
- //////////////////////////////////
- const int I_SHOVEL = 100; //Item ID of shovel item.
- const int MISC_GAMES = 5; //Link->Misc[]
- const int GT_SHOVEL = 1; //bit for Link->Misc[MISC_GAMES]
- const int SHOVEL_GAME_RUNNING = 0; //index for shovelgame[]
- const int SHOVEL_GAME_TIMER = 1; //index for shovelgame[]
- const int SHOVEL_GAME_ACTIVE = 2; //index for shovelgame[]
- const int SHOVEL_GAME_HAS_SHOVEL = 3; //index for shovelgame[]
- const int SHOVEL_GAME_PREV_B_ITEM = 4; //index for shovelgame[]
- const int SHOVEL_GAME_LINE_Y = 50; //Y position of invisible line.
- const int SHOVEL_GAME_TIMER_X = 90; //Timer X diaplsy position.
- const int SHOVEL_GAME_TIMER_Y = 16; //Timer Y display position.
- const int SHOVEL_GAME_TIMER_SIZE_X = 32; //Timer text character width. Warning: This was BROKEN in 2.50.2 and earlier!
- const int SHOVEL_GAME_TIMER_SIZE_Y = 32; //Timer text character height. Warning: This was BROKEN in 2.50.2 and earlier!
- const int SHOVEL_GAME_TIMER_FONT = 1; //Z3
- const int SHOVEL_GAME_TIMER_LAYER = 6;
- const int SHOVEL_GAME_TIMER_COLOUR = 0x01; //white
- const int SHOVEL_GAME_TIMER_VALUE = 15; //DEFAULT
- const int SHOVEL_GAME_MESSAGE_GAMEOVER = 90; //The message to display when the game ends.
- const int SHOVEL_GAME_GUY_DISTX = 10; //Max disance from guy ffc.
- const int SHOVEL_GAME_GUY_DISTY = 10; //Max disance from guy ffc.
- const int SHOVEL_GAME_COST = 60; //Default cost.
- //Which buttons to allow to press to activate the menu.
- //1 to allow, 0 to disallow.
- const int SHOVEL_GAME_BUTTON_A = 1;
- const int SHOVEL_GAME_BUTTON_B = 1;
- const int SHOVEL_GAME_BUTTON_L = 1;
- const int SHOVEL_GAME_BUTTON_R = 1;
- const int SHOVEL_GAME_BUTTON_EX1 = 1;
- const int SHOVEL_GAME_BUTTON_EX2 = 1;
- const int SHOVEL_GAME_BUTTON_EX3 = 1;
- const int SHOVEL_GAME_BUTTON_EX4 = 1;
- //const int SHOVEL_GAME_
- //const int SHOVEL_GAME_
- //const int SHOVEL_GAME_
- //const int SHOVEL_GAME_
- //Place this ffc on the screen, and give it the data of am NPC. Place over a solid combo.
- ffc script ShovelGame
- {
- //D0: Game duration timer (in seconds!). Defaults to 15.
- //D1: Cost to play in Rupees
- void run(int time, int cost)
- {
- int shovelgame[256];
- //0 == timer
- //1 == running
- //2 == active
- //3 == has the shovel in inventory
- shovelgame[SHOVEL_GAME_ACTIVE] = 1;
- shovelgame[SHOVEL_GAME_HAS_SHOVEL] = Link->Item[I_SHOVEL];
- cost = Cond(cost > 0, cost, SHOVEL_GAME_COST);
- while(shovelgame[SHOVEL_GAME_ACTIVE])
- {
- //The NPC here is set by the FFC data:
- //If below or to the right of him
- if ( Below(this) || RightOf(this) )
- {
- //if Link is facing the guy
- if ( Facing(this) )
- {
- //and within a set distance
- if ( DistX(Link->X, this->X, SHOVEL_GAME_GUY_DISTX) )
- {
- if ( DistY(Link->Y, this->Y, SHOVEL_GAME_GUY_DISTX) )
- {
- //and presses the correct button
- if ( PressShovelGameButton() )
- {
- //create yes/no tango menu
- //if menu returns (1) then the game is running
- shovelgame[SHOVEL_GAME_RUNNING] = ShovelGameMenu(cost);
- }
- }
- }
- }
- }
- //while runnning
- while(shovelgame[SHOVEL_GAME_RUNNING])
- {
- //if Link doesnt have the shovel, give it to him here:
- if ( !shovelgame[SHOVEL_GAME_HAS_SHOVEL] )
- {
- if ( !Link->Item[I_SHOVEL] ) Link->Item[I_SHOVEL] = true;
- //Set the shovel as the active B item.
- if ( GetEquipmentB() |= I_SHOVEL )
- {
- if ( GetEquipmentA() != I_SHOVEL )
- {
- shovelgame[SHOVEL_GAME_PREV_B_ITEM] = GetEquipmentB();
- SetShovelToB(); //Set the shovel to B every frame if not already on A!
- }
- }
- }
- //wait for Link to cross the invisible line
- do
- {
- continue;
- } while(Link->Y < SHOVEL_GAME_LINE_Y );
- //once he does...
- shovelgame[SHOVEL_GAME_TIMER] = Cond(time > 0, time, SHOVEL_GAME_TIMER_VALUE); //set the timer
- shovelgame[SHOVEL_GAME_TIMER] *= 60; //make it frames.
- //Begin the game
- IsShovelGame(true); //set game running
- while(shovelgame[SHOVEL_GAME_TIMER]-- > -1 ) //This check is in frames; the display is in seconds.
- {
- //while the timer is above -1
- //display the game time.
- Screen->DrawInteger
- (SHOVEL_GAME_TIMER_LAYER, SHOVEL_GAME_TIMER_X, SHOVEL_GAME_TIMER_Y,
- SHOVEL_GAME_TIMER_FONT, SHOVEL_GAME_TIMER_COLOUR, 0,
- SHOVEL_GAME_TIMER_SIZE_X, SHOVEL_GAME_TIMER_SIZE_Y,
- ((shovelgame[SHOVEL_GAME_TIMER]/60) << 0), 0, 128);
- Waitframe(); continue;
- //if the timer expires, end the game.
- }
- shovelgame[SHOVEL_GAME_RUNNING] = 0;
- Waitframe(); continue;
- }
- //Game is over.
- //Show a message
- Screen->Message(SHOVEL_GAME_MESSAGE_GAMEOVER);
- //set game off
- IsShovelGame(false);
- //take the shovel away if Link does not own one.
- if ( !shovelgame[SHOVEL_GAME_HAS_SHOVEL] )
- {
- if ( Link->Item[I_SHOVEL] ) Link->Item[I_SHOVEL] = false;
- //Set the shovel as the active B item.
- }
- Waitframe(); continue;
- }
- //if you want the guy to say something else, or if you want to offer a new game,
- //then, you could do that.
- }
- bool PressShovelGameButton()
- {
- if ( SHOVEL_GAME_BUTTON_A && Link->PressA )
- {
- Link->PressA = false; Link->InputA = false; return true;
- }
- if ( SHOVEL_GAME_BUTTON_B && Link->PressB )
- {
- Link->PressB = false; Link->InputB = false; return true;
- }
- if ( SHOVEL_GAME_BUTTON_L && Link->PressL )
- {
- Link->PressL = false; Link->InputL = false; return true;
- }
- if ( SHOVEL_GAME_BUTTON_R && Link->PressR )
- {
- Link->PressR = false; Link->InputR = false; return true;
- }
- if ( SHOVEL_GAME_BUTTON_EX1 && Link->PressEx1 )
- {
- Link->PressEx1 = false; Link->InputEx1 = false; return true;
- }
- if ( SHOVEL_GAME_BUTTON_EX2 && Link->PressEx2 )
- {
- Link->PressEx2 = false; Link->InputEx2 = false; return true;
- }
- if ( SHOVEL_GAME_BUTTON_EX3 && Link->PressEx3 )
- {
- Link->PressEx3 = false; Link->InputEx3 = false; return true;
- }
- if ( SHOVEL_GAME_BUTTON_EX4 && Link->PressEx4 )
- {
- Link->PressEx4 = false; Link->InputEx4 = false; return true;
- }
- return false;
- }
- }
- void SetShovelToB()
- {
- int ___end = GetEquipmentB();
- do Link->SelectBWeapon(DIR_RIGHT);
- while(GetEquipmentB() != I_SHOVEL && GetEquipmentB() != ___end );
- }
- //The 'yes/no' menu called by the ffc.
- int ShovelGameMenu(int cost)
- {
- Tango_D[0] = cost; //We store a game variable in the Tango_D array, so that we can reference it inside the menu.
- int lineBreak[]="@26";
- int line1[]="@choice(1)Play the shovel game for @tab(8)@number(@d0) rupees?@26";
- int line2[]="@choice(2)Not interested.@domenu(1)@suspend()";
- SetUpWindow(WINDOW_SLOT_1, WINDOW_STYLE_3, 32, 32, SIZE_LARGE);
- Tango_LoadString(WINDOW_SLOT_1, line1);
- Tango_AppendString(WINDOW_SLOT_1, line2);
- Tango_ActivateSlot(WINDOW_SLOT_1);
- while(!Tango_MenuIsActive())
- {
- Waitframe();
- }
- // Save the state again...
- int slotState[278];
- int menuState[960];
- int cursorPos;
- Tango_SaveSlotState(WINDOW_SLOT_1, slotState);
- Tango_SaveMenuState(menuState);
- int done = 0;
- int choice;
- int ret;
- while(!done){
- while( Tango_MenuIsActive() )
- {
- cursorPos=Tango_GetMenuCursorPosition();
- Waitframe();
- }
- choice = Tango_GetLastMenuChoice();
- if ( choice == 1 ) // play the game
- {
- if ( Game->Counter[CR_RUPEES] < cost )
- {
- ret = 0;
- done = 1;
- }
- else
- {
- Game->DCounter[CR_RUPEES] -= cost;
- ret = 1;
- done = 1;
- }
- }
- else if ( choice == 2 ) //not interested.
- {
- ret = 0;
- menuArg = choice;
- done = 1;
- }
- else done = 1;
- if ( done )
- {
- break;
- }
- else
- {
- Tango_RestoreSlotState(WINDOW_SLOT_1, slotState);
- Tango_RestoreMenuState(menuState);
- Tango_SetMenuCursorPosition(cursorPos);
- }
- }
- Tango_ClearSlot(WINDOW_SLOT_1);
- return ret;
- }
- }
- //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 = 969; //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 = 3780;
- //Start of 4 combos for the dirt clut
- const int Shovel_FlyingDirt = 3788;
- //FFC slot for the shovel script. This now uses an FFC slot because fancier animation, woo!
- const int Shovel_FFC_Script = 168;
- // This is the sound to be played when you successfully dig.
- const int Shovel_Sound = 74;
- // 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(){
- int s_dig[]="Shovel_Diggy";
- int s_dig_game="Shovel_Diggy_Game";
- int useScript = Cond(IsShovelGame(), s_dig_game, s_dig);
- if(Link->Z > 0) return;
- //int args[] = {103,0,0,0,0,0,0,0};
- RunFFCScript(useScript, NULL);
- }
- }
- ffc script Shovel_Diggy_Game{
- 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;
- }
- }
- //The drops for the special shovel game are defined in the function ShovelDigItem();
- itemdrop = ShovelDigItem();
- 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();
- }
- }
- //These tables define the prizes to award during the DIGGING GAME! -Z
- int ShovelDigItem()
- {
- int prizeChances[100]=
- {
- //Define shovel game prizes, here.
- 0,0,0,0,0,0,0,0,0,0,
- 2,2,2,2,2,2,2,2,2,2,
- 34,34,34,
- 1,1,1,1,1,
- 87,-999, //29
- //30
- -999,-999,-999,-999,-999,-999,-999,-999,-999,-999,
- //40
- -999,-999,-999,-999,-999,-999,-999,-999,-999,-999,
- //50
- -999,-999,-999,-999,-999,-999,-999,-999,-999,-999,
- //60
- -999,-999,-999,-999,-999,-999,-999,-999,-999,-999,
- //70
- -999,-999,-999,-999,-999,-999,-999,-999,-999,-999,
- //80
- -999,-999,-999,-999,-999,-999,-999,-999,-999,-999,
- //90
- -999,-999,-999,-999,-999,-999,-999,-999,-999,-999,
- };
- int specialPrizeChances[100]=
- {
- //Define special prizes here.
- 0,0,0,0,0,0,0,0,0,0,
- 2,2,2,2,2,2,2,2,2,2,
- 34,34,34,
- 1,1,1,1,1,
- 87,-999, //29
- //30
- -999,-999,-999,-999,-999,-999,-999,-999,-999,-999,
- //40
- -999,-999,-999,-999,-999,-999,-999,-999,-999,-999,
- //50
- -999,-999,-999,-999,-999,-999,-999,-999,-999,-999,
- //60
- -999,-999,-999,-999,-999,-999,-999,-999,-999,-999,
- //70
- -999,-999,-999,-999,-999,-999,-999,-999,-999,-999,
- //80
- -999,-999,-999,-999,-999,-999,-999,-999,-999,-999,
- //90
- -999,-999,-999,-999,-999,-999,-999,-999,-999,-999,
- };
- if ( !GetScreenDBit(SHOVELGAME_D, SHOVELGAME_BIT) )
- return specialPrizeChances[Rand(0,99)];
- else return prizeChances[Rand(0,99)];
- }
- }
- //Normal, non-digging-game, script. (Unchanged) -Z
- 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{
- }
- }
- }
- //Returns if the digging game is active. Used to communicate with other scripts.
- bool IsShovelGame()
- {
- return (Link->Misc[MISC_GAMES]>_SHOVEL);
- }
- //Sets a global condition via Link->Misc.
- void IsShovelGame(bool s)
- {
- if ( s )
- {
- Link->Misc[MISC_GAMES] |= GT_SHOVEL;
- }
- else Link->Misc[MISC_GAMES] |= ~GT_SHOVEL;
- }
- //Clears all games from Link->Misc. Call after run() in the active script.
- void ClearLinkMiscGames()
- {
- Link->Misc[MISC_GAMES] = 0;
- }
- //global script active
- // void run()
- // {
- // ClearLinkMiscGames(); //Put it here!
- //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement