Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //import "std.zh" //uncomment if not called elsewhere
- //import "classic.zh" //uncomment if not called elsewhere
- //Transforms a combo at its location to another combo if Link has the required items
- //Place directly over the combo to change
- //Enable the ffc flag: Run on screen init
- //D0 is the combo to morph your roadblock into
- //Fill in the array with item IDs to collect.
- ffc script roadblock100percent
- {
- void run(int new_combo)
- {
- this->Data = CMB_INVISIBLE
- int itemslist[]=
- {
- I_SWORD1, I_SWORD2, I_SWORD3
- };
- int sz = SizeOfArray(itemslist); //Slightly faster than calling SizeofArray every frame
- bool waiting = true;
- do
- {
- for ( int q = sz; q >= 0; --q )
- {
- if(Link->Item[ itemslist[q] ] )
- {
- waiting = false;
- }
- }
- Waitframe();
- } while(waiting);
- //If we reaxh here, then Link has all of the items
- Game->PlaySound(SFX_SECRET);
- Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = new_combo;
- }
- }
- //Bonus content: Specify a completion percent as D1
- ffc script roadblockSPECIFYpercent
- {
- void run(int new_combo, int perc_required)
- {
- this->Data = CMB_INVISIBLE
- int itemslist[]=
- {
- I_SWORD1, I_SWORD2, I_SWORD3
- };
- int sz = SizeOfArray(itemslist)
- bool waiting = true;
- int count; int actual_perc;
- do
- {
- for ( int q = sz; q >= 0; --q )
- {
- if(Link->Item[ itemslist[q] ] )
- {
- ++count
- }
- }
- actual_perc = ( 100 / sz ) * count;
- Waitframe();
- } while(actual_perc < perc_required);
- Game->PlaySound(SFX_SECRET);
- Screen->ComboD[ComboAt(this->X+8, this->Y+8)] = new_combo;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement