Advertisement
ZoriaRPG

Scripted ZC (Z1) Bomb and Superbomb

Jun 25th, 2018
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.81 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 ( !super )
  31.         {
  32.             if ( Game->Counter[counter] )
  33.             {
  34.                 if  ( !maxOnscreen )
  35.                 {
  36.                     --Game->Counter[counter];
  37.                     if ( sound ) Game->PlaySound(sound);
  38.                     lweapon bomb = NextToLink(LW_BOMB, dist);
  39.                     itemdata normalBomb = Game->LoadItemData(I_BOMB);
  40.                     //int sprite = normalBomb->UseSprite;
  41.                     bomb->UseSprite(sprite);
  42.                     this->Power = normalBomb->Power;
  43.                     bomb->Dir = Link->Dir;
  44.                     //bomb->Level = normalBomb->Level;
  45.                     //bomb->Counter = normalBomb->Counter;
  46.                     //bomb->MaxIncrement = normalBomb->MaxIncrement;
  47.                     //bomb->Keep = normalBomb->Keep;
  48.                     //bomb->Max = normalBomb->Max;
  49.                     //bomb->Amount = normalBomb->Amount;
  50.                     //bomb->UseSound = normalBomb->UseSound;
  51.                 }
  52.                 else  //maxonscreen
  53.                 {
  54.                     for ( int q = Screen->NumLWeapons(); q > 0 ; --q )
  55.                     {
  56.                         lweapon l = Screen->LoadLWeapon(q);
  57.                         if ( l->ID == LW_BOMB ) ++numBombs;
  58.                     }
  59.                     if ( numBombs < maxOnscreen )
  60.                     {
  61.                         --Game->Counter[counter];
  62.                         if ( sound ) Game->PlaySound(sound);
  63.                         lweapon bomb = NextToLink(LW_BOMB, dist);
  64.                         itemdata normalBomb = Game->LoadItemData(I_BOMB);
  65.                         //int sprite = normalBomb->UseSprite;
  66.                         bomb->UseSprite(sprite);
  67.                         this->Power = normalBomb->Power;
  68.                         bomb->Dir = Link->Dir;
  69.                     }
  70.                     else Game->PlaySound(errorSFX);
  71.                 }
  72.             }
  73.             else Game->PlaySound(errorSFX);
  74.         }
  75.         else //superbomb
  76.         {
  77.             if ( Game->Counter[counter] )
  78.             {
  79.                 if ( !maxOnscreen )
  80.                 {
  81.                     --Game->Counter[counter];
  82.                     if ( sound ) Game->PlaySound(sound);
  83.                     lweapon bomb = NextToLink(LW_SBOMB, dist);
  84.                     itemdata normalBomb = Game->LoadItemData(I_SBOMB);
  85.                     //int sprite = normalBomb->UseSprite;
  86.                     bomb->UseSprite(sprite);
  87.                     this->Power = normalBomb->Power;
  88.                     bomb->Dir = Link->Dir;
  89.                 }
  90.                
  91.                 else // maxOnscreen
  92.                 {
  93.                     for ( int q = Screen->NumLWeapons(); q > 0; --q )
  94.                     {
  95.                         lweapon l = Screen->LoadLWeapon(q);
  96.                         if ( l->ID == LW_SBOMB ) ++numSBombs;
  97.                     }
  98.                     if ( numSBombs < maxOnscreen )
  99.                     {
  100.                         --Game->Counter[counter];
  101.                         Game->PlaySound(sound);
  102.                         lweapon bomb = NextToLink(LW_SBOMB, dist);
  103.                         itemdata normalBomb = Game->LoadItemData(I_SBOMB);
  104.                         //int sprite = normalBomb->UseSprite;
  105.                         bomb->UseSprite(sprite);
  106.                         this->Power = normalBomb->Power;
  107.                         bomb->Dir = Link->Dir;
  108.                     }
  109.                     else Game->PlaySound(errorSFX);
  110.                 }
  111.             }  
  112.             else Game->PlaySound(errorSFX);
  113.         }
  114.     }
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement