Guest User

Untitled

a guest
Dec 25th, 2019
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.27 KB | None | 0 0
  1.  
  2. //Sound,Impact
  3.  
  4. // 1 2 3 4 5
  5. //Dirt, Concrete, Metal, Glass, Flesh
  6.  
  7. // 1 2 3 4 5 6 7 8 9
  8. //Dust, Dirt, Sand, Metal, Smoke, Wood, Glass, Blood, YellowBlood
  9. local mats={
  10. [MAT_ALIENFLESH] ={5,9},
  11. [MAT_ANTLION] ={5,9},
  12. [MAT_BLOODYFLESH] ={5,8},
  13. [45] ={5,8}, // Metrocop heads are a source glitch, they have no enumeration
  14. [MAT_CLIP] ={3,5},
  15. [MAT_COMPUTER] ={4,5},
  16. [MAT_FLESH] ={5,8},
  17. [MAT_GRATE] ={3,4},
  18. [MAT_METAL] ={3,4},
  19. [MAT_PLASTIC] ={2,5},
  20. [MAT_SLOSH] ={5,5},
  21. [MAT_VENT] ={3,4},
  22. [MAT_FOLIAGE] ={1,5},
  23. [MAT_TILE] ={2,5},
  24. [MAT_CONCRETE] ={2,1},
  25. [MAT_DIRT] ={1,2},
  26. [MAT_SAND] ={1,3},
  27. [MAT_WOOD] ={2,6},
  28. [MAT_GLASS] ={4,7},
  29. }
  30.  
  31. local sounds={
  32. [1]={"Bullet.Dirt",},
  33. [2]={"Bullet.Concrete",},
  34. [3]={"Bullet.Metal",},
  35. [4]={"Bullet.Glass",},
  36. [5]={"Bullet.Flesh",},
  37. }
  38.  
  39. function EFFECT:Init(data)
  40. self.Entity = data:GetEntity() // Entity determines what is creating the dynamic light //
  41.  
  42. self.Pos = data:GetOrigin() // Origin determines the global position of the effect //
  43.  
  44. self.Scale = data:GetScale() // Scale determines how large the effect is //
  45. self.Radius = data:GetRadius() or 1 // Radius determines what type of effect to create, default is Concrete //
  46.  
  47. self.DirVec = data:GetNormal() // Normal determines the direction of impact for the effect //
  48. self.PenVec = data:GetStart() // PenVec determines the direction of the round for penetrations //
  49. self.Particles = data:GetMagnitude() // Particles determines how many puffs to make, primarily for "trails" //
  50. self.Angle = self.DirVec:Angle() // Angle is the angle of impact from Normal //
  51. self.DebrizzlemyNizzle = 10+data:GetScale() // Debrizzle my Nizzle is how many "trails" to make //
  52. self.Size = 5*self.Scale // Size is exclusively for the explosion "trails" size //
  53.  
  54. self.Emitter = ParticleEmitter( self.Pos ) // Emitter must be there so you dont get an error //
  55.  
  56.  
  57.  
  58. if self.Scale<1.2 then
  59. sound.Play( "ambient/explosions/explode_" .. math.random(1, 4) .. ".wav", self.Pos, 100, 100 )
  60. else
  61. sound.Play( "Explosion.Boom", self.Pos)
  62. sound.Play( "ambient/explosions/explode_" .. math.random(1, 4) .. ".wav", self.Pos, 100, 100 )
  63. end
  64.  
  65.  
  66. self.Mat=math.ceil(self.Radius)
  67.  
  68.  
  69.  
  70. if mats[self.Mat][2]==1 then self:Dust()
  71. elseif mats[self.Mat][2]==2 then self:Dirt()
  72. elseif mats[self.Mat][2]==3 then self:Sand()
  73. elseif mats[self.Mat][2]==4 then self:Metal()
  74. elseif mats[self.Mat][2]==5 then self:Smoke()
  75. elseif mats[self.Mat][2]==6 then self:Wood()
  76. elseif mats[self.Mat][2]==7 then self:Glass()
  77. elseif mats[self.Mat][2]==8 then self:Blood()
  78. elseif mats[self.Mat][2]==9 then self:YellowBlood()
  79. else self:Smoke()
  80. end
  81.  
  82. end
  83.  
  84. function EFFECT:Dust()
  85.  
  86. for i=1,5 do
  87. local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
  88. if (Flash) then
  89. Flash:SetVelocity( self.DirVec*100 )
  90. Flash:SetAirResistance( 200 )
  91. Flash:SetDieTime( 0.15 )
  92. Flash:SetStartAlpha( 255 )
  93. Flash:SetEndAlpha( 0 )
  94. Flash:SetStartSize( self.Scale*300 )
  95. Flash:SetEndSize( 0 )
  96. Flash:SetRoll( math.Rand(180,480) )
  97. Flash:SetRollDelta( math.Rand(-1,1) )
  98. Flash:SetColor(255,255,255)
  99. end
  100. end
  101.  
  102. for i=1, 20*self.Scale do
  103. local Dust = self.Emitter:Add( "particle/particle_composite", self.Pos )
  104. if (Dust) then
  105. Dust:SetVelocity( self.DirVec * math.random( 100,400)*self.Scale + ((VectorRand():GetNormalized()*300)*self.Scale) )
  106. Dust:SetDieTime( math.Rand( 2 , 3 ) )
  107. Dust:SetStartAlpha( 230 )
  108. Dust:SetEndAlpha( 0 )
  109. Dust:SetStartSize( (50*self.Scale) )
  110. Dust:SetEndSize( (100*self.Scale) )
  111. Dust:SetRoll( math.Rand(150, 360) )
  112. Dust:SetRollDelta( math.Rand(-1, 1) )
  113. Dust:SetAirResistance( 150 )
  114. Dust:SetGravity( Vector( 0, 0, math.Rand(-100, -400) ) )
  115. Dust:SetColor( 80,80,80 )
  116. end
  117. end
  118.  
  119. for i=1, 15*self.Scale do
  120. local Dust = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  121. if (Dust) then
  122. Dust:SetVelocity( self.DirVec * math.random( 100,400)*self.Scale + ((VectorRand():GetNormalized()*400)*self.Scale) )
  123. Dust:SetDieTime( math.Rand( 1 , 5 )*self.Scale )
  124. Dust:SetStartAlpha( 50 )
  125. Dust:SetEndAlpha( 0 )
  126. Dust:SetStartSize( (80*self.Scale) )
  127. Dust:SetEndSize( (100*self.Scale) )
  128. Dust:SetRoll( math.Rand(150, 360) )
  129. Dust:SetRollDelta( math.Rand(-1, 1) )
  130. Dust:SetAirResistance( 250 )
  131. Dust:SetGravity( Vector( math.Rand( -200 , 200 ), math.Rand( -200 , 200 ), math.Rand( 10 , 100 ) ) )
  132. Dust:SetColor( 90,85,75 )
  133. end
  134. end
  135.  
  136. for i=1, 25*self.Scale do
  137. local Debris = self.Emitter:Add( "effects/fleck_cement"..math.random(1,2), self.Pos )
  138. if (Debris) then
  139. Debris:SetVelocity ( self.DirVec * math.random(0,700)*self.Scale + VectorRand():GetNormalized() * math.random(0,700)*self.Scale )
  140. Debris:SetDieTime( math.random( 1, 2) * self.Scale )
  141. Debris:SetStartAlpha( 255 )
  142. Debris:SetEndAlpha( 0 )
  143. Debris:SetStartSize( math.random(5,10)*self.Scale)
  144. Debris:SetRoll( math.Rand(0, 360) )
  145. Debris:SetRollDelta( math.Rand(-5, 5) )
  146. Debris:SetAirResistance( 40 )
  147. Debris:SetColor( 60,60,60 )
  148. Debris:SetGravity( Vector( 0, 0, -600) )
  149. end
  150. end
  151.  
  152. local Angle = self.DirVec:Angle()
  153.  
  154. for i = 1, self.DebrizzlemyNizzle do /// This part makes the trailers ///
  155. Angle:RotateAroundAxis(Angle:Forward(), (360/self.DebrizzlemyNizzle))
  156. local DustRing = Angle:Up()
  157. local RanVec = self.DirVec*math.Rand(1, 5) + (DustRing*math.Rand(2, 5))
  158.  
  159. for k = 3, self.Particles do
  160. local Rcolor = math.random(-20,20)
  161.  
  162. local particle1 = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  163. particle1:SetVelocity((VectorRand():GetNormalized()*math.Rand(1, 2) * self.Size) + (RanVec*self.Size*k*3.5))
  164. particle1:SetDieTime( math.Rand( 0.5, 4 )*self.Scale )
  165.  
  166. particle1:SetStartAlpha( math.Rand( 90, 100 ) )
  167. particle1:SetEndAlpha(0)
  168. particle1:SetGravity((VectorRand():GetNormalized()*math.Rand(5, 10)* self.Size) + Vector(0,0,-50))
  169. particle1:SetAirResistance( 200+self.Scale*20 )
  170. particle1:SetStartSize( (5*self.Size)-((k/self.Particles)*self.Size*3) )
  171. particle1:SetEndSize( (20*self.Size)-((k/self.Particles)*self.Size) )
  172. particle1:SetRoll( math.random( -500, 500 )/100 )
  173.  
  174. particle1:SetRollDelta( math.random( -0.5, 0.5 ) )
  175. particle1:SetColor( 90+Rcolor,87+Rcolor,80+Rcolor )
  176. end
  177. end
  178. end
  179.  
  180. function EFFECT:Dirt()
  181.  
  182. for i=1,5 do
  183. local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
  184. if (Flash) then
  185. Flash:SetVelocity( self.DirVec*100 )
  186. Flash:SetAirResistance( 200 )
  187. Flash:SetDieTime( 0.15 )
  188. Flash:SetStartAlpha( 255 )
  189. Flash:SetEndAlpha( 0 )
  190. Flash:SetStartSize( self.Scale*300 )
  191. Flash:SetEndSize( 0 )
  192. Flash:SetRoll( math.Rand(180,480) )
  193. Flash:SetRollDelta( math.Rand(-1,1) )
  194. Flash:SetColor(255,255,255)
  195. end
  196. end
  197.  
  198. for i=1, 20*self.Scale do
  199. local Dust = self.Emitter:Add( "particle/particle_composite", self.Pos )
  200. if (Dust) then
  201. Dust:SetVelocity( self.DirVec * math.random( 100,400)*self.Scale + ((VectorRand():GetNormalized()*300)*self.Scale) )
  202. Dust:SetDieTime( math.Rand( 2 , 3 ) )
  203. Dust:SetStartAlpha( 230 )
  204. Dust:SetEndAlpha( 0 )
  205. Dust:SetStartSize( (50*self.Scale) )
  206. Dust:SetEndSize( (100*self.Scale) )
  207. Dust:SetRoll( math.Rand(150, 360) )
  208. Dust:SetRollDelta( math.Rand(-1, 1) )
  209. Dust:SetAirResistance( 150 )
  210. Dust:SetGravity( Vector( 0, 0, math.Rand(-100, -400) ) )
  211. Dust:SetColor( 90,83,68 )
  212. end
  213. end
  214.  
  215. for i=1, 15*self.Scale do
  216. local Dust = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  217. if (Dust) then
  218. Dust:SetVelocity( self.DirVec * math.random( 100,400)*self.Scale + ((VectorRand():GetNormalized()*400)*self.Scale) )
  219. Dust:SetDieTime( math.Rand( 1 , 5 )*self.Scale )
  220. Dust:SetStartAlpha( 50 )
  221. Dust:SetEndAlpha( 0 )
  222. Dust:SetStartSize( (80*self.Scale) )
  223. Dust:SetEndSize( (100*self.Scale) )
  224. Dust:SetRoll( math.Rand(150, 360) )
  225. Dust:SetRollDelta( math.Rand(-1, 1) )
  226. Dust:SetAirResistance( 250 )
  227. Dust:SetGravity( Vector( math.Rand( -200 , 200 ), math.Rand( -200 , 200 ), math.Rand( 10 , 100 ) ) )
  228. Dust:SetColor( 90,83,68 )
  229. end
  230. end
  231.  
  232. for i=1, 25*self.Scale do
  233. local Debris = self.Emitter:Add( "effects/fleck_cement"..math.random(1,2), self.Pos )
  234. if (Debris) then
  235. Debris:SetVelocity ( self.DirVec * math.random(0,700)*self.Scale + VectorRand():GetNormalized() * math.random(0,700)*self.Scale )
  236. Debris:SetDieTime( math.random( 1, 2) * self.Scale )
  237. Debris:SetStartAlpha( 255 )
  238. Debris:SetEndAlpha( 0 )
  239. Debris:SetStartSize( math.random(5,10)*self.Scale)
  240. Debris:SetRoll( math.Rand(0, 360) )
  241. Debris:SetRollDelta( math.Rand(-5, 5) )
  242. Debris:SetAirResistance( 40 )
  243. Debris:SetColor( 50,53,45 )
  244. Debris:SetGravity( Vector( 0, 0, -600) )
  245. end
  246. end
  247.  
  248. local Angle = self.DirVec:Angle()
  249.  
  250. for i = 1, self.DebrizzlemyNizzle do /// This part makes the trailers ///
  251. Angle:RotateAroundAxis(Angle:Forward(), (360/self.DebrizzlemyNizzle))
  252. local DustRing = Angle:Up()
  253. local RanVec = self.DirVec*math.Rand(2, 6) + (DustRing*math.Rand(1, 4))
  254.  
  255. for k = 3, self.Particles do
  256. local Rcolor = math.random(-20,20)
  257.  
  258. local particle1 = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  259. particle1:SetVelocity((VectorRand():GetNormalized()*math.Rand(1, 2) * self.Size) + (RanVec*self.Size*k*3.5))
  260. particle1:SetDieTime( math.Rand( 0.5, 4 )*self.Scale )
  261.  
  262. particle1:SetStartAlpha( math.Rand( 90, 100 ) )
  263. particle1:SetEndAlpha(0)
  264. particle1:SetGravity((VectorRand():GetNormalized()*math.Rand(5, 10)* self.Size) + Vector(0,0,-50))
  265. particle1:SetAirResistance( 200+self.Scale*20 )
  266. particle1:SetStartSize( (5*self.Size)-((k/self.Particles)*self.Size*3) )
  267. particle1:SetEndSize( (20*self.Size)-((k/self.Particles)*self.Size) )
  268. particle1:SetRoll( math.random( -500, 500 )/100 )
  269.  
  270. particle1:SetRollDelta( math.random( -0.5, 0.5 ) )
  271. particle1:SetColor( 90+Rcolor,83+Rcolor,68+Rcolor )
  272. end
  273. end
  274. end
  275.  
  276. function EFFECT:Sand()
  277.  
  278. for i=0, 45*self.Scale do // This is the main plume
  279. local Smoke = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  280. if (Smoke) then
  281. Smoke:SetVelocity( self.DirVec * math.random( 50,1000*self.Scale) + VectorRand():GetNormalized()*300*self.Scale )
  282. Smoke:SetDieTime( math.Rand( 1 , 5 )*self.Scale )
  283. Smoke:SetStartAlpha( math.Rand( 100, 120 ) )
  284. Smoke:SetEndAlpha( 0 )
  285. Smoke:SetStartSize( 50*self.Scale )
  286. Smoke:SetEndSize( 120*self.Scale )
  287. Smoke:SetRoll( math.Rand(150, 360) )
  288. Smoke:SetRollDelta( math.Rand(-1, 1) )
  289. Smoke:SetAirResistance( 200 )
  290. Smoke:SetGravity( Vector( 0, 0, math.Rand(-100, -400) ) )
  291. Smoke:SetColor( 90,83,68 )
  292. end
  293. end
  294.  
  295. for i=0, 20*self.Scale do // This is the dirt kickup
  296. local Dust = self.Emitter:Add( "particle/particle_composite", self.Pos )
  297. if (Dust) then
  298. Dust:SetVelocity( self.DirVec * math.random( 100,700)*self.Scale + VectorRand():GetNormalized()*250*self.Scale )
  299. Dust:SetDieTime( math.Rand( 0.5 , 1,5 ) )
  300. Dust:SetStartAlpha( 200 )
  301. Dust:SetEndAlpha( 0 )
  302. Dust:SetStartSize( 60*self.Scale )
  303. Dust:SetEndSize( 90*self.Scale )
  304. Dust:SetRoll( math.Rand(150, 360) )
  305. Dust:SetRollDelta( math.Rand(-1, 1) )
  306. Dust:SetAirResistance( 200 )
  307. Dust:SetGravity( Vector( 0, 0, math.Rand(-100, -400) ) )
  308. Dust:SetColor( 90,83,68 )
  309. end
  310. end
  311.  
  312. for i=0, 25*self.Scale do // Chunkage
  313. local Debris = self.Emitter:Add( "effects/fleck_cement"..math.random(1,2), self.Pos )
  314. if (Debris) then
  315. Debris:SetVelocity ( self.DirVec * math.random(50,900)*self.Scale + VectorRand():GetNormalized() * math.random(0,700)*self.Scale )
  316. Debris:SetDieTime( math.random( 1, 2) * self.Scale )
  317. Debris:SetStartAlpha( 255 )
  318. Debris:SetEndAlpha( 0 )
  319. Debris:SetStartSize( math.random(5,8)*self.Scale )
  320. Debris:SetRoll( math.Rand(0, 360) )
  321. Debris:SetRollDelta( math.Rand(-5, 5) )
  322. Debris:SetAirResistance( 40 )
  323. Debris:SetColor( 53,50,45 )
  324. Debris:SetGravity( Vector( 0, 0, -600) )
  325. end
  326. end
  327.  
  328. for i=0, 25*self.Scale do // Shrapnel
  329. local Shrapnel = self.Emitter:Add( "effects/fleck_cement"..math.random(1,2), self.Pos+self.DirVec )
  330. if (Shrapnel) then
  331. Shrapnel:SetVelocity ( (self.DirVec*700*self.Scale) + (VectorRand():GetNormalized() * 1000*self.Scale) )
  332. Shrapnel:SetDieTime( math.random( 0.3, 0.5) * self.Scale )
  333. Shrapnel:SetStartAlpha( 255 )
  334. Shrapnel:SetEndAlpha( 0 )
  335. Shrapnel:SetStartSize( math.random(4,7)*self.Scale )
  336. Shrapnel:SetRoll( math.Rand(0, 360) )
  337. Shrapnel:SetRollDelta( math.Rand(-5, 5) )
  338. Shrapnel:SetAirResistance( 10 )
  339. Shrapnel:SetColor( 53,50,45 )
  340. Shrapnel:SetGravity( Vector( 0, 0, -600) )
  341. Shrapnel:SetCollide( true )
  342. Shrapnel:SetBounce( 0.8 )
  343. end
  344. end
  345.  
  346. for i=1,5 do // Blast flash
  347. local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
  348. if (Flash) then
  349. Flash:SetVelocity( self.DirVec*100 )
  350. Flash:SetAirResistance( 200 )
  351. Flash:SetDieTime( 0.10 )
  352. Flash:SetStartAlpha( 255 )
  353. Flash:SetEndAlpha( 0 )
  354. Flash:SetStartSize( self.Scale*200 )
  355. Flash:SetEndSize( 0 )
  356. Flash:SetRoll( math.Rand(180,480) )
  357. Flash:SetRollDelta( math.Rand(-1,1) )
  358. Flash:SetColor(255,255,255)
  359. end
  360. end
  361.  
  362. for i=0, 10*self.Scale do
  363. local Smoke = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  364. if (Smoke) then
  365. Smoke:SetVelocity( self.DirVec * math.random( 30,120*self.Scale) + VectorRand():GetNormalized() * math.random( 50,100*self.Scale) )
  366. Smoke:SetDieTime( math.Rand( 0.5 , 1 )*self.Scale )
  367. Smoke:SetStartAlpha( math.Rand( 80, 100 ) )
  368. Smoke:SetEndAlpha( 0 )
  369. Smoke:SetStartSize( 10*self.Scale )
  370. Smoke:SetEndSize( 30*self.Scale )
  371. Smoke:SetRoll( math.Rand(150, 360) )
  372. Smoke:SetRollDelta( math.Rand(-2, 2) )
  373. Smoke:SetAirResistance( 100 )
  374. Smoke:SetGravity( Vector( math.random(-20,20)*self.Scale, math.random(-20,20)*self.Scale, 250 ) )
  375. Smoke:SetColor( 90,83,68 )
  376. end
  377. end
  378.  
  379.  
  380. for i=0, 5*self.Scale do
  381. local Whisp = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  382. if (Whisp) then
  383. Whisp:SetVelocity(VectorRand():GetNormalized() * math.random( 300,600*self.Scale) )
  384. Whisp:SetDieTime( math.Rand( 4 , 10 )*self.Scale/2 )
  385. Whisp:SetStartAlpha( math.Rand( 30, 40 ) )
  386. Whisp:SetEndAlpha( 0 )
  387. Whisp:SetStartSize( 70*self.Scale )
  388. Whisp:SetEndSize( 100*self.Scale )
  389. Whisp:SetRoll( math.Rand(150, 360) )
  390. Whisp:SetRollDelta( math.Rand(-2, 2) )
  391. Whisp:SetAirResistance( 300 )
  392. Whisp:SetGravity( Vector( math.random(-40,40)*self.Scale, math.random(-40,40)*self.Scale, 0 ) )
  393. Whisp:SetColor( 150,150,150 )
  394. end
  395. end
  396.  
  397.  
  398. local Density = 40*self.Scale /// This part is for the dust ring ///
  399. local Angle = self.DirVec:Angle()
  400. for i=0, Density do
  401. Angle:RotateAroundAxis(Angle:Forward(), (360/Density))
  402. local ShootVector = Angle:Up()
  403. local Smoke = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  404. if (Smoke) then
  405. Smoke:SetVelocity( ShootVector * math.Rand(50,700*self.Scale) )
  406. Smoke:SetDieTime( math.Rand( 1 , 4 )*self.Scale )
  407. Smoke:SetStartAlpha( math.Rand( 90, 120 ) )
  408. Smoke:SetEndAlpha( 0 )
  409. Smoke:SetStartSize( 40*self.Scale )
  410. Smoke:SetEndSize( 70*self.Scale )
  411. Smoke:SetRoll( math.Rand(0, 360) )
  412. Smoke:SetRollDelta( math.Rand(-1, 1) )
  413. Smoke:SetAirResistance( 200 )
  414. Smoke:SetGravity( Vector( math.Rand( -200 , 200 ), math.Rand( -200 , 200 ), math.Rand( 10 , 100 ) ) )
  415. Smoke:SetColor( 90,83,68 )
  416. end
  417. end
  418. end
  419.  
  420. function EFFECT:Metal()
  421. sound.Play( "Bullet.Impact", self.Pos)
  422.  
  423. for i=1,5 do // Blast flash
  424. local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
  425. if (Flash) then
  426. Flash:SetVelocity( self.DirVec*100 )
  427. Flash:SetAirResistance( 200 )
  428. Flash:SetDieTime( 0.15 )
  429. Flash:SetStartAlpha( 255 )
  430. Flash:SetEndAlpha( 0 )
  431. Flash:SetStartSize( self.Scale*200 )
  432. Flash:SetEndSize( 0 )
  433. Flash:SetRoll( math.Rand(180,480) )
  434. Flash:SetRollDelta( math.Rand(-1,1) )
  435. Flash:SetColor(255,255,255)
  436. end
  437. end
  438.  
  439. for i=0, 30*self.Scale do
  440. local Whisp = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  441. if (Whisp) then
  442. Whisp:SetVelocity(VectorRand():GetNormalized() * math.random( 200,1000*self.Scale) )
  443. Whisp:SetDieTime( math.Rand( 4 , 10 )*self.Scale/2 )
  444. Whisp:SetStartAlpha( math.Rand( 50, 70 ) )
  445. Whisp:SetEndAlpha( 0 )
  446. Whisp:SetStartSize( 70*self.Scale )
  447. Whisp:SetEndSize( 100*self.Scale )
  448. Whisp:SetRoll( math.Rand(150, 360) )
  449. Whisp:SetRollDelta( math.Rand(-2, 2) )
  450. Whisp:SetAirResistance( 300 )
  451. Whisp:SetGravity( Vector( math.random(-40,40)*self.Scale, math.random(-40,40)*self.Scale, 0 ) )
  452. Whisp:SetColor( 120,120,120 )
  453. end
  454. end
  455.  
  456. for i=0, 30*self.Scale do
  457. local Sparks = self.Emitter:Add( "effects/spark", self.Pos )
  458. if (Sparks) then
  459. Sparks:SetVelocity( ((self.DirVec*0.75)+VectorRand()) * math.Rand(200, 600)*self.Scale )
  460. Sparks:SetDieTime( math.Rand(0.3, 1) )
  461. Sparks:SetStartAlpha( 255 )
  462. Sparks:SetStartSize( math.Rand(7, 15)*self.Scale )
  463. Sparks:SetEndSize( 0 )
  464. Sparks:SetRoll( math.Rand(0, 360) )
  465. Sparks:SetRollDelta( math.Rand(-5, 5) )
  466. Sparks:SetAirResistance( 20 )
  467. Sparks:SetGravity( Vector( 0, 0, -600 ) )
  468. end
  469. end
  470.  
  471. for i=0, 10*self.Scale do
  472. local Sparks = self.Emitter:Add( "effects/yellowflare", self.Pos )
  473. if (Sparks) then
  474. Sparks:SetVelocity( VectorRand() * math.Rand(200, 600)*self.Scale )
  475. Sparks:SetDieTime( math.Rand(1, 1.7) )
  476. Sparks:SetStartAlpha( 200 )
  477. Sparks:SetStartSize( math.Rand(10, 13)*self.Scale )
  478. Sparks:SetEndSize( 0 )
  479. Sparks:SetRoll( math.Rand(0, 360) )
  480. Sparks:SetRollDelta( math.Rand(-5, 5) )
  481. Sparks:SetAirResistance( 100 )
  482. Sparks:SetGravity( Vector( 0, 0, -60 ) )
  483. end
  484. end
  485.  
  486. end
  487.  
  488.  
  489. function EFFECT:Smoke()
  490. sound.Play( "Bullet.Impact", self.Pos)
  491.  
  492. for i=1,5 do // Blast flash
  493. local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
  494. if (Flash) then
  495. Flash:SetVelocity( self.DirVec*100 )
  496. Flash:SetAirResistance( 200 )
  497. Flash:SetDieTime( 0.15 )
  498. Flash:SetStartAlpha( 255 )
  499. Flash:SetEndAlpha( 0 )
  500. Flash:SetStartSize( self.Scale*200 )
  501. Flash:SetEndSize( 0 )
  502. Flash:SetRoll( math.Rand(180,480) )
  503. Flash:SetRollDelta( math.Rand(-1,1) )
  504. Flash:SetColor(255,255,255)
  505. end
  506. end
  507.  
  508. for i=0, 30*self.Scale do
  509. local Whisp = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  510. if (Whisp) then
  511. Whisp:SetVelocity(VectorRand():GetNormalized() * math.random( 200,1200*self.Scale) )
  512. Whisp:SetDieTime( math.Rand( 4 , 10 )*self.Scale/2 )
  513. Whisp:SetStartAlpha( math.Rand( 35, 50 ) )
  514. Whisp:SetEndAlpha( 0 )
  515. Whisp:SetStartSize( 70*self.Scale )
  516. Whisp:SetEndSize( 100*self.Scale )
  517. Whisp:SetRoll( math.Rand(150, 360) )
  518. Whisp:SetRollDelta( math.Rand(-2, 2) )
  519. Whisp:SetAirResistance( 300 )
  520. Whisp:SetGravity( Vector( math.random(-40,40)*self.Scale, math.random(-40,40)*self.Scale, 0 ) )
  521. Whisp:SetColor( 120,120,120 )
  522. end
  523. end
  524.  
  525.  
  526. for i=1, 25*self.Scale do
  527. local Debris = self.Emitter:Add( "effects/fleck_tile"..math.random(1,2), self.Pos )
  528. if (Debris) then
  529. Debris:SetVelocity ( self.DirVec * math.random(100,600)*self.Scale + VectorRand():GetNormalized() * math.random(100,1200)*self.Scale )
  530. Debris:SetDieTime( math.random( 1, 3) * self.Scale )
  531. Debris:SetStartAlpha( 255 )
  532. Debris:SetEndAlpha( 0 )
  533. Debris:SetStartSize( math.random(5,10)*self.Scale)
  534. Debris:SetRoll( math.Rand(0, 360) )
  535. Debris:SetRollDelta( math.Rand(-5, 5) )
  536. Debris:SetAirResistance( 40 )
  537. Debris:SetColor( 70,70,70 )
  538. Debris:SetGravity( Vector( 0, 0, -600) )
  539. end
  540. end
  541.  
  542. local Angle = self.DirVec:Angle()
  543.  
  544. for i = 1, self.DebrizzlemyNizzle do /// This part makes the trailers ///
  545. Angle:RotateAroundAxis(Angle:Forward(), (360/self.DebrizzlemyNizzle))
  546. local DustRing = Angle:Up()
  547. local RanVec = self.DirVec*math.Rand(1, 4) + (DustRing*math.Rand(3, 4))
  548.  
  549. for k = 3, self.Particles do
  550. local Rcolor = math.random(-20,20)
  551.  
  552. local particle1 = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  553. particle1:SetVelocity((VectorRand():GetNormalized()*math.Rand(1, 2) * self.Size) + (RanVec*self.Size*k*3.5))
  554. particle1:SetDieTime( math.Rand( 0, 3 )*self.Scale )
  555.  
  556. particle1:SetStartAlpha( math.Rand( 90, 100 ) )
  557. particle1:SetEndAlpha(0)
  558. particle1:SetGravity((VectorRand():GetNormalized()*math.Rand(5, 10)* self.Size) + Vector(0,0,-50))
  559. particle1:SetAirResistance( 200+self.Scale*20 )
  560. particle1:SetStartSize( (5*self.Size)-((k/self.Particles)*self.Size*3) )
  561. particle1:SetEndSize( (20*self.Size)-((k/self.Particles)*self.Size) )
  562. particle1:SetRoll( math.random( -500, 500 )/100 )
  563.  
  564. particle1:SetRollDelta( math.random( -0.5, 0.5 ) )
  565. particle1:SetColor( 90+Rcolor,85+Rcolor,75+Rcolor )
  566. end
  567. end
  568. end
  569.  
  570. function EFFECT:Wood()
  571.  
  572. for i=1,5 do
  573. local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
  574. if (Flash) then
  575. Flash:SetVelocity( self.DirVec*100 )
  576. Flash:SetAirResistance( 200 )
  577. Flash:SetDieTime( 0.15 )
  578. Flash:SetStartAlpha( 255 )
  579. Flash:SetEndAlpha( 0 )
  580. Flash:SetStartSize( self.Scale*200 )
  581. Flash:SetEndSize( 0 )
  582. Flash:SetRoll( math.Rand(180,480) )
  583. Flash:SetRollDelta( math.Rand(-1,1) )
  584. Flash:SetColor(255,255,255)
  585. end
  586. end
  587.  
  588. for i=0, 30*self.Scale do
  589. local Whisp = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  590. if (Whisp) then
  591. Whisp:SetVelocity(VectorRand():GetNormalized() * math.random( 200,1000)*self.Scale )
  592. Whisp:SetDieTime( math.Rand( 4 , 10 )*self.Scale/2 )
  593. Whisp:SetStartAlpha( math.Rand( 70, 90 ) )
  594. Whisp:SetEndAlpha( 0 )
  595. Whisp:SetStartSize( 70*self.Scale )
  596. Whisp:SetEndSize( 100*self.Scale )
  597. Whisp:SetRoll( math.Rand(150, 360) )
  598. Whisp:SetRollDelta( math.Rand(-2, 2) )
  599. Whisp:SetAirResistance( 300 )
  600. Whisp:SetGravity( Vector( math.random(-40,40)*self.Scale, math.random(-40,40)*self.Scale, 0 ) )
  601. Whisp:SetColor( 90,85,75 )
  602. end
  603. end
  604.  
  605. for i=0, 20*self.Scale do
  606. local Debris = self.Emitter:Add( "effects/fleck_wood"..math.random(1,2), self.Pos+self.DirVec )
  607. if (Debris) then
  608. Debris:SetVelocity( self.DirVec * math.random(50,500)*self.Scale + VectorRand():GetNormalized() * math.random(200,900)*self.Scale )
  609. Debris:SetDieTime( math.random( 0.75, 2) )
  610. Debris:SetStartAlpha( 255 )
  611. Debris:SetEndAlpha( 0 )
  612. Debris:SetStartSize( math.random(10,15)*self.Scale )
  613. Debris:SetRoll( math.Rand(0, 360) )
  614. Debris:SetRollDelta( math.Rand(-5, 5) )
  615. Debris:SetAirResistance( 70 )
  616. Debris:SetColor( 90,85,75 )
  617. Debris:SetGravity( Vector( 0, 0, -600) )
  618. end
  619. end
  620. end
  621.  
  622. function EFFECT:Glass()
  623.  
  624. for i=1,5 do // Blast flash
  625. local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
  626. if (Flash) then
  627. Flash:SetVelocity( self.DirVec*100 )
  628. Flash:SetAirResistance( 200 )
  629. Flash:SetDieTime( 0.15 )
  630. Flash:SetStartAlpha( 255 )
  631. Flash:SetEndAlpha( 0 )
  632. Flash:SetStartSize( self.Scale*200 )
  633. Flash:SetEndSize( 0 )
  634. Flash:SetRoll( math.Rand(180,480) )
  635. Flash:SetRollDelta( math.Rand(-1,1) )
  636. Flash:SetColor(255,255,255)
  637. end
  638. end
  639.  
  640. for i=0, 30*self.Scale do
  641. local Debris = self.Emitter:Add( "effects/fleck_glass"..math.random(1,3), self.Pos )
  642. if (Debris) then
  643. Debris:SetVelocity ( VectorRand():GetNormalized() * math.random(100,600)*self.Scale )
  644. Debris:SetDieTime( math.random( 1, 2.5) )
  645. Debris:SetStartAlpha( 255 )
  646. Debris:SetEndAlpha( 0 )
  647. Debris:SetStartSize( math.random(3,7)*self.Scale )
  648. Debris:SetRoll( math.Rand(0, 360) )
  649. Debris:SetRollDelta( math.Rand(-15, 15) )
  650. Debris:SetAirResistance( 50 )
  651. Debris:SetColor( 200,200,200 )
  652. Debris:SetGravity( Vector( 0, 0, -600) )
  653. Debris:SetCollide( true )
  654. Debris:SetBounce( 0.5 )
  655. end
  656. end
  657.  
  658.  
  659. for i=0, 30*self.Scale do
  660. local Whisp = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  661. if (Whisp) then
  662. Whisp:SetVelocity(VectorRand():GetNormalized() * math.random( 200,800*self.Scale) )
  663. Whisp:SetDieTime( math.Rand( 4 , 10 )*self.Scale/2 )
  664. Whisp:SetStartAlpha( math.Rand( 35, 50 ) )
  665. Whisp:SetEndAlpha( 0 )
  666. Whisp:SetStartSize( 70*self.Scale )
  667. Whisp:SetEndSize( 100*self.Scale )
  668. Whisp:SetRoll( math.Rand(150, 360) )
  669. Whisp:SetRollDelta( math.Rand(-2, 2) )
  670. Whisp:SetAirResistance( 300 )
  671. Whisp:SetGravity( Vector( math.random(-40,40)*self.Scale, math.random(-40,40)*self.Scale, 0 ) )
  672. Whisp:SetColor( 150,150,150 )
  673. end
  674. end
  675.  
  676. end
  677.  
  678. function EFFECT:Blood()
  679. for i=0, 30*self.Scale do // If you recieve over 50,000 joules of energy, you become red mist.
  680. local Smoke = self.Emitter:Add( "particle/particle_composite", self.Pos )
  681. if (Smoke) then
  682. Smoke:SetVelocity( VectorRand():GetNormalized()*math.random(100,600)*self.Scale )
  683. Smoke:SetDieTime( math.Rand( 1 , 2 ) )
  684. Smoke:SetStartAlpha( 80 )
  685. Smoke:SetEndAlpha( 0 )
  686. Smoke:SetStartSize( 30*self.Scale )
  687. Smoke:SetEndSize( 100*self.Scale )
  688. Smoke:SetRoll( math.Rand(150, 360) )
  689. Smoke:SetRollDelta( math.Rand(-2, 2) )
  690. Smoke:SetAirResistance( 400 )
  691. Smoke:SetGravity( Vector( math.Rand(-50, 50) * self.Scale, math.Rand(-50, 50) * self.Scale, math.Rand(0, -200) ) )
  692. Smoke:SetColor( 70,35,35 )
  693. end
  694. end
  695.  
  696. for i=0, 20*self.Scale do // Add some finer details....
  697. local Smoke = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  698. if (Smoke) then
  699. Smoke:SetVelocity( VectorRand():GetNormalized()*math.random(200,600)*self.Scale )
  700. Smoke:SetDieTime( math.Rand( 1 , 4 ) )
  701. Smoke:SetStartAlpha( 120 )
  702. Smoke:SetEndAlpha( 0 )
  703. Smoke:SetStartSize( 30*self.Scale )
  704. Smoke:SetEndSize( 100*self.Scale )
  705. Smoke:SetRoll( math.Rand(150, 360) )
  706. Smoke:SetRollDelta( math.Rand(-2, 2) )
  707. Smoke:SetAirResistance( 400 )
  708. Smoke:SetGravity( Vector( math.Rand(-50, 50) * self.Scale, math.Rand(-50, 50) * self.Scale, math.Rand(-50, -300) ) )
  709. Smoke:SetColor( 70,35,35 )
  710. end
  711. end
  712.  
  713. for i=1,5 do // Into the flash!
  714. local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
  715. if (Flash) then
  716. Flash:SetVelocity( self.DirVec*100 )
  717. Flash:SetAirResistance( 200 )
  718. Flash:SetDieTime( 0.15 )
  719. Flash:SetStartAlpha( 255 )
  720. Flash:SetEndAlpha( 0 )
  721. Flash:SetStartSize( self.Scale*300 )
  722. Flash:SetEndSize( 0 )
  723. Flash:SetRoll( math.Rand(180,480) )
  724. Flash:SetRollDelta( math.Rand(-1,1) )
  725. Flash:SetColor(255,255,255)
  726. end
  727. end
  728.  
  729. for i=1, 20*self.Scale do // Chunkage NOT contained
  730. local Debris = self.Emitter:Add( "effects/fleck_cement"..math.random(1,2), self.Pos-(self.DirVec*5) )
  731. if (Debris) then
  732. Debris:SetVelocity ( VectorRand():GetNormalized() * 400*self.Scale )
  733. Debris:SetDieTime( math.random( 0.3, 0.6) )
  734. Debris:SetStartAlpha( 255 )
  735. Debris:SetEndAlpha( 0 )
  736. Debris:SetStartSize( 8 )
  737. Debris:SetEndSize( 9 )
  738. Debris:SetRoll( math.Rand(0, 360) )
  739. Debris:SetRollDelta( math.Rand(-5, 5) )
  740. Debris:SetAirResistance( 30 )
  741. Debris:SetColor( 70,35,35 )
  742. Debris:SetGravity( Vector( 0, 0, -600) )
  743. Debris:SetCollide( true )
  744. Debris:SetBounce( 0.2 )
  745. end
  746. end
  747.  
  748. end
  749.  
  750. function EFFECT:YellowBlood()
  751. for i=0, 30*self.Scale do // If you recieve over 50,000 joules of energy, you become red mist.
  752. local Smoke = self.Emitter:Add( "particle/particle_composite", self.Pos )
  753. if (Smoke) then
  754. Smoke:SetVelocity( VectorRand():GetNormalized()*math.random(100,600)*self.Scale )
  755. Smoke:SetDieTime( math.Rand( 1 , 2 ) )
  756. Smoke:SetStartAlpha( 80 )
  757. Smoke:SetEndAlpha( 0 )
  758. Smoke:SetStartSize( 30*self.Scale )
  759. Smoke:SetEndSize( 100*self.Scale )
  760. Smoke:SetRoll( math.Rand(150, 360) )
  761. Smoke:SetRollDelta( math.Rand(-2, 2) )
  762. Smoke:SetAirResistance( 400 )
  763. Smoke:SetGravity( Vector( math.Rand(-50, 50) * self.Scale, math.Rand(-50, 50) * self.Scale, math.Rand(0, -200) ) )
  764. Smoke:SetColor( 120,120,0 )
  765. end
  766. end
  767.  
  768. for i=0, 20*self.Scale do // Add some finer details....
  769. local Smoke = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
  770. if (Smoke) then
  771. Smoke:SetVelocity( VectorRand():GetNormalized()*math.random(200,600)*self.Scale )
  772. Smoke:SetDieTime( math.Rand( 1 , 4 ) )
  773. Smoke:SetStartAlpha( 120 )
  774. Smoke:SetEndAlpha( 0 )
  775. Smoke:SetStartSize( 30*self.Scale )
  776. Smoke:SetEndSize( 100*self.Scale )
  777. Smoke:SetRoll( math.Rand(150, 360) )
  778. Smoke:SetRollDelta( math.Rand(-2, 2) )
  779. Smoke:SetAirResistance( 400 )
  780. Smoke:SetGravity( Vector( math.Rand(-50, 50) * self.Scale, math.Rand(-50, 50) * self.Scale, math.Rand(-50, -300) ) )
  781. Smoke:SetColor( 120,120,0 )
  782. end
  783. end
  784.  
  785. for i=1,5 do // Into the flash!
  786. local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
  787. if (Flash) then
  788. Flash:SetVelocity( self.DirVec*100 )
  789. Flash:SetAirResistance( 200 )
  790. Flash:SetDieTime( 0.15 )
  791. Flash:SetStartAlpha( 255 )
  792. Flash:SetEndAlpha( 0 )
  793. Flash:SetStartSize( self.Scale*300 )
  794. Flash:SetEndSize( 0 )
  795. Flash:SetRoll( math.Rand(180,480) )
  796. Flash:SetRollDelta( math.Rand(-1,1) )
  797. Flash:SetColor(255,255,255)
  798. end
  799. end
  800.  
  801. for i=1, 20*self.Scale do // Chunkage NOT contained
  802. local Debris = self.Emitter:Add( "effects/fleck_cement"..math.random(1,2), self.Pos-(self.DirVec*5) )
  803. if (Debris) then
  804. Debris:SetVelocity ( VectorRand():GetNormalized() * 400*self.Scale )
  805. Debris:SetDieTime( math.random( 0.3, 0.6) )
  806. Debris:SetStartAlpha( 255 )
  807. Debris:SetEndAlpha( 0 )
  808. Debris:SetStartSize( 8 )
  809. Debris:SetEndSize( 9 )
  810. Debris:SetRoll( math.Rand(0, 360) )
  811. Debris:SetRollDelta( math.Rand(-5, 5) )
  812. Debris:SetAirResistance( 30 )
  813. Debris:SetColor( 120,120,0 )
  814. Debris:SetGravity( Vector( 0, 0, -600) )
  815. Debris:SetCollide( true )
  816. Debris:SetBounce( 0.2 )
  817. end
  818. end
  819. end
  820.  
  821.  
  822. function EFFECT:Think( )
  823. return false
  824. end
  825.  
  826.  
  827. function EFFECT:Render()
  828.  
  829. end
Advertisement
Add Comment
Please, Sign In to add comment