import "std.zh" //Disable this if you already have imported std.zh. import "std_extra.zh" //Import stdExtra.zh to make the FFC script work. (Disable if you already have this.) import "ffcscript.zh" //Import ffcscript.zh to make FFC functions work. (Disable if you already have this.) //import stdArguments.zh //needs v6.3 or later) Error Sound Effects for this Subweapon. Item number (in item editor) for this Subweapon. Other Item Counter Used by Subweapon (if any). ///////////////////// /// Magic Spell ///// ////////////////////////////////////////////////////////////////////////////////////////////// /// This item creates a flash on the screen, with a thundering sound, dealing damage to all // /// enemies on the screen, while launching a projectile (lightning bolt) toward one target. // ////////////////////////////////////////////////////////////////////////////////////////////// /// D0 (##xxx.xxxx) : LType; type of LWeapon to generate (see std_constsnts.zh). /// /// Select Sounds from Quest->Audio->SFX Data . /// /// D0 (xx###.xxxx) : MP to Use when Activating Spell. /// /// D0 (xxxxx.####) : Damage (Power) of Generated LWeapon. /// /// D1 (###xx.xxxx) : Sprite used by Subweapon; select from: /// /// Quest->Graphics->Sprites->WeaponsMisc. /// /// D1 (xxx##.xxxx) : Special Counter to Use. /// /// D1 (xxxxx.####) : Amount to Deduct from Special Counter (per use). /// /// D2 (####x.xxxx) : Speed that Subweapon Travels across screen; suggest 60. /// /// D2 (xxxx#.xxxx) : Screen Effect When Using Spell: /// /// : 0 = None, 1 = Wavy, 2 = ? /// /// D2 (xxxxx.####) : Message String to Display (0 for none). /// /// D3 (###xx.xxxx) : Script Slot for Item Script Extras. /// /// D3 (xxx##.#xxx) : Colour of Screen Flash. /// /// D3 (xxxxx.x###) : Duration of Screen Flash. /// /// D4 (###xx.xxxx) : Sound Effects for this Spell. /// /// Select Sounds from Quest->Audio->SFX Data. /// /// D4 (xxxx#.##xx) : Error Sound Effects for this Spell. /// /// Select Sounds from Quest->Audio->SFX Data. /// /// D4 (xxxxx.x###) : FFC Slot for FFC Effects. /// /// D5 (###xx.xxxx) : Time before Link can use Spell Again. /// /// D5 (xxx##.#xxx) : MP to Use when Activating Spell /// /// D5 (xxxxx.x###) : Rupees Use when Activating Spell. /// /// D6 (#xxxx.xxxx) : Switch-D; Sprite Flip On/Off. /// /// D6 (x##xx.xxxx) : Type of Link-Action Animation to Use (see: std_constants.zh). /// /// /// D6 (xxx##.xxxx) : Amount of Global Damage to Deal (to All-Enemies on the Screen). /// /// /// D6 (xxxxx.####) : Duration of D2 Screen Effect. /// /// D7 (###xx.xxxx) : Item Number of This Item. /// /// D7 (xxx##.#xxx) : Item Number of Item Required to Use this Item. /// /// /// D7 (xxxxx.x#xx) : Switch-C /// /// D7 (xxxxx.xx#x) : Switch-B /// /// D7 (xxxxx.xxx#) : Switch-A /// ////////////////////////////////////////////////////////////////////////////////////////////// /// Switch Values //////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////// /// Switch-D (#xxxx.xxxx) : Sprite Flip On/Off; 0 = Off, 1 = On. ///////////// /// Switch-C (xxxxx.x#xx) : Available for Future Use. ///////////// /// Switch-B (xxxxx.xx#x) : Available for Future Use. ///////////// /// Switch-A (xxxxx.xxx#) : Available for Future Use. ///////////// ////////////////////////////////////////////////////////////////////////////////////////////// item script MagicSpell{ void run(int D0, int D1, int D2, int D3, int D4, int D5, int D6, int D7){ int LType = GetValue298(D0); //max needed 24 int magicCost = GetValue3Upper765(D0); //max needed 999 int power = GetValue4Low(D0); //max needed 9999 //D0: (24)(999).(9999) int spellSprite = GetValue3High(D1); //max need 255 int specialCounter = GetValue287(D1); //max neeced 31 int specialCost = GetValue4Low(D1); //max needed 9999 //D1: (255)(31).(9999) int speed = GetValue4High(D2); //max needed 2500 int screenEffect = GetValue15(D2); //max needed 9 int message = GetValue4Low(D2); //maxc needed 9999 //D2: (2500)(9).(9999) int itemScriptSlot = GetValue3High(D3); //max neeeded 255 int colour = GetValue3Mid(D3); //max needed 255 int duration = GetValue3Low(D3); //max needed 255 //D3: (255)(25.5)(255) int spellSFX = GetValue3High(D4); //max needed 255 int errorSFX = GetValue3Mid(D4); //max needed 255 int Script_ID = GetValue3Low(D4); //max needed 511 //D4: (255)(25.5)(511) int noUse = GetValue3High(D5); //max needed 255 int lifeCost = GetValue3Mid(D5); //max needed 999 int rupeeCost = GetValue3Low(D5); //max needed 999 //D5: (255)(99.9)(999) int switchD = GetValue1Highest(D6); //max possible 2 int LA_Type = GetValue287(D6); //max needced 40 int screenDamage = GetValue3Mid(D6); //max needed 999 int screenEffectDuration = GetValue3Low(D6); //max needed 999 //D6: (2)(40)(99.9)(999) int itemNumber = GetValue3High(D7); //max 255 int itemRequired = GetValue3Mid(D7); //max 999 int switchC = GetValue13(D7); //max needed 9 int switchB = GetValue12(D7); //max needed 9 int switchA = GetValue1Lowest(D7); //max needed 9 //D7: (255)(99.9)(9)(9)(9) int startX; //the starting position of the LWeapon sprite (X-axis) int startY; //the starting position of the LWeapon sprite (Y-axis) int startHP = Link->HP; //Needed if you want to include an HP requirement. if (Game->Counter[CR_MAGIC] >= magicCost) //Fill in the numbers for magic consumption and number of projectiles allowed on screen { if (Game->Counter[CR_LIFE] >= lifeCost) //Fill in the numbers for magic consumption and number of projectiles allowed on screen { if (Game->Counter[CR_RUPEES] >= rupeeCost) //Fill in the numbers for magic consumption and number of projectiles allowed on screen { if (Game->Counter[specialCounter] > 0) //If you are using a special counter... { if (Game->Counter[specialCounter] >= specialCost) //Fill in the numbers for magic consumption and number of projectiles allowed on screen { if (screenEffect == 0){ // } else if (ScreenEffect == 1){ Screen->Wavy = screenEffectDuration; //Makes the screen waver slightly while screen flashes and bolt projectile emits. } Game->Counter[CR_MAGIC] -= magicCost; //Spends MP Game->Counter[CR_LIFE] -= lifeCost; //Spends HP Game->Counter[CR_RUPEES] -= rupeeCost; //Spends Rupees if (Game->Counter[specialCounter] >= 0){ //If a special counter exists. Game->Counter[specialCounter] -= specialCost; } if (message > 0){ //If a message exists... Screen->Message(Message); } int args[8] = {D0, D1, D2, D3, D4, D5, D6, D7}; //Sets the colour and duration of the flash in the FFC script. npc enemys; //Reads the enemies on screen... for(int i = 1; i<=Screen->NumNPCs(); i++) //Find out how many enemies are onscreen. { enemys = Screen->LoadNPC(i); //Targets those enemies. enemys->HP-=screenDamage; //Deals (value of D7) damage to all enemies on-screen during flash. } lweapon spell; //Creates the LWeapon Game->PlaySound(spellSFX); //Makes the thunder SFX play. startX = Link->X+8; //Sets starting position of LWeapon based on Link's position (+8 pixels) startY = Link->Y+8; //Sets starting position of LWeapon based on Link's position (+8 pixels) Link->Action = LA_Type; //Produces Link attacking animation. spell = NextToLink(LType, 8); //Create in front of Link. spell->UseSprite(spellSprite); //Sets the sprite to use from Weapons->Misc. if (switchD == 1){ if ( Link->Dir == DIR_DOWN ){ //Sprite selection/rotation spell->Tile++; spell->Flip = 0; } else if ( Link->Dir == DIR_LEFT ){ spell->Flip = 1; } else if ( Link->Dir == DIR_RIGHT ){ spell->Flip = 0; } else if ( Link->Dir == DIR_UP ){ spell->Tile++; spell->Flip = 2; } } spell->Damage = power; //Sets the damage of the projectile. spell->Step = speed; //Sets the Step Speed of the projectile, suggest 200-240. RunFFCScript(Script_ID, args); //Runs the FFC script that makes the screen flash. Link->ItemJinx = NOUSE; } } } } } else{ Game->PlaySound(ErrorSFX); //If out of MP, play ERROR Sound Effects. } } } // ffc script SpellFFCEffects{ void run(int D0, int D1, int D2, int D3, int D4, int D5, int D6, int D7){ int colour = GetValue3Mid(D3); //max needed 255 int duration = GetValue3Low(D3); //max needed 255 while(duration > 0){ if(duration % 2 == 0) Screen->Rectangle(6, 0, 0, 256, 172, colour, 1, 0, 0, 0, true, 64); duration--; Waitframe(); } } }