Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.82 KB | None | 0 0
  1. --[[-------------------------------------------------------------------
  2. Lightsaber Force Powers:
  3. The available powers that the new saber base uses.
  4. Powered by
  5. _ _ _ ___ ____
  6. __ _(_) | |_ / _ \/ ___|
  7. \ \ /\ / / | | __| | | \___ \
  8. \ V V /| | | |_| |_| |___) |
  9. \_/\_/ |_|_|\__|\___/|____/
  10.  
  11. _____ _ _ _
  12. |_ _|__ ___| |__ _ __ ___ | | ___ __ _(_) ___ ___
  13. | |/ _ \/ __| '_ \| '_ \ / _ \| |/ _ \ / _` | |/ _ \/ __|
  14. | | __/ (__| | | | | | | (_) | | (_) | (_| | | __/\__ \
  15. |_|\___|\___|_| |_|_| |_|\___/|_|\___/ \__, |_|\___||___/
  16. |___/
  17. ----------------------------- Copyright 2017, David "King David" Wiltos ]]--[[
  18.  
  19. Lua Developer: King David
  20. Contact: http://steamcommunity.com/groups/wiltostech
  21.  
  22. -- Copyright 2017, David "King David" Wiltos ]]--
  23.  
  24. wOS = wOS or {}
  25.  
  26. wOS.ForcePowers:RegisterNewPower({
  27. name = "Force Leap",
  28. icon = "L",
  29. image = "wos/forceicons/leap.png",
  30. cooldown = 2,
  31. manualaim = false,
  32. description = "Jump longer and higher. Aim higher to jump higher/further.",
  33. action = function( self )
  34. if ( self:GetForce() < 10 || !self.Owner:IsOnGround() ) then return end
  35. self:SetForce( self:GetForce() - 10 )
  36.  
  37. self:SetNextAttack( 0.5 )
  38.  
  39. self.Owner:SetVelocity( self.Owner:GetAimVector() * 512 + Vector( 0, 0, 512 ) )
  40.  
  41. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  42.  
  43. // Trigger the jump animation, yay
  44. self:CallOnClient( "ForceJumpAnim", "" )
  45. return true
  46. end
  47. })
  48.  
  49. wOS.ForcePowers:RegisterNewPower({
  50. name = "Charge",
  51. icon = "CH",
  52. distance = 600,
  53. image = "wos/forceicons/charge.png",
  54. target = 1,
  55. cooldown = 0,
  56. manualaim = false,
  57. description = "Lunge at your enemy",
  58. action = function( self )
  59. local ent = self:SelectTargets( 1, 600 )[ 1 ]
  60. if !IsValid( ent ) then self:SetNextAttack( 0.2 ) return end
  61. if ( self:GetForce() < 20 ) then self:SetNextAttack( 0.2 ) return end
  62. local newpos = ( ent:GetPos() - self.Owner:GetPos() )
  63. newpos = newpos / newpos:Length()
  64. self.Owner:SetLocalVelocity( newpos*700 + Vector( 0, 0, 300 ) )
  65. self:SetForce( self:GetForce() - 20 )
  66. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  67. self.Owner:SetSequenceOverride( "phalanx_a_s2_t1", 5 )
  68. self:SetNextAttack( 1 )
  69. self.AerialLand = true
  70. return true
  71. end
  72. })
  73.  
  74. wOS.ForcePowers:RegisterNewPower({
  75. name = "Force Absorb",
  76. icon = "A",
  77. image = "wos/forceicons/absorb.png",
  78. cooldown = 0,
  79. description = "Hold Mouse 2 to protect yourself from harm",
  80. action = function( self )
  81. if ( self:GetForce() < 1 ) then return end
  82. self:SetForce( self:GetForce() - 0.1 )
  83. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.6 )
  84. self:SetNextAttack( 0.3 )
  85. return true
  86. end
  87. })
  88.  
  89. wOS.ForcePowers:RegisterNewPower({
  90. name = "Saber Throw",
  91. icon = "T",
  92. image = "wos/forceicons/throw.png",
  93. cooldown = 0,
  94. manualaim = false,
  95. description = "Throws your lightsaber. It will return to you.",
  96. action = function(self)
  97. if self:GetForce() < 20 then return end
  98. self:SetForce( self:GetForce() - 20 )
  99. self:SetEnabled(false)
  100. self:SetBladeLength(0)
  101. self:SetNextAttack( 1 )
  102. self:GetOwner():DrawWorldModel(false)
  103.  
  104. local ent = ents.Create("ent_lightsaber_thrown")
  105. ent:SetModel(self:GetWorldModel())
  106. ent:Spawn()
  107. ent:SetBladeLength(self:GetMaxLength())
  108. ent:SetMaxLength(self:GetMaxLength())
  109. ent:SetCrystalColor(self:GetCrystalColor())
  110. ent:SetDarkInner( self:GetDarkInner() )
  111.  
  112. local pos = self:GetSaberPosAng()
  113. ent:SetPos(pos)
  114. pos = pos + self.Owner:GetAimVector() * 750
  115. ent:SetEndPos(pos)
  116. ent:SetOwner(self.Owner)
  117. return true
  118. end
  119. })
  120.  
  121. wOS.ForcePowers:RegisterNewPower({
  122. name = "Force Heal",
  123. icon = "H",
  124. image = "wos/forceicons/heal.png",
  125. cooldown = 0,
  126. target = 1,
  127. manualaim = false,
  128. description = "Heals your target.",
  129. action = function( self )
  130. if ( self:GetForce() < 10 ) then return end
  131. local foundents = 0
  132.  
  133. for k, v in pairs( self:SelectTargets( 1 ) ) do
  134. if ( !IsValid( v ) ) then continue end
  135. foundents = foundents + 1
  136. local ed = EffectData()
  137. ed:SetOrigin( self:GetSaberPosAng() )
  138. ed:SetEntity( v )
  139. util.Effect( "rb655_force_heal", ed, true, true )
  140. v:SetHealth( math.Clamp( v:Health() + 25, 0, v:GetMaxHealth() ) )
  141. end
  142.  
  143. if ( foundents > 0 ) then
  144. self:SetForce( self:GetForce() - 3 )
  145. local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
  146. if not tbl then
  147. tbl = wOS.ExperienceTable[ "Default" ].XPPerHeal
  148. else
  149. tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].XPPerHeal
  150. end
  151. self.Owner:AddSkillXP( tbl )
  152. end
  153. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
  154. self:SetNextAttack( 0.25 )
  155. return true
  156. end
  157. })
  158.  
  159. wOS.ForcePowers:RegisterNewPower({
  160. name = "Group Heal",
  161. icon = "GH",
  162. image = "wos/forceicons/group_heal.png",
  163. cooldown = 0,
  164. manualaim = false,
  165. description = "Heals all around you.",
  166. action = function( self )
  167. if ( self:GetForce() < 75 ) then return end
  168. local players = 0
  169. for _, ply in pairs( ents.FindInSphere( self.Owner:GetPos(), 200 ) ) do
  170. if not IsValid( ply ) then continue end
  171. if not ply:IsPlayer() then continue end
  172. if not ply:Alive() then continue end
  173. if players >= 8 then break end
  174. ply:SetHealth( math.Clamp( ply:Health() + 500, 0, ply:GetMaxHealth() ) )
  175. local ed = EffectData()
  176. ed:SetOrigin( self:GetSaberPosAng() )
  177. ed:SetEntity( ply )
  178. util.Effect( "rb655_force_heal", ed, true, true )
  179. players = players + 1
  180. end
  181. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.6 )
  182. self:SetForce( self:GetForce() - 75 )
  183. local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
  184. if not tbl then
  185. tbl = wOS.ExperienceTable[ "Default" ].XPPerHeal
  186. else
  187. tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].XPPerHeal
  188. end
  189. self.Owner:AddSkillXP( tbl )
  190. return true
  191. end
  192. })
  193.  
  194. wOS.ForcePowers:RegisterNewPower({
  195. name = "Cloak",
  196. icon = "C",
  197. image = "wos/forceicons/cloak.png",
  198. cooldown = 0,
  199. description = "Shrowd yourself with the force for 10 seconds",
  200. action = function( self )
  201. if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
  202. if self.Owner:GetNW2Float( "CloakTime", 0 ) >= CurTime() then return end
  203. self:SetForce( self:GetForce() - 50 )
  204. self:SetNextAttack( 0.7 )
  205. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  206. self.Owner:SetNW2Float( "CloakTime", CurTime() + 10 )
  207. return true
  208. end
  209. })
  210.  
  211. wOS.ForcePowers:RegisterNewPower({
  212. name = "Force Reflect",
  213. icon = "FR",
  214. image = "wos/forceicons/reflect.png",
  215. cooldown = 13,
  216. description = "An eye for an eye",
  217. action = function( self )
  218. if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
  219. if self.Owner:GetNW2Float( "ReflectTime", 0 ) >= CurTime() then return end
  220. self:SetForce( self:GetForce() - 50 )
  221. self:SetNextAttack( 0.7 )
  222. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  223. self.Owner:SetNW2Float( "ReflectTime", CurTime() + 5 )
  224. return true
  225. end
  226. })
  227.  
  228. wOS.ForcePowers:RegisterNewPower({
  229. name = "Rage",
  230. icon = "RA",
  231. image = "wos/forceicons/rage.png",
  232. cooldown = 0,
  233. description = "Unleash your anger",
  234. action = function( self )
  235. if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
  236. if self.Owner:GetNW2Float( "RageTime", 0 ) >= CurTime() then return end
  237. self:SetForce( self:GetForce() - 50 )
  238. self:SetNextAttack( 0.7 )
  239. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  240. self.Owner:SetNW2Float( "RageTime", CurTime() + 10 )
  241. return true
  242. end
  243. })
  244.  
  245. wOS.ForcePowers:RegisterNewPower({
  246. name = "Shadow Strike",
  247. icon = "SS",
  248. distance = 30,
  249. image = "wos/forceicons/shadow_strike.png",
  250. cooldown = 0,
  251. target = 1,
  252. manualaim = false,
  253. description = "From the darkness it preys",
  254. action = function( self )
  255. if self.Owner:GetNW2Float( "CloakTime", 0 ) < CurTime() then return end
  256. local ent = self:SelectTargets( 1, 30 )[ 1 ]
  257. if !IsValid( ent ) then self:SetNextAttack( 0.2 ) return end
  258. if ( self:GetForce() < 50 ) then self:SetNextAttack( 0.2 ) return end
  259. self.Owner:SetSequenceOverride("b_c3_t2", 1)
  260. self:SetForce( self:GetForce() - 50 )
  261. self.Owner:EmitSound( "lightsaber/saber_hit_laser" .. math.random( 1, 4 ) .. ".wav" )
  262. self.Owner:AnimResetGestureSlot( GESTURE_SLOT_CUSTOM )
  263. self.Owner:SetAnimation( PLAYER_ATTACK1 )
  264. ent:TakeDamage( 500, self.Owner, self )
  265. self.Owner:SetNW2Float( "CloakTime", CurTime() + 0.5 )
  266. self:SetNextAttack( 0.7 )
  267. return true
  268. end
  269. })
  270.  
  271. wOS.ForcePowers:RegisterNewPower({
  272. name = "Force Pull",
  273. icon = "PL",
  274. target = 1,
  275. description = "Get over here!",
  276. image = "wos/forceicons/pull.png",
  277. cooldown = 0,
  278. manualaim = false,
  279. action = function( self )
  280. if ( self:GetForce() < 20 ) then return end
  281. local ent = self:SelectTargets( 1 )[ 1 ]
  282. if not IsValid( ent ) then return end
  283. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  284. local newpos = ( self.Owner:GetPos() - ent:GetPos() )
  285. newpos = newpos / newpos:Length()
  286. ent:SetVelocity( newpos*700 + Vector( 0, 0, 300 ) )
  287. self:SetForce( self:GetForce() - 20 )
  288. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.3 )
  289. self:SetNextAttack( 1.5 )
  290. return true
  291. end
  292. })
  293.  
  294. wOS.ForcePowers:RegisterNewPower({
  295. name = "Force Push",
  296. icon = "PH",
  297. target = 1,
  298. distance = 150,
  299. description = "They are no harm at a distance",
  300. image = "wos/forceicons/push.png",
  301. cooldown = 0,
  302. manualaim = false,
  303. action = function( self )
  304. if ( self:GetForce() < 20 ) then return end
  305. local ent = self:SelectTargets( 1 )[ 1 ]
  306. if not IsValid( ent ) then return end
  307. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  308. local newpos = ( self.Owner:GetPos() - ent:GetPos() )
  309. newpos = newpos / newpos:Length()
  310. ent:SetVelocity( newpos*-700 + Vector( 0, 0, 300 ) )
  311. self:SetForce( self:GetForce() - 20 )
  312. self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.3 )
  313. self:SetNextAttack( 1.5 )
  314. return true
  315. end
  316. })
  317.  
  318. wOS.ForcePowers:RegisterNewPower({
  319. name = "Lightning Strike",
  320. icon = "LS",
  321. distance = 600,
  322. image = "wos/forceicons/lightning_strike.png",
  323. cooldown = 0,
  324. target = 1,
  325. manualaim = false,
  326. description = "A focused charge of lightning",
  327. action = function( self )
  328. local ent = self:SelectTargets( 1, 600 )[ 1 ]
  329. if !IsValid( ent ) then self:SetNextAttack( 0.2 ) return end
  330. if ( self:GetForce() < 20 ) then self:SetNextAttack( 0.2 ) return end
  331. self:SetForce( self:GetForce() - 20 )
  332.  
  333. local ed = EffectData()
  334. ed:SetOrigin( self:GetSaberPosAng() )
  335. ed:SetEntity( ent )
  336. util.Effect( "rb655_force_lighting", ed, true, true )
  337.  
  338. local dmg = DamageInfo()
  339. dmg:SetAttacker( self.Owner || self )
  340. dmg:SetInflictor( self.Owner || self )
  341. dmg:SetDamage( 150 )
  342. ent:TakeDamageInfo( dmg )
  343. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  344. self.Owner:EmitSound( Sound( "ambient/atmosphere/thunder1.wav" ) )
  345. if ( !self.SoundLightning ) then
  346. self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
  347. self.SoundLightning:Play()
  348. else
  349. self.SoundLightning:Play()
  350. end
  351. local bullet = {}
  352. bullet.Num = 1
  353. bullet.Src = self.Owner:GetPos() + Vector( 0, 0, 10 )
  354. bullet.Dir = ( ent:GetPos() - ( self.Owner:GetPos() + Vector( 0, 0, 10 ) ) )
  355. bullet.Spread = 0
  356. bullet.Tracer = 1
  357. bullet.Force = 0
  358. bullet.Damage = 0
  359. bullet.AmmoType = "Pistol"
  360. bullet.Entity = self.Owner
  361. bullet.TracerName = "thor_thunder"
  362. self:SetNextAttack( 2 )
  363. self.Owner:FireBullets( bullet )
  364. timer.Create( "test", 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
  365. return true
  366. end
  367. })
  368. wOS.ForcePowers:RegisterNewPower({
  369. name = "Advanced Cloak",
  370. icon = "AC",
  371. image = "wos/forceicons/advanced_cloak.png",
  372. cooldown = 0,
  373. manualaim = false,
  374. description = "Shrowd yourself with the force for 25 seconds",
  375. action = function( self )
  376. if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
  377.  
  378. if self.Owner:GetNW2Float( "CloakTime", 0 ) >= CurTime() then return end
  379. self:SetForce( self:GetForce() - 50 )
  380. self:SetNextAttack( 0.7 )
  381. self:PlayWeaponSound( "lightsaber/force_leap.wav" )
  382. self.Owner:SetNW2Float( "CloakTime", CurTime() + 25 )
  383. return true
  384. end
  385. })
  386.  
  387. wOS.ForcePowers:RegisterNewPower({
  388. name = "Force Lightning",
  389. icon = "L",
  390. target = 1,
  391. image = "wos/forceicons/lightning.png",
  392. cooldown = 0,
  393. manualaim = false,
  394. description = "Torture people ( and monsters ) at will.",
  395. action = function( self )
  396. if ( self:GetForce() < 1 ) then return end
  397.  
  398. local foundents = 0
  399. for id, ent in pairs( self:SelectTargets( 1 ) ) do
  400. if ( !IsValid( ent ) ) then continue end
  401.  
  402. foundents = foundents + 1
  403. local ed = EffectData()
  404. ed:SetOrigin( self:GetSaberPosAng() )
  405. ed:SetEntity( ent )
  406. util.Effect( "thor_thunder", ed, true, true )
  407.  
  408. local dmg = DamageInfo()
  409. dmg:SetAttacker( self.Owner || self )
  410. dmg:SetInflictor( self.Owner || self )
  411. dmg:SetDamage( 8 )
  412. if ( ent:IsNPC() ) then dmg:SetDamage( 1.6 ) end
  413. ent:TakeDamageInfo( dmg )
  414.  
  415. end
  416.  
  417. if ( foundents > 0 ) then
  418. self:SetForce( self:GetForce() - foundents )
  419. if ( !self.SoundLightning ) then
  420. self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
  421. self.SoundLightning:Play()
  422. else
  423. self.SoundLightning:Play()
  424. end
  425.  
  426. timer.Create( "test", 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
  427. end
  428. self:SetNextAttack( 0.1 )
  429. return true
  430. end
  431. })
  432.  
  433. wOS.ForcePowers:RegisterNewPower({
  434. name = "Force Combust",
  435. icon = "C",
  436. target = 1,
  437. description = "Ignite stuff infront of you.",
  438. image = "wos/forceicons/combust.png",
  439. cooldown = 0,
  440. manualaim = false,
  441. action = function( self )
  442.  
  443. local ent = self:SelectTargets( 1 )[ 1 ]
  444.  
  445. if ( !IsValid( ent ) or ent:IsOnFire() ) then self:SetNextAttack( 0.2 ) return end
  446.  
  447. local time = math.Clamp( 512 / self.Owner:GetPos():Distance( ent:GetPos() ), 1, 16 )
  448. local neededForce = math.ceil( math.Clamp( time * 2, 10, 32 ) )
  449.  
  450. if ( self:GetForce() < neededForce ) then self:SetNextAttack( 0.2 ) return end
  451.  
  452. ent:Ignite( time, 0 )
  453. self:SetForce( self:GetForce() - neededForce )
  454.  
  455. self:SetNextAttack( 1 )
  456. return true
  457. end
  458. })
  459.  
  460. wOS.ForcePowers:RegisterNewPower({
  461. name = "Force Repulse",
  462. icon = "R",
  463. image = "wos/forceicons/repulse.png",
  464. description = "Hold to charge for greater distance/damage. Push back everything near you.",
  465. think = function( self )
  466. if ( self:GetNextSecondaryFire() > CurTime() ) then return end
  467. if ( self:GetForce() < 1 ) then return end
  468. if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then return end
  469. if ( !self._ForceRepulse && self:GetForce() < 16 ) then return end
  470.  
  471. if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
  472. if ( !self._ForceRepulse ) then self:SetForce( self:GetForce() - 16 ) self._ForceRepulse = 1 end
  473.  
  474. if ( !self.NextForceEffect or self.NextForceEffect < CurTime() ) then
  475. local ed = EffectData()
  476. ed:SetOrigin( self.Owner:GetPos() + Vector( 0, 0, 36 ) )
  477. ed:SetRadius( 128 * self._ForceRepulse )
  478. util.Effect( "rb655_force_repulse_in", ed, true, true )
  479.  
  480. self.NextForceEffect = CurTime() + math.Clamp( self._ForceRepulse / 20, 0.1, 0.5 )
  481. end
  482.  
  483. self._ForceRepulse = self._ForceRepulse + 0.025
  484. self:SetForce( self:GetForce() - 0.5 )
  485. if ( self:GetForce() > 0.99 ) then return end
  486. else
  487. if ( !self._ForceRepulse ) then return end
  488. end
  489.  
  490. local maxdist = 128 * self._ForceRepulse
  491.  
  492. for i, e in pairs( ents.FindInSphere( self.Owner:GetPos(), maxdist ) ) do
  493. if ( e == self.Owner ) then continue end
  494.  
  495. local dist = self.Owner:GetPos():Distance( e:GetPos() )
  496. local mul = ( maxdist - dist ) / 256
  497.  
  498. local v = ( self.Owner:GetPos() - e:GetPos() ):GetNormalized()
  499. v.z = 0
  500.  
  501. if ( e:IsNPC() && util.IsValidRagdoll( e:GetModel() or "" ) ) then
  502.  
  503. local dmg = DamageInfo()
  504. dmg:SetDamagePosition( e:GetPos() + e:OBBCenter() )
  505. dmg:SetDamage( 48 * mul )
  506. dmg:SetDamageType( DMG_GENERIC )
  507. if ( ( 1 - dist / maxdist ) > 0.8 ) then
  508. dmg:SetDamageType( DMG_DISSOLVE )
  509. dmg:SetDamage( e:Health() * 3 )
  510. end
  511. dmg:SetDamageForce( -v * math.min( mul * 40000, 80000 ) )
  512. dmg:SetInflictor( self.Owner )
  513. dmg:SetAttacker( self.Owner )
  514. e:TakeDamageInfo( dmg )
  515.  
  516. if ( e:IsOnGround() ) then
  517. e:SetVelocity( v * mul * -2048 + Vector( 0, 0, 64 ) )
  518. elseif ( !e:IsOnGround() ) then
  519. e:SetVelocity( v * mul * -1024 + Vector( 0, 0, 64 ) )
  520. end
  521.  
  522. elseif ( e:IsPlayer() && e:IsOnGround() ) then
  523. e:SetVelocity( v * mul * -2048 + Vector( 0, 0, 64 ) )
  524. elseif ( e:IsPlayer() && !e:IsOnGround() ) then
  525. e:SetVelocity( v * mul * -384 + Vector( 0, 0, 64 ) )
  526. elseif ( e:GetPhysicsObjectCount() > 0 ) then
  527. for i = 0, e:GetPhysicsObjectCount() - 1 do
  528. e:GetPhysicsObjectNum( i ):ApplyForceCenter( v * mul * -512 * math.min( e:GetPhysicsObject():GetMass(), 256 ) + Vector( 0, 0, 64 ) )
  529. end
  530. end
  531. end
  532.  
  533. local ed = EffectData()
  534. ed:SetOrigin( self.Owner:GetPos() + Vector( 0, 0, 36 ) )
  535. ed:SetRadius( maxdist )
  536. util.Effect( "rb655_force_repulse_out", ed, true, true )
  537.  
  538. self._ForceRepulse = nil
  539.  
  540. self:SetNextAttack( 1 )
  541.  
  542. self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
  543. end
  544. })
  545.  
  546. wOS.ForcePowers:RegisterNewPower({
  547. name = "Storm",
  548. icon = "STR",
  549. image = "wos/forceicons/storm.png",
  550. cooldown = 3,
  551. description = "Charge for 0.5 seconds, unleash a storm on your enemies",
  552. action = function( self )
  553. if ( self:GetForce() < 100 ) then self:SetNextAttack( 0.2 ) return end
  554. if self.Owner:GetNW2Float( "wOS.SaberAttackDelay", 0 ) >= CurTime() then return end
  555. self:SetForce( self:GetForce() - 100 )
  556. self.Owner:EmitSound( Sound( "npc/strider/charging.wav" ) )
  557. self.Owner:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 0.5 )
  558. local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
  559. local pos = tr.HitPos + Vector( 0, 0, 600 )
  560. local pi = math.pi
  561. local bullet = {}
  562. bullet.Num = 1
  563. bullet.Spread = 0
  564. bullet.Tracer = 1
  565. bullet.Force = 0
  566. bullet.Damage = 1500
  567. bullet.AmmoType = "Pistol"
  568. bullet.Entity = self.Owner
  569. bullet.TracerName = "thor_storm"
  570. timer.Simple( 2, function()
  571. if not IsValid( self.Owner ) then return end
  572. self.Owner:EmitSound( Sound( "ambient/atmosphere/thunder1.wav" ) )
  573. bullet.Src = pos
  574. bullet.Dir = Vector( 0, 0, -1 )
  575. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  576. self.Owner:FireBullets( bullet )
  577. timer.Simple( 0.1, function()
  578. if not IsValid( self.Owner ) then return end
  579. bullet.Src = pos + Vector( 65*math.sin( pi*2/5 ), 65*math.cos( pi*2/5 ), 0 )
  580. bullet.Dir = Vector( 0, 0, -1 )
  581. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  582. self.Owner:FireBullets( bullet )
  583. end )
  584. timer.Simple( 0.2, function()
  585. if not IsValid( self.Owner ) then return end
  586. bullet.Src = pos + Vector( 65*math.sin( pi*4/5 ), 65*math.cos( pi*4/5 ), 0 )
  587. bullet.Dir = Vector( 0, 0, -1 )
  588. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  589. self.Owner:FireBullets( bullet )
  590. end )
  591. timer.Simple( 0.3, function()
  592. if not IsValid( self.Owner ) then return end
  593. bullet.Src = pos + Vector( 65*math.sin( pi*6/5 ), 65*math.cos( pi*6/5 ), 0 )
  594. bullet.Dir = Vector( 0, 0, -1 )
  595. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  596. self.Owner:FireBullets( bullet )
  597. end )
  598. timer.Simple( 0.4, function()
  599. if not IsValid( self.Owner ) then return end
  600. bullet.Src = pos + Vector( 65*math.sin( pi*8/5 ), 65*math.cos( pi*8/5 ), 0 )
  601. bullet.Dir = Vector( 0, 0, -1 )
  602. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  603. self.Owner:FireBullets( bullet )
  604. end )
  605. timer.Simple( 0.5, function()
  606. if not IsValid( self.Owner ) then return end
  607. bullet.Src = pos + Vector( 65*math.sin( 2*pi ), 65*math.cos( 2*pi ), 0 )
  608. bullet.Dir = Vector( 0, 0, -1 )
  609. self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
  610. self.Owner:FireBullets( bullet )
  611. end )
  612. end )
  613. return true
  614. end
  615. })
  616.  
  617. wOS.ForcePowers:RegisterNewPower({
  618. name = "Meditate",
  619. icon = "M",
  620. image = "wos/forceicons/meditate.png",
  621. description = "Relax yourself and channel your energy",
  622. think = function( self )
  623. if self.MeditateCooldown and self.MeditateCooldown >= CurTime() then return end
  624. if ( self.Owner:KeyDown( IN_ATTACK2 ) ) and !self:GetEnabled() and self.Owner:OnGround() then
  625. if !self._ForceMeditating then
  626. self.Owner.SaveAngles = self.Owner:GetAngles()
  627. end
  628. self._ForceMeditating = true
  629. else
  630. self._ForceMeditating = false
  631. end
  632. if self._ForceMeditating then
  633. self.Owner:SetNW2Bool("IsMeditating", true)
  634. if not self._NextMeditateHeal then self._NextMeditateHeal = 0 end
  635. if self._NextMeditateHeal < CurTime() then
  636. self.Owner:SetHealth( math.min( self.Owner:Health() + ( self.Owner:GetMaxHealth()*0.01 ), self.Owner:GetMaxHealth() ) )
  637. if #self.DevestatorList > 0 then
  638. self:SetDevEnergy( self:GetDevEnergy() * 0)
  639. end
  640. local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
  641. if not tbl then
  642. tbl = wOS.ExperienceTable[ "Default" ].Meditation
  643. else
  644. tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].Meditation
  645. end
  646. self.Owner:AddSkillXP( tbl )
  647. self._NextMeditateHeal = CurTime() + 3
  648. end
  649. self.Owner:SetLocalVelocity(Vector(0, 0, 0))
  650. self.Owner:SetMoveType(MOVETYPE_NONE)
  651. self.Owner:SetEyeAngles( self.Owner.SaveAngles )
  652. self.Owner:SetAngles( self.Owner.SaveAngles )
  653. else
  654. self.Owner:SetNW2Bool("IsMeditating", false)
  655. if self:GetMoveType() != MOVETYPE_WALK and self.Owner:GetNW2Float( "wOS.DevestatorTime", 0 ) < CurTime() then
  656. self.Owner:SetMoveType(MOVETYPE_WALK)
  657. end
  658. end
  659. if self.Owner:KeyReleased( IN_ATTACK2 ) then
  660. self.MeditateCooldown = CurTime() + 3
  661. end
  662. end
  663. })
  664.  
  665. wOS.ForcePowers:RegisterNewPower({
  666. name = "Channel Hatred",
  667. icon = "HT",
  668. image = "wos/forceicons/channel_hatred.png",
  669. description = "I can feel your anger",
  670. think = function( self )
  671. if self.ChannelCooldown and self.ChannelCooldown >= CurTime() then return end
  672. if ( self.Owner:KeyDown( IN_ATTACK2 ) ) and !self:GetEnabled() and self.Owner:OnGround() then
  673. self._ForceChanneling = true
  674. else
  675. self._ForceChanneling = false
  676. end
  677. if self.Owner:KeyReleased( IN_ATTACK2 ) then
  678. self.ChannelCooldown = CurTime() + 3
  679. end
  680. if self._ForceChanneling then
  681. if not self._NextChannelHeal then self._NextChannelHeal = 0 end
  682. self.Owner:SetNW2Bool("wOS.IsChanneling", true)
  683. if self._NextChannelHeal < CurTime() then
  684. self.Owner:SetHealth( math.min( self.Owner:Health() + ( self.Owner:GetMaxHealth()*0.01 ), self.Owner:GetMaxHealth() ) )
  685. if #self.DevestatorList > 0 then
  686. self:SetDevEnergy( self:GetDevEnergy() + self.DevCharge + 10 )
  687. end
  688. local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
  689. if not tbl then
  690. tbl = wOS.ExperienceTable[ "Default" ].Meditation
  691. else
  692. tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].Meditation
  693. end
  694. self.Owner:AddSkillXP( tbl )
  695. self._NextChannelHeal = CurTime() + 3
  696. end
  697. self.Owner:SetLocalVelocity(Vector(0, 0, 0))
  698. self.Owner:SetMoveType(MOVETYPE_NONE)
  699. if ( !self.SoundChanneling ) then
  700. self.SoundChanneling = CreateSound( self.Owner, "ambient/levels/citadel/field_loop1.wav" )
  701. self.SoundChanneling:Play()
  702. else
  703. self.SoundChanneling:Play()
  704. end
  705.  
  706. timer.Create( "test", 0.2, 1, function() if ( self.SoundChanneling ) then self.SoundChanneling:Stop() self.SoundChanneling = nil end end )
  707. else
  708. self.Owner:SetNW2Bool("wOS.IsChanneling", false)
  709. if self:GetMoveType() != MOVETYPE_WALK and self.Owner:GetNW2Float( "wOS.DevestatorTime", 0 ) < CurTime() then
  710. self.Owner:SetMoveType(MOVETYPE_WALK)
  711. end
  712. end
  713. if self.Owner:KeyReleased( IN_ATTACK2 ) then
  714. self.ChannelCooldown = CurTime() + 3
  715. end
  716. end
  717. })
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724. wOS.ForcePowers:RegisterNewPower({
  725.  
  726. name = "Force Choke",
  727. icon = "CH",
  728. target = 1,
  729. material = "star/icon/choke.png",
  730. description = "Vader it up!",
  731. action = function( self )
  732. if ( self:GetForce() < 30 || CLIENT ) then return end
  733.  
  734. for id, ent in pairs( self:SelectTargets( 1 ) ) do
  735. if ( !IsValid( ent ) || ent.Chocked ) then continue end
  736. ent.Chocked = true
  737. ent:Freeze(true)
  738. //print( ent, ent:LookupSequence("Choked_Barnacle") )
  739. //PrintTable( ent:GetSequenceList() )
  740. ent:ResetSequence( ent:LookupSequence("Choked_Barnacle") )
  741. //ent:ResetSequence( ent:LookupAttachment("") )
  742. local elev = 150
  743. local time = 1
  744. local entcur = ent:GetPos()
  745. for x = 1, 10 do
  746. timer.Simple( x / 10, function() if ( !IsValid( ent ) ) then return end
  747. ent:Lock()
  748. ent:SetPos( Lerp(x / 10, ent:GetPos(), entcur + Vector(0,0,elev)))
  749. end )
  750. end
  751. timer.Create( "star_choke_"..ent:EntIndex(), time + 3, 1, function() if ( !IsValid( ent ) ) then return end
  752. ent:UnLock()
  753. local dmg = DamageInfo()
  754. ent:Freeze(false) // SEE Robotboy655, one method of fixing choke now if you can be bothered / me run an animtion over it
  755. dmg:SetAttacker( self.Owner || self )
  756. dmg:SetInflictor( self.Owner || self )
  757. ent.Chocked = false
  758. dmg:SetDamage( 250 )
  759. ent:TakeDamageInfo( dmg )
  760.  
  761. end )
  762. self:SetForce( self:GetForce() - 30)
  763. end
  764.  
  765. self:SetNextAttack( 0.1 )
  766. end
  767. })
  768.  
  769.  
  770.  
  771.  
  772.  
  773. wOS.ForcePowers:RegisterNewPower({
  774. name = "Shadow Palm",
  775. icon = "GH",
  776. image = "wos/forceicons/group_heal.png",
  777. cooldown = 5,
  778. target = 1,
  779. description = "Strike Up to 4 Enemys",
  780. action = function(self)
  781. if CLIENT then return end
  782. if self:GetForce() < 80 then return end
  783. local ent = self:SelectTargets( 1 )[1]
  784.  
  785. if (!IsValid(ent)) then return end
  786. if !ent:IsNPC() and !ent:IsPlayer() then return end
  787. --Setup damageinfo
  788. local dmg = DamageInfo()
  789. dmg:SetDamage( 75 )
  790. dmg:SetDamageType( DMG_DIRECT )
  791. dmg:SetInflictor( self.Owner )
  792. dmg:SetAttacker( self.Owner )
  793.  
  794. local Hit = {[ent:EntIndex()] = ent}
  795. local count = 0
  796. for x = 1,4 do
  797. local org = ent:GetPos()
  798. local sound = CreateSound( ent, Sound( self.SwingSound ) )
  799. ent:TakeDamageInfo( dmg )
  800. sound:Play()
  801. timer.Simple(0.75, function()
  802. sound:Stop()
  803. end)
  804. //sound:ChangeVolume( 0, 0 )
  805. // ent = nil
  806.  
  807. for x,y in pairs(ents.FindInSphere(org, 512) ) do
  808. if (y:IsPlayer() or y:IsNPC()) and y != self.Owner and !Hit[y:EntIndex()] then
  809. Hit[y:EntIndex()] = y
  810. ent = y
  811. end
  812. end
  813.  
  814. ent = ent or table.Random(Hit)
  815. if x == 4 then
  816. pos1 = self.Owner:GetPos()
  817. pos2 = ent:GetPos()
  818. self.Owner:SetPos(pos2)
  819. ent:SetPos(pos1)
  820. end
  821. end
  822.  
  823. self.Owner:SetCoolDown(self:GetActiveForcePowerType( self:GetForceType() ).name, 30)
  824. end
  825.  
  826. })
  827.  
  828. wOS.ForcePowers:RegisterNewPower({
  829. name = "Lapis Mirror",
  830. icon = "LM",
  831. distance = 800,
  832. image = "wos/forceicons/advanced_cloak.png",
  833. cooldown = 0,
  834. target = 1,
  835. manualaim = false,
  836. description = "Finally you are free",
  837. action = function( self )
  838. local ent = self:SelectTargets( 1, 600 )[ 1 ]
  839. if !IsValid( ent ) then self:SetNextAttack( 0.2 ) return end
  840. if ( self:GetForce() < 20 ) then self:SetNextAttack( 0.2 ) return end
  841. self:SetForce( self:GetForce() - 20 )
  842.  
  843. local ed = EffectData()
  844. ed:SetOrigin( self:GetSaberPosAng() )
  845. ed:SetEntity( ent )
  846. util.Effect( "watersplash", ed, true, true )
  847.  
  848. local dmg = DamageInfo()
  849. dmg:SetAttacker( self.Owner || self )
  850. dmg:SetInflictor( self.Owner || self )
  851. dmg:SetDamage( 150 )
  852. ent:TakeDamageInfo( dmg )
  853. self.Owner:EmitSound( Sound( "Physics.WaterSplash" ) )
  854. end
  855.  
  856. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement