Advertisement
ZoriaRPG

Scripted Bomb and Superbomb for 2.54

Jun 26th, 2018
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.69 KB | None | 0 0
  1. //Custom Bomb item
  2. //v0.6 for ZC 2.54+
  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 effect to play for an error, including too many bombs on screen, or out of bombs in the counter.
  10. // D1: Set to '1' or higher, to make the item srop super bombs. Otherwise, leave at '0'/
  11. // D2: The maximum number of bombs that the player may have on-screen at any one time.
  12. // --> You want to set this argument, as not setting it, will allow the player to drop up to 255 bombs, providing
  13. // --> that they have sufficient ammunition. Normal values are between '1' and '4'.
  14. // D3: Set to a value of '1' to allow Link to drop bombs while jumping.
  15. // D4: The distance from Link to place it.
  16.  
  17. item script BombDrop_CustomItemclass{
  18.     void run(int errorSFX, int super, int maxOnscreen, int allowLinkZ, int dist){
  19.         int numBombs;
  20.         int numSBombs;
  21.         if ( allowLinkZ )
  22.         {
  23.             if ( Link->Z << 0 )  Quit();
  24.         }
  25.         if ( !super )
  26.         {
  27.             if  ( !maxOnscreen )
  28.             {
  29.                 //--Game->Counter[counter]; //Use the cost counter in 2.54 Item Editor
  30.                 Game->PlaySound(this->UseSound);
  31.                 lweapon bomb = NextToLink(LW_BOMB, dist);
  32.                 bomb->UseSprite(this->Sprites[0]);
  33.                 bomb->Damage = this->Power;
  34.                 bomb->Dir = Link->Dir;
  35.                 //bomb->Level = this->Level;
  36.             }
  37.             else  //maxonscreen
  38.             {
  39.                 for ( int q = Screen->NumLWeapons(); q > 0 ; --q )
  40.                 {
  41.                     lweapon l = Screen->LoadLWeapon(q);
  42.                     if ( l->ID == LW_BOMB ) ++numBombs;
  43.                 }
  44.                 if ( numBombs < maxOnscreen )
  45.                 {
  46.                     //--Game->Counter[counter];
  47.                     Game->PlaySound(this->UseSound);
  48.                     lweapon bomb = NextToLink(LW_BOMB, dist);
  49.                     bomb->UseSprite(this->Sprites[0]);
  50.                     bomb->Damage = this->Power;
  51.                     bomb->Dir = Link->Dir;
  52.                 }
  53.                 else Game->PlaySound(errorSFX);
  54.             }
  55.            
  56.         }
  57.         else //superbomb
  58.         {
  59.             if ( !maxOnscreen )
  60.             {
  61.                 //--Game->Counter[counter];
  62.                 Game->PlaySound(this->UseSound);
  63.                 lweapon bomb = NextToLink(LW_SBOMB, dist);
  64.                 bomb->UseSprite(this->Sprites[0]);
  65.                 bomb->Damage = this->Power;
  66.                 bomb->Dir = Link->Dir;
  67.             }
  68.            
  69.             else // maxOnscreen
  70.             {
  71.                 for ( int q = Screen->NumLWeapons(); q > 0; --q )
  72.                 {
  73.                     lweapon l = Screen->LoadLWeapon(q);
  74.                     if ( l->ID == LW_SBOMB ) ++numSBombs;
  75.                 }
  76.                 if ( numSBombs < maxOnscreen )
  77.                 {
  78.                     //--Game->Counter[counter];
  79.                     Game->PlaySound(this->UseSound);
  80.                     lweapon bomb = NextToLink(LW_SBOMB, dist);
  81.                     bomb->UseSprite(this->Sprites[0]);
  82.                     bomb->Damage = this->Power;
  83.                     bomb->Dir = Link->Dir;
  84.                 }
  85.                 else Game->PlaySound(errorSFX);
  86.             }
  87.            
  88.         }
  89.     }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement