ZoriaRPG

Item Count/Completion Roadblock

Oct 6th, 2019
444
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //import "std.zh"     //uncomment if not called elsewhere
  2. //import "classic.zh" //uncomment if not called elsewhere
  3.  
  4. //Transforms a combo at its location to another combo if Link has the required items
  5. //Place directly over the combo to change
  6. //Enable the ffc flag: Run on screen init
  7. //D0 is the combo to morph your roadblock into
  8. //Fill in the array with item IDs to collect.
  9.  
  10. ffc script roadblock100percent
  11. {
  12.     void run(int new_combo)
  13.     {
  14.         this->Data = CMB_INVISIBLE
  15.         int itemslist[]=
  16.         {
  17.            
  18.             I_SWORD1, I_SWORD2, I_SWORD3
  19.            
  20.         };
  21.         int sz = SizeOfArray(itemslist); //Slightly faster than calling SizeofArray every frame
  22.         bool waiting = true;
  23.         do
  24.         {
  25.             for ( int q = sz; q >= 0; --q )
  26.             {
  27.                 if(Link->Item[ itemslist[q] ] )
  28.                 {
  29.                     waiting = false;
  30.                 }
  31.             }
  32.             Waitframe();
  33.         } while(waiting);
  34.  
  35.         //If we reaxh here, then Link has all of the items
  36.         Game->PlaySound(SFX_SECRET);
  37.         Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = new_combo;
  38.     }
  39. }  
  40.  
  41. //Bonus content: Specify a completion percent as D1
  42. ffc script roadblockSPECIFYpercent
  43. {
  44.     void run(int new_combo, int perc_required)
  45.     {
  46.         this->Data = CMB_INVISIBLE
  47.         int itemslist[]=
  48.         {
  49.            
  50.             I_SWORD1, I_SWORD2, I_SWORD3
  51.            
  52.         };
  53.         int sz = SizeOfArray(itemslist)
  54.         bool waiting = true;
  55.         int count; int actual_perc;
  56.         do
  57.         {
  58.             for ( int q = sz; q >= 0; --q )
  59.             {
  60.                 if(Link->Item[ itemslist[q] ] )
  61.                 {
  62.                     ++count
  63.                 }
  64.             }
  65.             actual_perc = ( 100 / sz ) * count;
  66.             Waitframe();
  67.         } while(actual_perc < perc_required);
  68.         Game->PlaySound(SFX_SECRET);
  69.         Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = new_combo;
  70.     }
  71. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×