import "std.zh" import "ffcscript.zh" //import "string.zh" //import "ghost.zh" //const int SFX_ERROR = 0; //In case you want an error SFX const int SFX_MAGICCHARGE = 53; const int SFX_LIGHTARROW = 1; const int lightColor = 134; //Color of the charging ring: CSet# * 16 + color# (from 0 to 15) const int WPS_NONE = 101; //Weapon sprite with an empty tile (for superlight arrow) //Item power: Same scale as any other item's damage stat //D0: Time (in frames) to charge the arrow (Recommended: 25) //D1: Weap/Misc sprite to use (34 is golden arrow sprite) //D2: Magic required (expended as you start charging) (8) //D3: Speed of the arrow (same scale as enemy step speed) (500 for normal; 2500 for super) //D4: # of the FFC script (check as you assign it to a slot) item script lightArrow{ void run(int chargeTime, int arrowSprite, int magicCost, int speed, int ffcScriptNum){ if ( Game->Counter[CR_MAGIC] < magicCost || !Game->Counter[CR_ARROWS] ){ Game->PlaySound(SFX_ERROR); //Comment out to remove error SFX return; } if(CountFFCsRunning(ffcScriptNum) == 0){ int args[4] = {this->Power*2, chargeTime, arrowSprite, speed}; Game->Counter[CR_MAGIC] -= magicCost; RunFFCScript(ffcScriptNum, args); } } } ffc script lightArrowFFC{ void run(int power, int chargeTime, int arrowSprite, int speed){ int startHP = Link->HP; lweapon lArrow; Game->PlaySound(SFX_MAGICCHARGE); for(int i = chargeTime; i > 0; i--){ //Charge duration NoAction(); //Freeze Link //Display charging animation: gold circle (non-filled) appears and shrinks (radius) Screen->Circle ( 7, Link->X+8, Link->Y+8, 20*i/chargeTime, lightColor, 1, 0, 0, 0, false, 64 ); if ( Link->HP < startHP ) return; //If Link is hurt, quit Waitframe(); } //Charging done! Shoot that arrow! Link->Action = LA_ATTACKING; Game->Counter[CR_ARROWS]--; Game->PlaySound(SFX_LIGHTARROW); lArrow = NextToLink(LW_ARROW, 8); //Create in front of Link lArrow->UseSprite(arrowSprite); //Graphics lArrow->Damage = power; //Damage lArrow->Step = speed; //Speed if ( Link->Dir == DIR_DOWN ){ //Sprite selection/rotation lArrow->Flip = 3; } else if ( Link->Dir == DIR_LEFT ){ lArrow->Tile++; lArrow->Flip = 1; } else if ( Link->Dir == DIR_RIGHT ){ lArrow->Tile++; } } } ffc script superLightArrowFFC{ void run(int power, int chargeTime, int arrowSprite, int speed){ int startX; int startY; int startHP = Link->HP; lweapon lArrow; Game->PlaySound(SFX_MAGICCHARGE); for(int i = chargeTime; i > 0; i--){ //Charge duration NoAction(); //Freeze Link //Display charging animation: random lines from Link of random length for ( int j = 0; j < 5; j++ ){ int angle = Rand(360); Screen->Arc(7, Link->X+8, Link->Y+8, Rand(50)+1, angle, angle+1, lightColor, 1, 0, 0, 0, true, false, 128); } if ( Link->HP < startHP ) return; //If Link is hurt, quit Waitframe(); } //Charging done! Shoot that arrow! startX = Link->X+8; startY = Link->Y+8; Link->Action = LA_ATTACKING; Game->Counter[CR_ARROWS]--; Game->PlaySound(SFX_LIGHTARROW); lArrow = NextToLink(LW_ARROW, 8); //Create in front of Link lArrow->UseSprite(WPS_NONE); //Graphics (invisible) lArrow->Damage = power; //Damage lArrow->Step = speed; //Speed for ( int i = 0; i < 30; i++ ){ //For 30 frames Screen->Line(4, startX, startY, lArrow->X+8, lArrow->Y+8, lightColor, 1, 0, 0, 0, 128); //Draw a line from Link to the arrow lArrow->DeadState = WDS_ALIVE; //Keep it alive at all times Waitframe(); } lArrow->DeadState = WDS_DEAD; } } //Usable Clock (Or other things??) //D0 - Item to use for clock.(or whatever) If doing clock, this needs to be a clock item with duration set. //Note: The default clock item is 4. //D1 - Amount of time to Jinx link. (0 for no Jinx) //Note: The Jinx can be used to create a small pause before the item //can be used again. You can also make it the clock duration, but this //is only recommended in quests that aren't using the B+A item setting //configuration. item script usedclock{ void run(int clockitem, int jinxtime){ item givenclock = Screen->CreateItem(4); givenclock->X = Link->X; givenclock->Y = Link->Y; givenclock->Z = Link->Z; Link->ItemJinx = 2; } } //Timestop Scroll item script timestopscroll{ void run(int clockitem, int jinxtime){ if (Game->Counter[CR_SCRIPT1] >= 1){ Game->Counter[CR_SCRIPT1] -= 1; item givenclock = Screen->CreateItem(4); givenclock->X = Link->X; givenclock->Y = Link->Y; givenclock->Z = Link->Z; Link->ItemJinx = 2; } else{ Game->PlaySound(errorsfx); } } } //Script above works, but item vanishes from in entory on 1st use; counter remains intact. How do I keep it in inventory? //Magical Key //D0 - Item to use for clock.(or whatever) If doing clock, this needs to be a clock item with duration set. //Note: The default clock item is 4. //D1 - Amount of time to Jinx link. (0 for no Jinx) //Note: The Jinx can be used to create a small pause before the item //can be used again. You can also make it the clock duration, but this //is only recommended in quests that aren't using the B+A item setting //configuration. item script magicalkey{ void run(int keyitem, int jinxtime){ item givenkey = Screen->CreateItem(9); givenkey->X = Link->X; givenkey->Y = Link->Y; givenkey->Z = Link->Z; Link->ItemJinx = 0; } } int healsfx = 39; //Sound effect to play when Link is healed int errorsfx = 65; //Sound effect to play when Link's HP is full or MP is empty item script heal6heart{ void run(int m, int h){ if(Link->MP >= m && Link->HP < Link->MaxHP){ Link->HP += 96; Link->MP -= 64; Game->PlaySound(39); } else{ Game->PlaySound(errorsfx); } } } item script heal12heart{ void run(int m, int h){ if(Link->MP >= m && Link->HP < Link->MaxHP){ Link->HP += 196; Link->MP -= 200; Game->PlaySound(39); } else{ Game->PlaySound(errorsfx); } } } item script restoremagic{ void run(int m, int h){ if(Link->HP >= m && Link->MP < Link->MaxMP){ Link->HP += 0; Link->MP += 200; Game->PlaySound(healsfx); } else{ Game->PlaySound(errorsfx); } } } //D0 = Rupeegain ffc script GetRupees{ void run(int rup){ Game->Counter[CR_RUPEES]+rup; } } //Rupee Loss - Jinx ffc script LoseRupees{ void run(int rup){ Game->Counter[CR_RUPEES]-rup; } } //Mirror Teleporter Script const int SFX_MIRROR = 62; //Sound on successful warp const int SFX_ERROR = 61; //SFX number of an error sound const int CMB_AUTOWARPA = 0; //Transparent combo with "Auto Side Warp A" combo type item script mirror{ void run (){ int targetDMap; //DMap to warp to int targetMap; //Map (not DMap) to warp to if (Game->GetCurDMap() == 1){ //First possible DMap targetDMap = 1; //Sample origin/destination DMap change targetMap = 2; } else if (Game->GetCurDMap() == 2){ //Second DMap targetDMap = 0; //All other ones start with "else" targetMap = 1; } else{ //Invalid DMap Game->PlaySound(SFX_ERROR); return; } if ( Game->GetComboSolid(targetMap, Game->GetCurScreen(), ComboAt(Link->X+8,Link->Y+8)) ){ Game->PlaySound(SFX_ERROR); return; } Game->PlaySound(SFX_MIRROR); Screen->SetSideWarp(0, Game->GetCurDMapScreen(), targetDMap, WT_IWARPWAVE); Screen->ComboD[0] = CMB_AUTOWARPA; //Trigger the warp } } // //Timestop Scroll Item //const int CR_TSCROLL = 0; //Game->Counter(CR_TSCROLL) == 0; //bool CanPickupTScroll //{ // return(Game->Counter(CR_TSCROLL) = < 255) //} item script pickupsernaran{ void run(int m){ item givenitem = Screen->CreateItem(143); givenitem->X = Link->X; givenitem->Y = Link->Y; givenitem->Z = Link->Z; } } //item script increaseMaximumDCounterCount //{ //void run(int increaseitem1, int increaseItemAmount1, int valueid, int increaseItemAmount2) //{ //if (Link->Item[(increaseitem1)] == 1) //{ // Game->MCounter[valueid] = increaseItemAmount1; //Game->Counter[valueid] += 1; //Adds +1 to the same counter. Avoids need to setup counter info for item. //} //} //} item script increaseMaximumDCounterCount { void run(int increaseitem1, int increaseItemAmount1, int valueid, int increaseItemAmount2) { if (Link->Item[(increaseitem1)] == 1) { Game->MCounter[valueid] = increaseItemAmount1; } } } global script hpmpcounters{ void run(){ while(true) { Game->Counter[CR_SCRIPT2] = Link->HP; Game->Counter[CR_SCRIPT3] = Link->MP; Game->Counter[CR_SCRIPT4] = Link->MaxHP; Game->Counter[CR_SCRIPT5] = Link->MaxMP; { if (Link->Item[231] == true) //If Link has the fake item designated in D0 { Link->Item[230] = false; //Removes the fake item user selects in D0 Link->Item[231] = false; //Removes the item the user selects in in D1 Link->MP += 256; //Increases MP by value of D3 Link->MaxMP += 256; //Increases Max MP by value of D2 } else (Link->Item[230] == true); //Gives Link the specified item in D4.{ Waitframe(); } } } } //Enemies thqat break the hpmpcountrs script are Green Dragon Moldorm 10 Moldorm 20 digdogger Kid and BS Dodongo item script mcp2{ void run(int m){ Link->Item[230] = false; item givenitem = Screen->CreateItem(58); givenitem->X = Link->X; givenitem->Y = Link->Y; givenitem->Z = Link->Z; } } ////D0:Is the fake item you pick up ////D1:Is the item that will disapear ////D2:Is the amount of Max MP gained ////D3:Is the amount of MP refill ////D4:Is item given if D0 is not in inventory. //ffc script MCP3{ // void run(int i, int j, int k, int mg, int mx) // { // while(true) // { // if (Link->Item[i] == true) //If Link has the fake item designated in D0 // { // Link->Item[i] = false; //Removes the fake item user selects in D0 // Link->Item[j] = false; //Removes the item the user selects in in D1 // Link->MP[mg]; //Increases MP by value of D3 // Link->MaxMP[mx]; //Increases Max MP by value of D2 // } // else (Link->Item[k] == true); //Gives Link the specified item in D4.{ // Waitframe(); // } // } //} //D0:Is the fake item you pick up //D1:Is the item that will disapear //D2:Is the amount of Max MP gained //D3:Is the amount of MP refill //D4:Is item given if D0 is not in inventory. ffc script MCP4{ void run(int i, int j, int k, int mg, int mx) { while(true) { if (Link->Item[i] == true) //If Link has the fake item designated in D0 { Link->Item[i] = false; //Removes the fake item user selects in D0 Link->Item[j] = false; //Removes the item the user selects in in D1 Link->MP += 256; //Increases MP by value of D3 Link->MaxMP += 256; //Increases Max MP by value of D2 } else (Link->Item[k] == true); //Gives Link the specified item in D4.{ Waitframe(); } } } //D0:Is the fake item you pick up //D1:Is the item that will disapear //D2:Is the amount of Max MP gained //D3:Is the amount of MP refill //D4:Is item given if D0 is not in inventory. item script MCP4I{ void run(int i, int j, int k, int mg, int mx) { while(true) { if (Link->Item[i] == true) //If Link has the fake item designated in D0 { Link->Item[i] = false; //Removes the fake item user selects in D0 Link->Item[j] = false; //Removes the item the user selects in in D1 Link->MP += 256; //Increases MP by value of D3 Link->MaxMP += 256; //Increases Max MP by value of D2 } else (Link->Item[k] == true); //Gives Link the specified item in D4.{ Waitframe(); } } }