Guest User

Untitled

a guest
May 27th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. .float nex_bullets_hit;
  2. .float nex_bullets_fired;
  3.  
  4. void W_Nex_Attack (void)
  5. {
  6. float flying;
  7. flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
  8. self.nex_bullets_fired = self.nex_bullets_fired + 1;
  9.  
  10. W_SetupShot (self, '25 4 -4', TRUE, 5, "weapons/nexfire.wav");
  11.  
  12. yoda = 0;
  13. self.nex_bullets_hit = self.nex_bullets_hit + FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, cvar("g_balance_nex_damage"), cvar("g_balance_nex_force"), WEP_NEX);
  14. if not(self.isbot)
  15. {
  16. string s;
  17. float f;
  18. f = self.nex_bullets_hit / self.nex_bullets_fired;
  19. f = f * 100;
  20. f = rint(f);
  21. s = ftos(f);
  22. sprint(self, "Nexgun Hit%: ",s,"\n");
  23. }
  24.  
  25. if(yoda && flying)
  26. announce(self, "announcer/male/yoda.wav");
  27.  
  28. pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
  29.  
  30. // beam effect
  31. trailparticles(world, particleeffectnum("nex_beam"), w_shotorg, trace_endpos);
  32. // flash and burn the wall
  33. if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
  34. pointparticles(particleeffectnum("nex_impact"), trace_endpos - w_shotdir * 6, '0 0 0', 1);
  35. // play a sound
  36. soundat (self, trace_endpos, CHAN_PROJECTILE, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
  37.  
  38. if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
  39. {
  40. self.ammo_cells = self.ammo_cells - cvar("g_balance_nex_ammo");
  41. }
  42. }
  43.  
  44. void spawnfunc_weapon_nex (void); // defined in t_items.qc
  45.  
  46. float w_nex(float req)
  47. {
  48. if (req == WR_AIM)
  49. self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
  50. else if (req == WR_THINK)
  51. {
  52. if (self.BUTTON_ATCK)
  53. {
  54. if (weapon_prepareattack(0, cvar("g_balance_nex_refire")))
  55. {
  56. W_Nex_Attack();
  57. weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_nex_animtime"), w_ready);
  58. }
  59. }
  60. }
  61. else if (req == WR_PRECACHE)
  62. {
  63. precache_model ("models/nexflash.md3");
  64. precache_model ("models/weapons/g_nex.md3");
  65. precache_model ("models/weapons/v_nex.md3");
  66. precache_model ("models/weapons/w_nex.zym");
  67. precache_sound ("weapons/nexfire.wav");
  68. precache_sound ("weapons/neximpact.wav");
  69. }
  70. else if (req == WR_SETUP)
  71. weapon_setup(WEP_NEX);
  72. else if (req == WR_CHECKAMMO1)
  73. return self.ammo_cells >= cvar("g_balance_nex_ammo");
  74. else if (req == WR_CHECKAMMO2)
  75. return FALSE;
  76. else if (req == WR_SUICIDEMESSAGE)
  77. w_deathtypestring = "did the impossible";
  78. else if (req == WR_KILLMESSAGE)
  79. w_deathtypestring = "has been vaporized by";
  80. return TRUE;
  81. };
Add Comment
Please, Sign In to add comment