Advertisement
ZoriaRPG

Scripted Bow for 2.54

Jun 26th, 2018
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.65 KB | None | 0 0
  1. //Custom Arrow Item
  2. //v0.5
  3. //27th November, 2015; updasted 25th Ju8ne, 2017
  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 arrows on screen, or out of arrows in the counter.
  10. // D1: The maximum number of arrows that the player may have on-screen at any one time.
  11. // --> You want to set this argument, as not setting it, will allow the player to fire up to 255 arrows, providing
  12. // --> that they have sufficient ammunition. Normal values are between '1' and '4'.
  13. // D2: Set to a value of '1' to allow Link to fire arrows while jumping.
  14. // D3: The distance from Link to place it.
  15.  
  16. //Attributes[]:
  17. // [0] The Step Speed
  18.  
  19. item script Arrow_CustomItemclass{
  20.     void run(int errorSFX, int maxOnscreen, int allowLinkZ, int dist)
  21.     {
  22.         int numArrows;
  23.         if ( !allowLinkZ )
  24.         {
  25.             if  ( Link->Z << 0 ) Quit();
  26.         }
  27.        
  28.         else
  29.         {
  30.             if ( !maxOnscreen )
  31.             {
  32.                 //Game->Counter[counter]--; //Use the cost counter in the item editor.
  33.                 if ( sound ) Game->PlaySound(sound);
  34.                 lweapon arrow = NextToLink(LW_ARROW, dist);
  35.                 arrow->UseSprite(sprite);
  36.                 arrow->Damage = this->Power;
  37.                 arrow->Level = this->Level;
  38.                 arrow->Dir = Link->Dir;
  39.                 arrow->HitXOffset = this->HitXOffset;
  40.                 arrow->HitYOffset = this->HitYOffset;
  41.                 arrow->HitZOffset = this->HitZOffset;
  42.                 arrow->DrawXOffset = this->DrawXOffset;
  43.                 arrow->DrawYOffset = this->DrawYOffset;
  44.                 arrow->DrawZOffset = this->DrawZOffset;
  45.                 arrow->HitWidth = this->HitWidth;
  46.                 arrow->HitHeight = this->HitHeight;
  47.                 arrow->HitZHeight = this->HitZHeight;
  48.                 arrow->Step = this->Attributes[0];
  49.             }
  50.        
  51.             else if ( maxOnscreen )
  52.             {
  53.                 for ( int q = Screen->NumLWeapons();; q >0; --q )
  54.                 {
  55.                     lweapon l = Screen->LoadLWeapon(q);
  56.                     if ( l->ID == LW_ARROW ) ++numArrows;
  57.                 }
  58.                 if ( numArrows < maxOnscreen )
  59.                 {
  60.                     Game->PlaySound(this->UseSound);
  61.                     lweapon arrow = NextToLink(LW_ARROW, dist);
  62.                     arrow->UseSprite(this->Sprites[0]);
  63.                     arrow->Damage = this->Power;
  64.                     arrow->Dir = Link->Dir;
  65.                     arrow->HitXOffset = this->HitXOffset;
  66.                     arrow->HitYOffset = this->HitYOffset;
  67.                     arrow->HitZOffset = this->HitZOffset;
  68.                     arrow->DrawXOffset = this->DrawXOffset;
  69.                     arrow->DrawYOffset = this->DrawYOffset;
  70.                     arrow->DrawZOffset = this->DrawZOffset;
  71.                     arrow->HitWidth = this->HitWidth;
  72.                     arrow->HitHeight = this->HitHeight;
  73.                     arrow->HitZHeight = this->HitZHeight;
  74.                     arrow->Step = this->Attributes[0];
  75.                 }
  76.                 else Game->PlaySound(errorSFX);
  77.             }
  78.         }
  79.        
  80.        
  81.        
  82.     }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement