Advertisement
ZoriaRPG

Scripted ZC (Z1) Bow

Jun 25th, 2018
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.56 KB | None | 0 0
  1. //Custom Bomb item
  2. //v0.5
  3. //27th November, 2015; updated 25th June, 2018
  4.  
  5. //Assign to an item, with the item class 'Custom itemclass', or one of the 'zz###' item classes
  6. //as the 'Action; script.
  7.  
  8. //Arguments:
  9. // D0: The sound to play for dropping the bomb.
  10. // D1: The count er to use. If set to '0', it will default to CR_BOMBS for a normal bomb,
  11. // and CR_SBOMBS for a super bomb. This argument allows you to specify a custom counter.
  12. // D2: The sound effect to play for an error, including too many bombs on screen, or out of bombs in the counter.
  13. // D3: Set to '1' or higher, to make the item srop super bombs. Otherwise, leave at '0'/
  14. // D4: The maximum number of bombs that the player may have on-screen at any one time.
  15. // --> You want to set this argument, as not setting it, will allow the player to drop up to 255 bombs, providing
  16. // --> that they have sufficient ammunition. Normal values are between '1' and '4'.
  17. // D5: Set to a value of '1' to allow Link to drop bombs while jumping.
  18. // D6: The sprite of the bomb when placed.
  19. // D7: The distance from Link to place it.
  20.  
  21. item script BombDrop_CustomItemclass{
  22.     void run(int sound, int counter, int errorSFX, int super, int maxOnscreen, int allowLinkZ, int sprite, int dist){
  23.         int numBombs;
  24.         int numSBombs;
  25.         if ( allowLinkZ )
  26.         {
  27.             if ( Link->Z << 0 )  Quit();
  28.         }
  29.         if ( !counter ) counter = CR_BOMBS;
  30.         if ( !Game->Counter[counter] ) { Game->PlaySound(errorSFX); Quit(); }
  31.         if ( !super )
  32.         {
  33.             if  ( !maxOnscreen )
  34.             {
  35.                 --Game->Counter[counter];
  36.                 if ( sound ) Game->PlaySound(sound);
  37.                 lweapon bomb = NextToLink(LW_BOMB, dist);
  38.                 itemdata normalBomb = Game->LoadItemData(I_BOMB);
  39.                 //int sprite = normalBomb->UseSprite;
  40.                 bomb->UseSprite(sprite);
  41.                 this->Power = normalBomb->Power;
  42.                 //bomb->Level = normalBomb->Level;
  43.                 //bomb->Counter = normalBomb->Counter;
  44.                 //bomb->MaxIncrement = normalBomb->MaxIncrement;
  45.                 //bomb->Keep = normalBomb->Keep;
  46.                 //bomb->Max = normalBomb->Max;
  47.                 //bomb->Amount = normalBomb->Amount;
  48.                 //bomb->UseSound = normalBomb->UseSound;
  49.             }
  50.             else  //maxonscreen
  51.             {
  52.                 for ( int q = Screen->NumLWeapons(); q > 0 ; --q )
  53.                 {
  54.                     lweapon l = Screen->LoadLWeapon(q);
  55.                     if ( l->ID == LW_BOMB ) ++numBombs;
  56.                 }
  57.                 if ( numBombs < maxOnscreen )
  58.                 {
  59.                     --Game->Counter[counter];
  60.                     if ( sound ) Game->PlaySound(sound);
  61.                     lweapon bomb = NextToLink(LW_BOMB, dist);
  62.                     itemdata normalBomb = Game->LoadItemData(I_BOMB);
  63.                     //int sprite = normalBomb->UseSprite;
  64.                     bomb->UseSprite(sprite);
  65.                     this->Power = normalBomb->Power;
  66.                 }
  67.                 else Game->PlaySound(errorSFX);
  68.             }
  69.            
  70.         }
  71.         else //superbomb
  72.         {
  73.             if ( !maxOnscreen )
  74.             {
  75.                 --Game->Counter[counter];
  76.                 if ( sound ) Game->PlaySound(sound);
  77.                 lweapon bomb = NextToLink(LW_SBOMB, dist);
  78.                 itemdata normalBomb = Game->LoadItemData(I_SBOMB);
  79.                 //int sprite = normalBomb->UseSprite;
  80.                 bomb->UseSprite(sprite);
  81.                 this->Power = normalBomb->Power;
  82.             }
  83.            
  84.             else // maxOnscreen
  85.             {
  86.                 for ( int q = Screen->NumLWeapons(); q > 0; --q )
  87.                 {
  88.                     lweapon l = Screen->LoadLWeapon(q);
  89.                     if ( l->ID == LW_SBOMB ) ++numSBombs;
  90.                 }
  91.                 if ( numSBombs < maxOnscreen )
  92.                 {
  93.                     --Game->Counter[counter];
  94.                     Game->PlaySound(sound);
  95.                     lweapon bomb = NextToLink(LW_SBOMB, dist);
  96.                     itemdata normalBomb = Game->LoadItemData(I_SBOMB);
  97.                     //int sprite = normalBomb->UseSprite;
  98.                     bomb->UseSprite(sprite);
  99.                     this->Power = normalBomb->Power;
  100.                 }
  101.                 else Game->PlaySound(errorSFX);
  102.             }
  103.            
  104.         }
  105.     }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement