Guest User

Untitled

a guest
Feb 1st, 2016
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. void() BFG_Expl =
  2. {
  3.  
  4. local vector org;
  5. local entity head;
  6. local float damage;
  7. local entity bfgexpl;
  8.  
  9. self.movetype = MOVETYPE_NONE;
  10. self.velocity = '0 0 0';
  11. self.touch = SUB_Null;
  12. setmodel (self, "progs/bfgexpl.spr");
  13. self.solid = SOLID_NOT;
  14. bfgexpl1 ();
  15.  
  16. //the bfg blast fires deadlier lightning bolts to nearby enemies, comes from BFG orb on impact
  17.  
  18. org = self.origin + '0 0 16';
  19.  
  20. head = findradius(self.origin, 300);
  21. while (head)
  22. {
  23. if (head.takedamage)
  24. {
  25. if(head != self) // if the entity (head) is you (self), skip
  26. {
  27. WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  28. WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
  29. WriteEntity (MSG_BROADCAST, head); // Start position for lightning
  30. WriteCoord (MSG_BROADCAST, org_x); // Your position
  31. WriteCoord (MSG_BROADCAST, org_y);
  32. WriteCoord (MSG_BROADCAST, org_z);
  33. WriteCoord (MSG_BROADCAST, head.origin_x); // entity's position
  34. WriteCoord (MSG_BROADCAST, head.origin_y);
  35. WriteCoord (MSG_BROADCAST, head.origin_z);
  36. damage = 150;
  37. T_Damage (head, self, self.owner, damage);
  38. BFG_Blast(head.origin);
  39. }
  40. }
  41. head = head.chain; // cycle to next head (entity)
  42. }
  43.  
  44. };
  45.  
  46.  
  47. void() BFG_Touch =
  48. {
  49. local float rand;
  50. if (other == self.owner)
  51. return;
  52.  
  53. if (other.solid == SOLID_TRIGGER)
  54. return; // trigger field, do nothing
  55.  
  56. if (pointcontents(self.origin) == CONTENT_SKY)
  57. {
  58. remove(self);
  59. return;
  60. }
  61.  
  62. // hit something that bleeds
  63. if (other.takedamage)
  64. {
  65. if (other.health < 265)
  66. {
  67. spawn_touchblood (32);
  68. T_Damage (other, self, self.owner, 300); //most monsters would gib on impact, so it will keep going. If the body's still in one piece when dying, the orb should explode as they're solid.
  69. }
  70. else
  71. {
  72. spawn_touchblood (32);
  73. WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  74. WriteByte (MSG_BROADCAST, TE_EXPLOSION2);
  75. WriteCoord (MSG_BROADCAST, self.origin_x);
  76. WriteCoord (MSG_BROADCAST, self.origin_y);
  77. WriteCoord (MSG_BROADCAST, self.origin_z);
  78. WriteByte (MSG_BROADCAST, 246);
  79. WriteByte (MSG_BROADCAST, 1);
  80. sound (self, CHAN_WEAPON, "weapons/bfgexp.wav", 1, ATTN_NORM);
  81.  
  82. T_Damage (other, self, self.owner, 300);
  83. BFG_Expl();
  84. remove(self);
  85. }
  86.  
  87. }
  88. else
  89. {
  90. WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  91. WriteByte (MSG_BROADCAST, TE_EXPLOSION2);
  92. WriteCoord (MSG_BROADCAST, self.origin_x);
  93. WriteCoord (MSG_BROADCAST, self.origin_y);
  94. WriteCoord (MSG_BROADCAST, self.origin_z);
  95. WriteByte (MSG_BROADCAST, 246);
  96. WriteByte (MSG_BROADCAST, 1);
  97. sound (self, CHAN_WEAPON, "weapons/bfgexp.wav", 1, ATTN_NORM);
  98.  
  99. BFG_Expl();
  100. remove(self);
  101. }
  102.  
  103. };
Advertisement
Add Comment
Please, Sign In to add comment