Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Gust Jar with FFC
- /// Brought to you by ZoriaRPG
- const int Jar_SPR = 101;
- const int Gust_SPR = 100;
- const int SFX_Gust = 92;
- const int WPN_MISC_GUST = 6;
- const int WPN_FLAG_GUST = 0100b;
- const int slot = 39;
- const int CF_FAN = 10000;
- const int ____FFC_COMBO_INVISIBLE = 1;
- const int GUSTJAR_DISPLAY_TIME = 120; //120 frames
- item script GustGust{
- void run(){
- int ff[]="GustFFC"; //Type the name of the ffc script between the quotes.
- int fff = Game->GetFFCScript(ff); //Get the script ID
- if ( FindFFCRunning(fff) ) Quit(); //If the script is already running, halt now.
- ffc f; //Declare an ffc to use as a pointer.
- for(int q = 0; q <= 32; q++){ //Find an unused ffc...
- f = Screen->LoadFFC(q);
- if (f->Script !=0 || (f->Data !=0 && f->Data != 1) || f->Flags[FFCF_CHANGER])
- continue; //Don't use any that are already in use!
- f->Data = ____FFC_COMBO_INVISIBLE; //Give it an invisible combo that is not ID 0.
- f->Script = fff; //Assign the ffc script slot to the gust jar ffc.
- }
- }
- }
- ffc script GustFFC{
- void run(){
- int a[10]={GUSTJAR_DISPLAY_TIME}; //Let's hold all our values in one array; yes?
- for ( a[1] = 1; a[1] <= 32; a[1]++ ) {
- f = Screen->LoadFFC(q);
- if ( f->Script == this->Script ) { this->Data = 0; this->Script = 0; Quit(); } //If there is another instance of this script, halt and exit.
- }
- Link->Action = LA_ATTACKING;
- Game->PlaySound(SFX_Gust);
- //Make the wind.
- lweapon Gust = CreateLWeaponAt(LW_SCRIPT1, Link->X+InFrontX(Link->Dir, 0), Link->Y+InFrontY(Link->Dir, 0));
- Gust->Damage = 0;
- Gust->Misc[WPN_MISC_GUST] = WPN_FLAG_GUST;
- Gust->UseSprite(Gust_SPR);
- Gust->Dir = Link->Dir;
- Gust->Step = 200;
- //Make the jar.
- lweapon Jar = CreateLWeaponAt(LW_SCRIPT2, Link->X+InFrontX(Link->Dir, 4), Link->Y+InFrontY(Link->Dir, 4));
- Jar->UseSprite(Jar_SPR);
- Jar->CollDetection = false;
- //Orient the jar to match Link
- if ( Link->Dir == DIR_DOWN ){
- Jar->Flip = 2;
- }
- if ( Link->Dir == DIR_LEFT ){
- Jar->Tile++;
- Jar->Flip = 1;
- }
- if ( Link->Dir == DIR_RIGHT ){
- Jar->Tile++;
- }
- //FFC Magic Starts...
- while ( a[0] > 0 || Gust->isValid() ) { //If the wind is on-screen, or our timer hasn't expired...
- if ( a[0] > 0 ) a[0]--; //Reduce the timer.
- //Orient the jar to face where Link faces
- if ( Link->Dir == DIR_DOWN ){
- Jar->Flip = 2;
- }
- if ( Link->Dir == DIR_LEFT ){
- Jar->Tile++;
- Jar->Flip = 1;
- }
- if ( Link->Dir == DIR_RIGHT ){
- Jar->Tile++;
- }
- Jar->DeadState = -2; //Keep it alive.
- Jar->X = Link->X+InFrontX(Link->Dir, 4); //Keep it at Link's position.
- Jar->Y = Link->Y+InFrontY(Link->Dir, 4);
- //If the wind touches a fan, trigger the secrets.
- if (ComboFI(ComboAt(Gust->X+8, Gust->Y+8),CF_FAN) ) {
- Screen->TriggerSecrets();
- }
- Waitframe();
- }
- Remove(Jar); //Eliminate the jar lweapon
- this->Data = 0; this->Script = 0; Quit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement