ZoriaRPG

Bow Arrow Quiver Combination

Jun 25th, 2018
176
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import "std.zh"
  2.  
  3. ////////////////////////////////////////////
  4. /// Bow, Arrow, and Quiver Bundle Pickup ///
  5. /// v0.2.1 - 9th July, 2015              ///
  6. /// By: ZoriaRPG                         ///
  7. ////////////////////////////////////////////
  8.    
  9. // Script Arguments
  10. // D0: Number of starting arrows to give with this bow.
  11. // D1: Quiver to Give: Small Quiver ( 74 ), medium Quiver ( 75 ), Large Quiver ( 76 ), Magic Quiver ( 105 ) , or custom.
  12. // D2: Type of arrow to give with bow: Wooden ( 13 ), Silver ( 14 ), Gold ( 57 ), or custom.
  13. // D3: Sound Effect to play: Special Item ( 20 ), or custom.
  14. // D4: Message String ID to display (if any). None ( 0 ), or custom.
  15. // D5: Hold-Up Animation to use: None ( 0 ) , 1-Hand ( 1 ), 2-Hand ( 2 ) , 1-Hand-Water ( 3 ), 2-Hand-Water ( 4 ).
  16. // D6: Bow to give: Bow ( 15 ) , Longbow ( 68 ), or custom. This should match the item ID to which you attach this script!
  17.  
  18. item script BowPickup
  19. {
  20.     void run(int giveArrows, int quiver, int arrowType, int playSFX, int showMessage, int holdUp, int bowID)
  21.     {
  22.         int arrowsMax;
  23.         if ( quiver && !Link->Item[quiver] )
  24.         {
  25.             Link->Item[quiver] = true;
  26.             itemdata quiverIT = Game->LoadItemData(quiver);
  27.             arrowsMax = quiverIT->Max;
  28.         }
  29.         if ( Game->MCounter[CR_ARROWS] < arrowsMax ) Game->MCounter[CR_ARROWS] = arrowsMax;
  30.         if ( arrowType && !Link->Item[arrowType] ) Link->Item[arrowType] = true;
  31.         if ( giveArrows ) Game->Counter[CR_ARROWS] += giveArrows;
  32.         if ( giveArrows < 0 ) Game->Counter[CR_RUPEES] -= giveArrows;
  33.         if ( playSFX ) Game->PlaySound(playSFX);
  34.         if ( holdUp && bowID ) _Bow_HoldUpItem(bowID,holdUp);
  35.         if ( showMessage ) Screen->Message(showMessage);
  36.     }
  37. }
  38.  
  39. import "ffcscript.zh"
  40. const int FFC_DELAYED_ITEM_MESSAGE = 1;
  41.  
  42. item script BowPickupWithFFC{
  43.     void run(int giveArrows, int quiver, int arrowType, int playSFX, int showMessage, int holdUp, int bowID){
  44.         int arrowsMax;
  45.         if ( quiver && !Link->Item[quiver] ) {
  46.             Link->Item[quiver] = true;
  47.             itemdata quiverIT = Game->LoadItemData(quiver);
  48.             arrowsMax = quiverIT->Max;
  49.         }
  50.         if ( Game->MCounter[CR_ARROWS] < arrowsMax ) Game->MCounter[CR_ARROWS] = arrowsMax;
  51.         if ( arrowType && !Link->Item[arrowType] ) Link->Item[arrowType] = true;
  52.         if ( giveArrows ) Game->Counter[CR_ARROWS] += giveArrows;
  53.         if ( giveArrows < 0 ) Game->Counter[CR_RUPEES] -= giveArrows;
  54.         if ( playSFX ) Game->PlaySound(playSFX);
  55.         if ( holdUp && bowID ) _Bow_HoldUpItem(bowID,holdUp);
  56.         int args[1]={showMessage};
  57.         if ( showMessage ) RunFFCScript(FFC_DELAYED_ITEM_MESSAGE,args);
  58.     }
  59. }
  60.  
  61. ffc script DelayedItemMessage{
  62.     void run (int showMessage)
  63.     {
  64.         bool increased = false;
  65.         bool playedMessage = false;
  66.         while(true){
  67.             if ( SBombMaxPlus && !increased )
  68.             {
  69.                 increased = true;
  70.                 Game->MCounter[CR_SBOMBS] += SBombMaxPlus;
  71.                 Waitframes(1);
  72.             }
  73.             if ( showMessage && !playedMessage )
  74.             {
  75.                 playedMessage = true;
  76.                 Screen->Message(showMessage);
  77.             }
  78.             if ( !SBombMaxPlus && !showMessage ) break;
  79.             if ( increased && showMessage ) break;
  80.             Waitframe();
  81.         }
  82.     }
  83. }
  84.  
  85. //Global Constants and Functions
  86.  
  87. //Item Hold-Up Constants
  88. const int ITM_HOLD1LAND = 1;
  89. const int ITM_HOLD2LAND = 2;
  90. const int ITM_HOLD1WATER = 3;
  91. const int ITM_HOLD2WATER = 4;
  92.  
  93. //Global Function to force Link to hold up any item specified as itm, using animation specified by holdType.
  94. void _Bow_HoldUpItem(int itm, int holdType)
  95. {
  96.     if ( holdType == ITM_HOLD1LAND )
  97.     {
  98.         Link->Action = LA_HOLD1LAND;
  99.         Link->HeldItem = itm;
  100.     }
  101.     if ( holdType == ITM_HOLD2LAND )
  102.     {
  103.         Link->Action = LA_HOLD2LAND;
  104.         Link->HeldItem = itm;
  105.     }
  106.     if ( holdType == ITM_HOLD1WATER )
  107.     {
  108.         Link->Action = LA_HOLD1WATER;
  109.         Link->HeldItem = itm;
  110.     }
  111.     if ( holdType == ITM_HOLD2WATER )
  112.     {
  113.         Link->Action = LA_HOLD2WATER;
  114.         Link->HeldItem = itm;
  115.     }
  116. }
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.

×