SHARE
TWEET

[LWeapon Script] Exploding boomerang

ZoriaRPG Sep 16th, 2019 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Boomerang Explodes on contact with enemy.
  2. //v0.1, 16th September, 2019 by ZoriaRPG
  3. //Do: Damage value for explosion. Defaults to damage power of boomerang + 2.
  4.  
  5. lweapon script exploderang
  6. {
  7.     void run(int explosion_damage)
  8.     {
  9.         while(this->isValid())
  10.         {
  11.             for ( int q = Screen->NumNPCs(); q > 0; --q )
  12.             {
  13.                 npc n = Screen->LoadNPC(q);
  14.                 if ( n->Defense[NPCD_BOOMERANG] != NPCDT_IGNORE && Collision(this, n) )
  15.                 {
  16.                     n->InvFrames = 0;
  17.                     lweapon boom = Screen->CreateLWeapon(LW_BOMBBLAST);
  18.                     boom->X = this->X;
  19.                     boom->Y = this->Y;
  20.                     boom Dir = this->Dir;
  21.                     boom->Step = 0;
  22.                     boom->Damage = ( explosion_damage > 0 ) ? explosion_damage : (this->Power + 2);
  23.                     this->DeadState = WDS_DEAD;
  24.                     Remove(this);
  25.                 }
  26.             }
  27.             Waitframe();
  28.         }
  29.     }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top