home *** CD-ROM | disk | FTP | other *** search
/ Superpower (Alt) / SUPERPOWER.iso / q / patch / mbq705 / abomb.qc next >
Encoding:
Text File  |  1996-08-06  |  2.2 KB  |  52 lines

  1. void() W_SetCurrentAmmo;
  2. void() ABomb_Explode;
  3.  
  4. /*
  5. ===========
  6. Spawn_ABomb
  7. ===========
  8. v0.03
  9. By Nick Wilson (nick-man@indra.com)
  10. v0.05b by NoNixLNX2 / tbittih@xgw.fi
  11.  
  12. Creates an A-Bomb that hovers in the air.  It explodes, and
  13. kills everything.  It is set off after 30 seconds or if another player or
  14. monster touches it.  What fun!
  15. Uses:
  16. 50 shells
  17. 100 nails
  18. 100 cells
  19. 25 rockets
  20. hopefully it works some day ;)
  21. */
  22.  
  23. void() Spawn_ABomb =
  24. {
  25.         local entity abomb;                             //Create entity
  26. /* test-block */
  27.         if(self.ammo_shells < 50 || self.ammo_nails < 100 || self.ammo_rockets < 25 || self.ammo_cells < 100)
  28.                 return;                                 //Check for enough ammo
  29.         self.ammo_shells = self.ammo_shells - 50;       //Use up all
  30.         self.ammo_nails = self.ammo_nails - 100;        //the necessary
  31.         self.ammo_rockets = self.ammo_rockets - 25;     //ammo...
  32.         self.ammo_cells = self.ammo_cells - 100;
  33. /* end-of-test-block */
  34.         abomb = spawn();                                //Spawn the abomb
  35.         abomb.owner = self;                             //Who made who?
  36.         setorigin(abomb, self.origin + '32 0 32');      //Put above and in front
  37.         abomb.velocity = '0 0 0';                       //Not goin anywhere
  38.         abomb.flags = FL_FLY;                           //It flies
  39.         setmodel(abomb, "progs/grenade.mdl");           //It's a grenade
  40.         abomb.movetype = MOVETYPE_NONE;                 //It don't move
  41.         abomb.solid = SOLID_BBOX;                       //It's solid...
  42.         setsize(abomb, '0 0 0', '0 0 0');               //Yet not there
  43.         abomb.touch = ABomb_Explode;                    //If touched...
  44.         abomb.nextthink = time + 30;                    //Or not...
  45. //        abomb.nextthink = time + 5; // for testing only
  46.         abomb.think = ABomb_Explode;                    //ka-BOOM!
  47.         abomb.effects=9; // EF_DIMLIGHT && BRIGHTFIELD
  48.         bprint(self.netname);                           //Let everyone know...
  49.         bprint(" sets an A-Bomb\n");
  50.         W_SetCurrentAmmo();                             //Set correct ammo
  51. };
  52.