Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[-------------------------------------------------------------------
- Lightsaber Force Powers:
- The available powers that the new saber base uses.
- Powered by
- _ _ _ ___ ____
- __ _(_) | |_ / _ \/ ___|
- \ \ /\ / / | | __| | | \___ \
- \ V V /| | | |_| |_| |___) |
- \_/\_/ |_|_|\__|\___/|____/
- _____ _ _ _
- |_ _|__ ___| |__ _ __ ___ | | ___ __ _(_) ___ ___
- | |/ _ \/ __| '_ \| '_ \ / _ \| |/ _ \ / _` | |/ _ \/ __|
- | | __/ (__| | | | | | | (_) | | (_) | (_| | | __/\__ \
- |_|\___|\___|_| |_|_| |_|\___/|_|\___/ \__, |_|\___||___/
- |___/
- ----------------------------- Copyright 2017, David "King David" Wiltos ]]--[[
- Lua Developer: King David
- Contact: http://steamcommunity.com/groups/wiltostech
- -- Copyright 2017, David "King David" Wiltos ]]--
- wOS = wOS or {}
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Leap",
- icon = "L",
- image = "wos/forceicons/leap.png",
- cooldown = 2,
- manualaim = false,
- description = "Jump longer and higher. Aim higher to jump higher/further.",
- action = function( self )
- if ( self:GetForce() < 10 || !self.Owner:IsOnGround() ) then return end
- self:SetForce( self:GetForce() - 10 )
- self:SetNextAttack( 0.5 )
- self.Owner:SetVelocity( self.Owner:GetAimVector() * 512 + Vector( 0, 0, 512 ) )
- self:PlayWeaponSound( "lightsaber/force_leap.wav" )
- // Trigger the jump animation, yay
- self:CallOnClient( "ForceJumpAnim", "" )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Charge",
- icon = "CH",
- distance = 600,
- image = "wos/forceicons/charge.png",
- target = 1,
- cooldown = 0,
- manualaim = false,
- description = "Lunge at your enemy",
- action = function( self )
- local ent = self:SelectTargets( 1, 600 )[ 1 ]
- if !IsValid( ent ) then self:SetNextAttack( 0.2 ) return end
- if ( self:GetForce() < 20 ) then self:SetNextAttack( 0.2 ) return end
- local newpos = ( ent:GetPos() - self.Owner:GetPos() )
- newpos = newpos / newpos:Length()
- self.Owner:SetLocalVelocity( newpos*700 + Vector( 0, 0, 300 ) )
- self:SetForce( self:GetForce() - 20 )
- self:PlayWeaponSound( "lightsaber/force_leap.wav" )
- self.Owner:SetSequenceOverride( "phalanx_a_s2_t1", 5 )
- self:SetNextAttack( 1 )
- self.AerialLand = false
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Absorb",
- icon = "A",
- image = "wos/forceicons/absorb.png",
- cooldown = 0,
- description = "Hold Mouse 2 to protect yourself from harm",
- action = function( self )
- if ( self:GetForce() < 1 ) then return end
- self:SetForce( self:GetForce() - 0.1 )
- self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.6 )
- self:SetNextAttack( 0.3 )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Unrelenting Advance",
- icon = "UA",
- image = "wos/forceicons/absorb.png",
- cooldown = 0,
- description = "Hold Mouse 2 to protect yourself from harm",
- action = function( self )
- if ( self:GetForce() < 1 ) then return end
- self:SetForce( self:GetForce() - 0.1 )
- self.Owner:SetNW2Float( "wOS.GrievousAnim", CurTime() + 0.6 )
- self:SetNextAttack( 0.3 )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Saber Throw",
- icon = "T",
- image = "wos/forceicons/throw.png",
- cooldown = 0,
- manualaim = false,
- description = "Throws your lightsaber. It will return to you.",
- action = function(self)
- if self:GetForce() < 20 then return end
- self:SetForce( self:GetForce() - 20 )
- self:SetEnabled(false)
- self:SetBladeLength(0)
- self:SetNextAttack( 1 )
- self:GetOwner():DrawWorldModel(false)
- local ent = ents.Create("ent_lightsaber_thrown")
- ent:SetModel(self:GetWorldModel())
- ent:Spawn()
- ent:SetBladeLength(self:GetMaxLength())
- ent:SetMaxLength(self:GetMaxLength())
- ent:SetCrystalColor(self:GetCrystalColor())
- ent:SetDarkInner( self:GetDarkInner() )
- local pos = self:GetSaberPosAng()
- ent:SetPos(pos)
- pos = pos + self.Owner:GetAimVector() * 750
- ent:SetEndPos(pos)
- ent:SetOwner(self.Owner)
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Heal",
- icon = "H",
- image = "wos/forceicons/heal.png",
- cooldown = 0,
- target = 1,
- manualaim = false,
- description = "Heals your target.",
- action = function( self )
- if ( self:GetForce() < 10 ) then return end
- local foundents = 0
- for k, v in pairs( self:SelectTargets( 1 ) ) do
- if ( !IsValid( v ) ) then continue end
- foundents = foundents + 1
- local ed = EffectData()
- ed:SetOrigin( self:GetSaberPosAng() )
- ed:SetEntity( v )
- util.Effect( "rb655_force_heal", ed, true, true )
- v:SetHealth( math.Clamp( v:Health() + 25, 0, v:GetMaxHealth() ) )
- end
- if ( foundents > 0 ) then
- self:SetForce( self:GetForce() - 3 )
- local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
- if not tbl then
- tbl = wOS.ExperienceTable[ "Default" ].XPPerHeal
- else
- tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].XPPerHeal
- end
- self.Owner:AddSkillXP( tbl )
- end
- self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
- self:SetNextAttack( 0.25 )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Group Heal",
- icon = "GH",
- image = "wos/forceicons/group_heal.png",
- cooldown = 0,
- manualaim = false,
- description = "Heals all around you.",
- action = function( self )
- if ( self:GetForce() < 100 ) then return end
- local players = 0
- for _, ply in pairs( ents.FindInSphere( self.Owner:GetPos(), 200 ) ) do
- if not IsValid( ply ) then continue end
- if not ply:IsPlayer() then continue end
- if not ply:Alive() then continue end
- if players >= 8 then break end
- ply:SetHealth( math.Clamp( ply:Health() + 200, 0, ply:GetMaxHealth() ) )
- local ed = EffectData()
- ed:SetOrigin( self:GetSaberPosAng() )
- ed:SetEntity( ply )
- util.Effect( "rb655_force_heal", ed, true, true )
- players = players + 1
- end
- self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.6 )
- self:SetForce( self:GetForce() - 100 )
- local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
- if not tbl then
- tbl = wOS.ExperienceTable[ "Default" ].XPPerHeal
- else
- tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].XPPerHeal
- end
- self.Owner:AddSkillXP( tbl )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Cloak",
- icon = "C",
- image = "wos/forceicons/cloak.png",
- cooldown = 0,
- description = "Shrowd yourself with the force for 10 seconds",
- action = function( self )
- if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
- if self.Owner:GetNW2Float( "CloakTime", 0 ) >= CurTime() then return end
- self:SetForce( self:GetForce() - 50 )
- self:SetNextAttack( 0.7 )
- self:PlayWeaponSound( "lightsaber/force_leap.wav" )
- self.Owner:SetNW2Float( "CloakTime", CurTime() + 10 )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Reflect",
- icon = "FR",
- image = "wos/forceicons/reflect.png",
- cooldown = 28,
- description = "An eye for an eye",
- action = function( self )
- if ( self:GetForce() < 100 || !self.Owner:IsOnGround() ) then return end
- if self.Owner:GetNW2Float( "ReflectTime", 0 ) >= CurTime() then return end
- self:SetForce( self:GetForce() - 100 )
- self:SetNextAttack( 0.7 )
- self:PlayWeaponSound( "lightsaber/force_leap.wav" )
- self.Owner:SetNW2Float( "ReflectTime", CurTime() + 5 )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Rage",
- icon = "RA",
- image = "wos/forceicons/rage.png",
- cooldown = 0,
- description = "Unleash your anger",
- action = function( self )
- if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
- if self.Owner:GetNW2Float( "RageTime", 0 ) >= CurTime() then return end
- self:SetForce( self:GetForce() - 50 )
- self:SetNextAttack( 0.7 )
- self:PlayWeaponSound( "lightsaber/force_leap.wav" )
- self.Owner:SetNW2Float( "RageTime", CurTime() + 10 )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Shadow Strike",
- icon = "SS",
- distance = 30,
- image = "wos/forceicons/shadow_strike.png",
- cooldown = 0,
- target = 1,
- manualaim = false,
- description = "From the darkness it preys",
- action = function( self )
- if self.Owner:GetNW2Float( "CloakTime", 0 ) < CurTime() then return end
- local ent = self:SelectTargets( 1, 30 )[ 1 ]
- if !IsValid( ent ) then self:SetNextAttack( 0.2 ) return end
- if ( self:GetForce() < 50 ) then self:SetNextAttack( 0.2 ) return end
- self.Owner:SetSequenceOverride("b_c3_t2", 1)
- self:SetForce( self:GetForce() - 50 )
- self.Owner:EmitSound( "lightsaber/saber_hit_laser" .. math.random( 1, 4 ) .. ".wav" )
- self.Owner:AnimResetGestureSlot( GESTURE_SLOT_CUSTOM )
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
- ent:TakeDamage( 500, self.Owner, self )
- self.Owner:SetNW2Float( "CloakTime", CurTime() + 0.5 )
- self:SetNextAttack( 0.7 )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Pull",
- icon = "PL",
- target = 1,
- description = "Get over here!",
- image = "wos/forceicons/pull.png",
- cooldown = 0,
- manualaim = false,
- action = function( self )
- if ( self:GetForce() < 20 ) then return end
- local ent = self:SelectTargets( 1 )[ 1 ]
- if not IsValid( ent ) then return end
- self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
- local newpos = ( self.Owner:GetPos() - ent:GetPos() )
- newpos = newpos / newpos:Length()
- ent:SetVelocity( newpos*700 + Vector( 0, 0, 300 ) )
- self:SetForce( self:GetForce() - 20 )
- self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.3 )
- self:SetNextAttack( 1.5 )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Push",
- icon = "PH",
- target = 1,
- distance = 150,
- description = "They are no harm at a distance",
- image = "wos/forceicons/push.png",
- cooldown = 0,
- manualaim = false,
- action = function( self )
- if ( self:GetForce() < 20 ) then return end
- local ent = self:SelectTargets( 1 )[ 1 ]
- if not IsValid( ent ) then return end
- self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
- local newpos = ( self.Owner:GetPos() - ent:GetPos() )
- newpos = newpos / newpos:Length()
- ent:SetVelocity( newpos*-700 + Vector( 0, 0, 300 ) )
- self:SetForce( self:GetForce() - 20 )
- self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.3 )
- self:SetNextAttack( 1.5 )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Lightning Strike",
- icon = "LS",
- distance = 600,
- image = "wos/forceicons/lightning_strike.png",
- cooldown = 0,
- target = 1,
- manualaim = false,
- description = "A focused charge of lightning",
- action = function( self )
- local ent = self:SelectTargets( 1, 600 )[ 1 ]
- if !IsValid( ent ) then self:SetNextAttack( 0.2 ) return end
- if ( self:GetForce() < 20 ) then self:SetNextAttack( 0.2 ) return end
- self:SetForce( self:GetForce() - 20 )
- local ed = EffectData()
- ed:SetOrigin( self:GetSaberPosAng() )
- ed:SetEntity( ent )
- util.Effect( "rb655_force_lighting", ed, true, true )
- local dmg = DamageInfo()
- dmg:SetAttacker( self.Owner || self )
- dmg:SetInflictor( self.Owner || self )
- dmg:SetDamage( 150 )
- ent:TakeDamageInfo( dmg )
- self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
- self.Owner:EmitSound( Sound( "ambient/atmosphere/thunder1.wav" ) )
- if ( !self.SoundLightning ) then
- self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
- self.SoundLightning:Play()
- else
- self.SoundLightning:Play()
- end
- local bullet = {}
- bullet.Num = 1
- bullet.Src = self.Owner:GetPos() + Vector( 0, 0, 10 )
- bullet.Dir = ( ent:GetPos() - ( self.Owner:GetPos() + Vector( 0, 0, 10 ) ) )
- bullet.Spread = 0
- bullet.Tracer = 1
- bullet.Force = 0
- bullet.Damage = 0
- bullet.AmmoType = "Pistol"
- bullet.Entity = self.Owner
- bullet.TracerName = "thor_thunder"
- self:SetNextAttack( 2 )
- self.Owner:FireBullets( bullet )
- timer.Create( "test", 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Advanced Cloak",
- icon = "AC",
- image = "wos/forceicons/advanced_cloak.png",
- cooldown = 0,
- manualaim = false,
- description = "Shrowd yourself with the force for 25 seconds",
- action = function( self )
- if ( self:GetForce() < 50 || !self.Owner:IsOnGround() ) then return end
- if self.Owner:GetNW2Float( "CloakTime", 0 ) >= CurTime() then return end
- self:SetForce( self:GetForce() - 50 )
- self:SetNextAttack( 0.7 )
- self:PlayWeaponSound( "lightsaber/force_leap.wav" )
- self.Owner:SetNW2Float( "CloakTime", CurTime() + 25 )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Lightning",
- icon = "L",
- target = 1,
- image = "wos/forceicons/lightning.png",
- cooldown = 0,
- manualaim = false,
- description = "Torture people ( and monsters ) at will.",
- action = function( self )
- if ( self:GetForce() < 1 ) then return end
- local foundents = 0
- for id, ent in pairs( self:SelectTargets( 1 ) ) do
- if ( !IsValid( ent ) ) then continue end
- foundents = foundents + 1
- local ed = EffectData()
- ed:SetOrigin( self:GetSaberPosAng() )
- ed:SetEntity( ent )
- util.Effect( "rb655_force_lighting", ed, true, true )
- local dmg = DamageInfo()
- dmg:SetAttacker( self.Owner || self )
- dmg:SetInflictor( self.Owner || self )
- dmg:SetDamage( 12.5 )
- if ( ent:IsNPC() ) then dmg:SetDamage( 12.5 ) end
- ent:TakeDamageInfo( dmg )
- end
- if ( foundents > 0 ) then
- self:SetForce( self:GetForce() - foundents )
- if ( !self.SoundLightning ) then
- self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
- self.SoundLightning:Play()
- else
- self.SoundLightning:Play()
- end
- timer.Create( "test", 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
- end
- self:SetNextAttack( 0.1 )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Combust",
- icon = "C",
- target = 1,
- description = "Ignite stuff infront of you.",
- image = "wos/forceicons/combust.png",
- cooldown = 0,
- manualaim = false,
- action = function( self )
- local ent = self:SelectTargets( 1 )[ 1 ]
- if ( !IsValid( ent ) or ent:IsOnFire() ) then self:SetNextAttack( 0.2 ) return end
- local time = math.Clamp( 512 / self.Owner:GetPos():Distance( ent:GetPos() ), 1, 16 )
- local neededForce = math.ceil( math.Clamp( time * 2, 10, 32 ) )
- if ( self:GetForce() < neededForce ) then self:SetNextAttack( 0.2 ) return end
- ent:Ignite( time, 0 )
- self:SetForce( self:GetForce() - neededForce )
- self:SetNextAttack( 1 )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Repulse",
- icon = "R",
- image = "wos/forceicons/repulse.png",
- description = "Hold to charge for greater distance/damage. Push back everything near you.",
- think = function( self )
- if ( self:GetNextSecondaryFire() > CurTime() ) then return end
- if ( self:GetForce() < 1 ) then return end
- if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then return end
- if ( !self._ForceRepulse && self:GetForce() < 16 ) then return end
- if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
- if ( !self._ForceRepulse ) then self:SetForce( self:GetForce() - 16 ) self._ForceRepulse = 1 end
- if ( !self.NextForceEffect or self.NextForceEffect < CurTime() ) then
- local ed = EffectData()
- ed:SetOrigin( self.Owner:GetPos() + Vector( 0, 0, 36 ) )
- ed:SetRadius( 128 * self._ForceRepulse )
- util.Effect( "rb655_force_repulse_in", ed, true, true )
- self.NextForceEffect = CurTime() + math.Clamp( self._ForceRepulse / 20, 0.1, 0.5 )
- end
- self._ForceRepulse = self._ForceRepulse + 0.025
- self:SetForce( self:GetForce() - 0.5 )
- if ( self:GetForce() > 0.99 ) then return end
- else
- if ( !self._ForceRepulse ) then return end
- end
- local maxdist = 128 * self._ForceRepulse
- for i, e in pairs( ents.FindInSphere( self.Owner:GetPos(), maxdist ) ) do
- if ( e == self.Owner ) then continue end
- local dist = self.Owner:GetPos():Distance( e:GetPos() )
- local mul = ( maxdist - dist ) / 256
- local v = ( self.Owner:GetPos() - e:GetPos() ):GetNormalized()
- v.z = 0
- if ( e:IsNPC() && util.IsValidRagdoll( e:GetModel() or "" ) ) then
- local dmg = DamageInfo()
- dmg:SetDamagePosition( e:GetPos() + e:OBBCenter() )
- dmg:SetDamage( 48 * mul )
- dmg:SetDamageType( DMG_GENERIC )
- if ( ( 1 - dist / maxdist ) > 0.8 ) then
- dmg:SetDamageType( DMG_DISSOLVE )
- dmg:SetDamage( e:Health() * 3 )
- end
- dmg:SetDamageForce( -v * math.min( mul * 40000, 80000 ) )
- dmg:SetInflictor( self.Owner )
- dmg:SetAttacker( self.Owner )
- e:TakeDamageInfo( dmg )
- if ( e:IsOnGround() ) then
- e:SetVelocity( v * mul * -2048 + Vector( 0, 0, 64 ) )
- elseif ( !e:IsOnGround() ) then
- e:SetVelocity( v * mul * -1024 + Vector( 0, 0, 64 ) )
- end
- elseif ( e:IsPlayer() && e:IsOnGround() ) then
- e:SetVelocity( v * mul * -2048 + Vector( 0, 0, 64 ) )
- elseif ( e:IsPlayer() && !e:IsOnGround() ) then
- e:SetVelocity( v * mul * -384 + Vector( 0, 0, 64 ) )
- elseif ( e:GetPhysicsObjectCount() > 0 ) then
- for i = 0, e:GetPhysicsObjectCount() - 1 do
- e:GetPhysicsObjectNum( i ):ApplyForceCenter( v * mul * -512 * math.min( e:GetPhysicsObject():GetMass(), 256 ) + Vector( 0, 0, 64 ) )
- end
- end
- end
- local ed = EffectData()
- ed:SetOrigin( self.Owner:GetPos() + Vector( 0, 0, 36 ) )
- ed:SetRadius( maxdist )
- util.Effect( "rb655_force_repulse_out", ed, true, true )
- self._ForceRepulse = nil
- self:SetNextAttack( 1 )
- self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Storm",
- icon = "STR",
- image = "wos/forceicons/storm.png",
- cooldown = 3,
- description = "Charge for 0.5 seconds, unleash a storm on your enemies",
- action = function( self )
- if ( self:GetForce() < 100 ) then self:SetNextAttack( 0.2 ) return end
- if self.Owner:GetNW2Float( "wOS.SaberAttackDelay", 0 ) >= CurTime() then return end
- self:SetForce( self:GetForce() - 100 )
- self.Owner:EmitSound( Sound( "npc/strider/charging.wav" ) )
- self.Owner:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 0.5 )
- local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
- local pos = tr.HitPos + Vector( 0, 0, 600 )
- local pi = math.pi
- local bullet = {}
- bullet.Num = 1
- bullet.Spread = 0
- bullet.Tracer = 1
- bullet.Force = 0
- bullet.Damage = 1500
- bullet.AmmoType = "Pistol"
- bullet.Entity = self.Owner
- bullet.TracerName = "thor_storm"
- timer.Simple( 2, function()
- if not IsValid( self.Owner ) then return end
- self.Owner:EmitSound( Sound( "ambient/atmosphere/thunder1.wav" ) )
- bullet.Src = pos
- bullet.Dir = Vector( 0, 0, -1 )
- self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
- self.Owner:FireBullets( bullet )
- timer.Simple( 0.1, function()
- if not IsValid( self.Owner ) then return end
- bullet.Src = pos + Vector( 65*math.sin( pi*2/5 ), 65*math.cos( pi*2/5 ), 0 )
- bullet.Dir = Vector( 0, 0, -1 )
- self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
- self.Owner:FireBullets( bullet )
- end )
- timer.Simple( 0.2, function()
- if not IsValid( self.Owner ) then return end
- bullet.Src = pos + Vector( 65*math.sin( pi*4/5 ), 65*math.cos( pi*4/5 ), 0 )
- bullet.Dir = Vector( 0, 0, -1 )
- self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
- self.Owner:FireBullets( bullet )
- end )
- timer.Simple( 0.3, function()
- if not IsValid( self.Owner ) then return end
- bullet.Src = pos + Vector( 65*math.sin( pi*6/5 ), 65*math.cos( pi*6/5 ), 0 )
- bullet.Dir = Vector( 0, 0, -1 )
- self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
- self.Owner:FireBullets( bullet )
- end )
- timer.Simple( 0.4, function()
- if not IsValid( self.Owner ) then return end
- bullet.Src = pos + Vector( 65*math.sin( pi*8/5 ), 65*math.cos( pi*8/5 ), 0 )
- bullet.Dir = Vector( 0, 0, -1 )
- self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
- self.Owner:FireBullets( bullet )
- end )
- timer.Simple( 0.5, function()
- if not IsValid( self.Owner ) then return end
- bullet.Src = pos + Vector( 65*math.sin( 2*pi ), 65*math.cos( 2*pi ), 0 )
- bullet.Dir = Vector( 0, 0, -1 )
- self.Owner:EmitSound( Sound( "npc/strider/fire.wav" ) )
- self.Owner:FireBullets( bullet )
- end )
- end )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Kneel",
- icon = "K",
- image = "wos/forceicons/meditate.png",
- description = "Relax yourself and channel your energy",
- think = function( self )
- if self.MeditateCooldown and self.MeditateCooldown >= CurTime() then return end
- if ( self.Owner:KeyDown( IN_ATTACK2 ) ) and !self:GetEnabled() and self.Owner:OnGround() then
- if !self._ForceMeditating then
- self.Owner.SaveAngles = self.Owner:GetAngles()
- end
- self._ForceMeditating = true
- else
- self._ForceMeditating = false
- end
- if self._ForceMeditating then
- self.Owner:SetNW2Bool("IsMeditating", true)
- if not self._NextMeditateHeal then self._NextMeditateHeal = 0 end
- if self._NextMeditateHeal < CurTime() then
- self.Owner:SetHealth( math.min( self.Owner:Health() + ( self.Owner:GetMaxHealth()*0.01 ), self.Owner:GetMaxHealth() ) )
- if #self.DevestatorList > 0 then
- self:SetDevEnergy( self:GetDevEnergy() * 0)
- end
- local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
- if not tbl then
- tbl = wOS.ExperienceTable[ "Default" ].Meditation
- else
- tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].Meditation
- end
- self.Owner:AddSkillXP( tbl )
- self._NextMeditateHeal = CurTime() + 3
- end
- self.Owner:SetLocalVelocity(Vector(0, 0, 0))
- self.Owner:SetMoveType(MOVETYPE_NONE)
- self.Owner:SetEyeAngles( self.Owner.SaveAngles )
- self.Owner:SetAngles( self.Owner.SaveAngles )
- else
- self.Owner:SetNW2Bool("IsMeditating", false)
- if self:GetMoveType() != MOVETYPE_WALK and self.Owner:GetNW2Float( "wOS.DevestatorTime", 0 ) < CurTime() then
- self.Owner:SetMoveType(MOVETYPE_WALK)
- end
- end
- if self.Owner:KeyReleased( IN_ATTACK2 ) then
- self.MeditateCooldown = CurTime() + 3
- end
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Channel Hatred",
- icon = "HT",
- image = "wos/forceicons/channel_hatred.png",
- description = "I can feel your anger",
- think = function( self )
- if self.ChannelCooldown and self.ChannelCooldown >= CurTime() then return end
- if ( self.Owner:KeyDown( IN_ATTACK2 ) ) and !self:GetEnabled() and self.Owner:OnGround() then
- self._ForceChanneling = true
- else
- self._ForceChanneling = false
- end
- if self.Owner:KeyReleased( IN_ATTACK2 ) then
- self.ChannelCooldown = CurTime() + 12
- end
- if self._ForceChanneling then
- if not self._NextChannelHeal then self._NextChannelHeal = 0 end
- self.Owner:SetNW2Bool("wOS.IsChanneling", true)
- if self._NextChannelHeal < CurTime() then
- self.Owner:SetHealth( math.min( self.Owner:Health() + ( self.Owner:GetMaxHealth()*0.01 ), self.Owner:GetMaxHealth() ) )
- if #self.DevestatorList > 0 then
- self:SetDevEnergy( self:GetDevEnergy() + self.DevCharge + 15 )
- end
- local tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ]
- if not tbl then
- tbl = wOS.ExperienceTable[ "Default" ].Meditation
- else
- tbl = wOS.ExperienceTable[ self.Owner:GetUserGroup() ].Meditation
- end
- self.Owner:AddSkillXP( tbl )
- self._NextChannelHeal = CurTime() + 3
- end
- self.Owner:SetLocalVelocity(Vector(0, 0, 0))
- self.Owner:SetMoveType(MOVETYPE_NONE)
- if ( !self.SoundChanneling ) then
- self.SoundChanneling = CreateSound( self.Owner, "ambient/levels/citadel/field_loop1.wav" )
- self.SoundChanneling:Play()
- else
- self.SoundChanneling:Play()
- end
- timer.Create( "test", 0.2, 1, function() if ( self.SoundChanneling ) then self.SoundChanneling:Stop() self.SoundChanneling = nil end end )
- else
- self.Owner:SetNW2Bool("wOS.IsChanneling", false)
- if self:GetMoveType() != MOVETYPE_WALK and self.Owner:GetNW2Float( "wOS.DevestatorTime", 0 ) < CurTime() then
- self.Owner:SetMoveType(MOVETYPE_WALK)
- end
- end
- if self.Owner:KeyReleased( IN_ATTACK2 ) then
- self.ChannelCooldown = CurTime() + 8
- end
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Ground Slam",
- icon = "GS",
- texture = "star/icon/ground_slam.png",
- cooldown = 30,
- description = "Shocks and destroys everything around you.",
- action = function( self )
- if ( self:GetForce() < 60 || CLIENT || !self.Owner:IsOnGround() ) then return end
- local elev = 400
- local time = 1
- ent = self.Owner
- self.Owner:SetSequenceOverride( "wos_bs_shared_kick", 1 )
- self:SetForce(self:GetForce() - 60)
- self:SetNextAttack( 3 )
- for j = 0,6 do
- for i = 0, 24 do
- local ed = EffectData()
- ed:SetOrigin( self.Owner:GetPos() + Vector(0,0,0) )
- ed:SetStart( self.Owner:GetPos() + Vector(0,0,0) + Angle(0 , i * 15, 0):Forward() * 512)
- util.Effect( "force_groundslam", ed, true, true )
- end
- end
- local maxdist = 128 * 4
- local ed = EffectData()
- ed:SetOrigin( self.Owner:GetPos() + Vector( 0, 0, 36 ) )
- ed:SetRadius( maxdist )
- util.Effect( "rb655_force_repulse_out", ed, true, true )
- for i, e in pairs( ents.FindInSphere( self.Owner:GetPos(), maxdist ) ) do
- if (e.Team and e:Team() == self.Owner:Team()) or (e.PlayerTeam and e.PlayerTeam == self.Owner:Team()) then continue end
- local dist = self.Owner:GetPos():Distance( e:GetPos() )
- local mul = ( maxdist - dist ) / 256
- local v = ( self.Owner:GetPos() - e:GetPos() ):GetNormalized()
- v.z = 0
- local dmg = DamageInfo()
- dmg:SetDamagePosition( e:GetPos() + e:OBBCenter() )
- dmg:SetDamage( 200 * mul )
- dmg:SetDamageType( DMG_DISSOLVE )
- dmg:SetDamageForce( -v * math.min( mul * 20000, 40000 ) )
- dmg:SetInflictor( self.Owner )
- dmg:SetAttacker( self.Owner )
- e:TakeDamageInfo( dmg )
- if ( e:IsOnGround() ) then
- e:SetVelocity( v * mul * -2048 + Vector( 0, 0, 64 ) )
- elseif ( !e:IsOnGround() ) then
- e:SetVelocity( v * mul * -1024 + Vector( 0, 0, 64 ) )
- end
- end
- if ( !self.SoundLightning ) then
- self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
- self.SoundLightning:Play()
- self.SoundLightning:ChangeVolume(0,0.3)
- else
- self.SoundLightning:Play()
- end
- timer.Create( "test", 0.6, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
- self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Blind",
- icon = "FB",
- image = "wos/forceicons/icefuse/blind.png",
- cooldown = 0,
- manualaim = false,
- description = "Make your escape or final blow.",
- action = function( self )
- if ( self:GetForce() < 75 ) then return end
- for _, ply in pairs( ents.FindInSphere( self.Owner:GetPos(), 200 ) ) do
- if not IsValid( ply ) then continue end
- if not ply:IsPlayer() then continue end
- if not ply:Alive() then continue end
- if ply == self.Owner then continue end
- ply:SetNW2Float( "wOS.BlindTime", CurTime() + 15 )
- local coil = ents.Create( "wos_sonic_discharge" )
- coil:SetPos( self.Owner:GetPos() )
- coil:Spawn()
- coil:SetOwner( self.Owner )
- end
- self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
- self:SetForce( self:GetForce() - 75 )
- self:SetNextAttack( 1 )
- return true
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Crushing Malice",
- icon = "LM",
- distance = 800,
- image = "wos/forceicons/advanced_cloak.png",
- cooldown = 10,
- target = 1,
- manualaim = false,
- description = "Finally you are free",
- action = function( self )
- local ent = self:SelectTargets( 1, 600 )[ 1 ]
- ent:SetSequenceOverride( "wos_force_crush", 1 )
- if !IsValid( ent ) then self:SetNextAttack( 1.0 ) return end
- if ( self:GetForce() < 20 ) then self:SetNextAttack( 1.0 ) return end
- self:SetForce( self:GetForce() - 20 )
- local ed = EffectData()
- ed:SetOrigin( self:GetSaberPosAng() )
- ed:SetEntity( ent )
- util.Effect( "ThumperDust", ed, true, true )
- for i= 10,1,-1 do
- local dmg = DamageInfo()
- dmg:SetAttacker( self.Owner || self )
- dmg:SetInflictor( self.Owner || self )
- dmg:SetDamage( 1 )
- ent:TakeDamageInfo( dmg )
- self.Owner:EmitSound( Sound( "physics/body/body_medium_break2.wav" ) )
- end
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Slow",
- icon = "GH",
- image = "wos/forceicons/group_heal.png",
- cooldown = 5,
- target = 1,
- description = "Strike Up to 4 Enemys",
- action = function(self)
- if CLIENT then return end
- if self:GetForce() < 80 then return end
- local ent = self:SelectTargets( 1, 600 )[ 1 ]
- if !IsValid( ent ) then self:SetNextAttack( 1.0 ) return end
- if ( self:GetForce() < 20 ) then self:SetNextAttack( 1.0 ) return end
- if !ent:IsNPC() and !ent:IsPlayer() then return end
- if not IsValid( self ) then return end
- --Setup damageinfo
- local dmg = DamageInfo()
- dmg:SetDamage( 0 )
- dmg:SetDamageType( DMG_DIRECT )
- dmg:SetInflictor( self.Owner )
- dmg:SetAttacker( self.Owner )
- local Hit = {[ent:EntIndex()] = ent}
- local count = 0
- for x = 1,4 do
- local org = ent:GetPos()
- local sound = CreateSound( ent, Sound( self.SwingSound ) )
- ent:TakeDamageInfo( dmg )
- sound:Play()
- timer.Simple(0.75, function()
- sound:Stop()
- end)
- //sound:ChangeVolume( 0, 0 )
- // ent = nil
- for x,y in pairs(ents.FindInSphere(org, 512) ) do
- if (y:IsPlayer() or y:IsNPC()) and y != self.Owner and !Hit[y:EntIndex()] then
- Hit[y:EntIndex()] = y
- ent = y
- end
- end
- ent = ent or table.Random(Hit)
- if x == 4 then
- pos1 = self.Owner:GetPos()
- pos2 = ent:GetPos()
- self.Owner:SetPos(pos2)
- ent:SetPos(pos1)
- end
- end
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Stasis",
- icon = "STS",
- description = "Let their fear stop them",
- target = 1,
- image = "wos/forceicons/icefuse/stasis.png",
- cooldown = 0,
- manualaim = false,
- action = function( self )
- if ( self:GetForce() < 80 || !self.Owner:IsOnGround() ) then return end
- local ent = self:SelectTargets( 1 )[ 1 ]
- if not IsValid( ent ) then return end
- if not ent:IsPlayer() then return end
- self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
- self:SetForce( self:GetForce() - 80 )
- self:PlayWeaponSound( "lightsaber/force_leap.wav" )
- ent:SetNW2Float( "wOS.ForceStasis", CurTime() + 10 )
- self:SetNextAttack( 1 )
- return true
- end,
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Group Pull",
- icon = "GPL",
- target = 8,
- distance = 850,
- description = "Keep your friends closer and you enemy's even closer!",
- image = "wos/forceicons/icefuse/group_pull.png",
- cooldown = 0,
- manualaim = false,
- action = function( self )
- if ( self:GetForce() < 20 ) then return end
- local foundents = self:SelectTargets( 10 )
- if #foundents < 1 then return end
- for id, ent in pairs( foundents ) do
- local newpos = ( self.Owner:GetPos() - ent:GetPos() )
- newpos = newpos / newpos:Length()
- ent:SetVelocity( newpos*850 + Vector( 0, 0, 300 ) )
- if ent:IsPlayer() then
- local time = ent:SetSequenceOverride( "h_reaction_upper", 2)
- end
- end
- self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
- self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
- self:SetForce( self:GetForce() - 20 )
- self:SetNextAttack( 1.5 )
- return true
- end,
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Group Push",
- icon = "GPH",
- target = 50,
- distance = 650,
- description = "They are no harm at a distance",
- image = "wos/forceicons/icefuse/group_push.png",
- cooldown = 0,
- manualaim = false,
- action = function( self )
- if ( self:GetForce() < 20 ) then return end
- local foundents = self:SelectTargets( 50, 650 )
- if #foundents < 1 then return end
- for id, ent in pairs( foundents ) do
- local newpos = ( self.Owner:GetPos() - ent:GetPos() )
- newpos = newpos / newpos:Length()
- ent:SetVelocity( newpos*-850 + Vector( 0, 0, 300 ) )
- if ent:IsPlayer() then
- local time = ent:SetSequenceOverride( "h_reaction_upper", 2 )
- end
- end
- self:SetForce( self:GetForce() - 20 )
- self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
- self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
- self:SetNextAttack( 1.5 )
- return true
- end,
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Group Lightning",
- icon = "GL",
- target = 4,
- description = "Send a jolt to wake up groups of victims.",
- image = "wos/forceicons/icefuse/group_lightning.png",
- cooldown = 0,
- manualaim = false,
- action = function( self )
- if ( self:GetForce() < 1 ) then return end
- local foundents = 0
- for id, ent in pairs( self:SelectTargets( 10 ) ) do
- if ( !IsValid( ent ) ) then continue end
- foundents = foundents + 1
- local ed = EffectData()
- ed:SetOrigin( self:GetSaberPosAng() )
- ed:SetEntity( ent )
- util.Effect( "rb655_force_lighting", ed, true, true )
- local dmg = DamageInfo()
- dmg:SetAttacker( self.Owner || self )
- dmg:SetInflictor( self.Owner || self )
- dmg:SetDamage( 15 )
- if ent.IsBlocking then
- ent:EmitSound( "lightsaber/saber_hit_laser" .. math.random( 1, 4 ) .. ".wav" )
- if wOS.EnableStamina then
- ent:AddStamina( -6 )
- else
- ent:GetActiveWeapon():SetForce( ent:GetActiveWeapon():GetForce() - 1 )
- end
- ent:SetSequenceOverride( "h_block", 0.5 )
- else
- ent:TakeDamageInfo( dmg )
- end
- if ( ent:IsNPC() ) then dmg:SetDamage( 1.6 ) end
- end
- if ( foundents > 0 ) then
- self:SetForce( self:GetForce() - foundents )
- if ( !self.SoundLightning ) then
- self.SoundLightning = CreateSound( self.Owner, "lightsaber/force_lightning" .. math.random( 1, 2 ) .. ".wav" )
- self.SoundLightning:Play()
- else
- self.SoundLightning:Play()
- end
- self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
- timer.Create( "test" .. self.Owner:SteamID64(), 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
- end
- self:SetNextAttack( 0.1 )
- return true
- end,
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Electric Judgement",
- icon = "EJ",
- description = "The truth can blind us all.",
- image = "wos/forceicons/icefuse/electric_judgement.png",
- cooldown = 0,
- manualaim = false,
- action = function( self )
- if ( self:GetForce() < 5 ) then return end
- local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
- local ent = tr.Entity
- if not ent then return end
- if not ent:IsPlayer() then return end
- if self.Owner:GetPos():Distance( ent:GetPos() ) > 300 then return end
- local ed = EffectData()
- ed:SetOrigin( self:GetSaberPosAng() )
- ed:SetEntity( ent )
- util.Effect( "wos_emerald_lightning", ed, true, true )
- if ent.IsBlocking then
- ent:EmitSound( "lightsaber/saber_hit_laser" .. math.random( 1, 4 ) .. ".wav" )
- if wOS.EnableStamina then
- ent:AddStamina( -5 )
- else
- ent:GetActiveWeapon():SetForce( ent:GetActiveWeapon():GetForce() - 1 )
- end
- ent:SetSequenceOverride( "h_block", 0.5 )
- else
- ent:SetNW2Float( "wOS.DisorientTime", CurTime() + 7 )
- ent:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 7 )
- end
- self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
- self:SetForce( self:GetForce() - 5 )
- if ( !self.SoundLightning ) then
- self.SoundLightning = CreateSound( self.Owner, "ambient/wind/wind_snippet2.wav" )
- self.SoundLightning:PlayEx( 0.5, 100 )
- else
- self.SoundLightning:PlayEx( 0.5, 100 )
- end
- timer.Create( "test" .. self.Owner:SteamID64(), 0.2, 1, function() if ( self.SoundLightning ) then self.SoundLightning:Stop() self.SoundLightning = nil end end )
- -- self:SetNextAttack( 0.1 )
- return true
- end,
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Whirlwind",
- icon = "WW",
- description = "That which you harness is all around you",
- image = "wos/forceicons/icefuse/whirlwind.png",
- cooldown = 0,
- manualaim = false,
- action = function( self )
- if self:GetForce() < 1 then return end
- if IsValid( self.WindTarget ) then return end
- local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
- local dist = tr.HitPos:Distance( self.Owner:GetPos() )
- if not tr.Entity then return end
- if dist >= 800 then return end
- self.WindTarget = tr.Entity
- self.WindDistance = dist
- end,
- think = function( self )
- if not IsValid( self.WindTarget ) then return end
- if ( self:GetNextSecondaryFire() > CurTime() ) then return end
- if ( self:GetForce() < 1 ) then return end
- if self.WindTarget:IsPlayer() and not self.WindTarget:Alive() then self.WindTarget = nil return end
- if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then return end
- self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
- if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
- --self.WindTarget:SetLocalVelocity( Vector( 0, 0, 0 ) )
- --self.WindTarget:SetPos( ply:EyePos() + ply:GetAimVector()*self.WindDistance )
- local vec = ( ( self.Owner:EyePos() + self.Owner:GetAimVector()*self.WindDistance ) - self.WindTarget:GetPos() )
- local vec2 = ( ( self.Owner:EyePos() + self.Owner:GetAimVector()*2*self.WindDistance ) - self.WindTarget:GetPos() )
- if self.WindTarget:IsPlayer() or self.WindTarget:IsNPC() then
- self.WindTarget:SetLocalVelocity( vec*15 )
- self.WindTarget:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 0.2 )
- else
- --self.WindTarget:SetVelocity( ( ( self.Owner:EyePos() + self.Owner:GetAimVector()*self.WindDistance ) - self.WindTarget:GetPos() )*30 )
- local phys = self.WindTarget:GetPhysicsObject()
- phys:SetVelocity( vec*15 )
- end
- self:SetForce( self:GetForce() -1 )
- if ( self:GetForce() < 1 ) then
- local ed = EffectData()
- ed:SetOrigin( self.WindTarget:GetPos() + Vector( 0, 0, 8 ) )
- ed:SetRadius( 128 )
- util.Effect( "rb655_force_repulse_out", ed, true, true )
- self.WindTarget = nil
- self:SetNextAttack( 1 )
- self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
- end
- if self.Owner:KeyReleased( IN_ATTACK ) then
- local ed = EffectData()
- ed:SetOrigin( self.WindTarget:GetPos() + Vector( 0, 0, 8 ) )
- ed:SetRadius( 800 )
- util.Effect( "rb655_force_repulse_out", ed, true, true )
- self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
- if self.WindTarget:IsPlayer() or self.WindTarget:IsNPC() then
- self.WindTarget:SetLocalVelocity( vec2*10 )
- else
- --self.WindTarget:SetVelocity( ( ( self.Owner:EyePos() + self.Owner:GetAimVector()*self.WindDistance ) - self.WindTarget:GetPos() )*30 )
- local phys = self.WindTarget:GetPhysicsObject()
- phys:SetVelocity( vec2*10 )
- end
- self.WindTarget = nil
- self:SetNextAttack( 1 )
- end
- else
- if not IsValid( self.WindTarget ) then return end
- local ed = EffectData()
- ed:SetOrigin( self.WindTarget:GetPos() + Vector( 0, 0, 8 ) )
- ed:SetRadius( 800 )
- util.Effect( "rb655_force_repulse_out", ed, true, true )
- self.WindTarget = nil
- self:SetNextAttack( 1 )
- self:PlayWeaponSound( "lightsaber/force_repulse.wav" )
- end
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Breach",
- icon = "BR",
- description = "Make a path",
- image = "wos/forceicons/icefuse/breach.png",
- cooldown = 0,
- manualaim = false,
- action = function( self )
- if self:GetForce() < 35 then return end
- local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
- if not IsValid( tr.Entity ) then return end
- if not tr.Entity:GetClass()=="func_door" or not tr.Entity:GetClass()=="prop_door_rotating" or not tr.Entity:GetClass()=="func_door_rotating" then return end
- self:SetForce( self:GetForce() - 35 )
- self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 0.5 )
- tr.Entity:Fire("unlock","",0)
- tr.Entity:Fire("Open","",0)
- self:SetNextAttack( 1 )
- return true
- end,
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Teleport",
- icon = "TP",
- description = "Phase through to a new location.",
- cooldown = 0,
- manualaim = false,
- think = function( self )
- if ( self:GetNextSecondaryFire() > CurTime() ) then return end
- if ( self:GetForce() < 75 ) then return end
- if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then return end
- if self.Owner:KeyReleased( IN_ATTACK2 ) and self.groundTrace then
- local speed = 4000;
- local bFoundEdge = false;
- self.Owner:SetNW2Float("wOS.ShowBlink", 0 );
- local hullTrace = util.TraceHull({
- start = self.Owner:EyePos(),
- endpos = self.Owner:EyePos() + self.Owner:EyeAngles():Forward() * 2400,
- filter = self.Owner,
- mins = Vector(-16, -16, 0),
- maxs = Vector(16, 16, 9)
- });
- local groundTrace = util.TraceEntity({
- start = hullTrace.HitPos + Vector(0, 0, 1),
- endpos = hullTrace.HitPos - (self.Owner:EyePos() - self.Owner:GetPos()),
- filter = self.Owner
- }, self.Owner);
- local edgeTrace;
- if (hullTrace.Hit and hullTrace.HitNormal.z <= 0) then
- local ledgeForward = Angle(0, hullTrace.HitNormal:Angle().y, 0):Forward();
- edgeTrace = util.TraceEntity({
- start = hullTrace.HitPos - ledgeForward * 33 + Vector(0, 0, 40),
- endpos = hullTrace.HitPos - ledgeForward * 33,
- filter = self.Owner
- }, self.Owner);
- if (edgeTrace.Hit and !edgeTrace.AllSolid) then
- local clearTrace = util.TraceHull({
- start = hullTrace.HitPos,
- endpos = hullTrace.HitPos + Vector(0, 0, 35),
- mins = Vector(-16, -16, 0),
- maxs = Vector(16, 16, 1),
- filter = self.Owner
- });
- bFoundEdge = !clearTrace.Hit;
- end;
- end;
- if (!bFoundEdge and groundTrace.AllSolid) then
- self.groundTrace = nil
- self:SetNextSecondaryFire( CurTime() + 1 )
- return;
- end;
- local endPos = ( bFoundEdge and edgeTrace.HitPos ) or groundTrace.HitPos;
- self.Owner:SetPos( endPos )
- self.Owner:EmitSound("blink/exit" .. math.random(1, 2) .. ".wav");
- self.groundTrace = nil
- self:SetForce( self:GetForce() - 75 )
- self:SetNextSecondaryFire( CurTime() + 1 )
- return
- end;
- if self.Owner:KeyDown( IN_ATTACK2 ) then
- local bFoundEdge = false;
- self.Owner:SetNW2Float( "wOS.ShowBlink", CurTime() + 0.5 )
- local hullTrace = util.TraceHull({
- start = self.Owner:EyePos(),
- endpos = self.Owner:EyePos() + self.Owner:EyeAngles():Forward() * 2400,
- filter = self.Owner,
- mins = Vector(-16, -16, 0),
- maxs = Vector(16, 16, 9)
- });
- self.groundTrace = util.TraceHull({
- start = hullTrace.HitPos + Vector(0, 0, 1),
- endpos = hullTrace.HitPos - Vector(0, 0, 1000),
- filter = self.Owner,
- mins = Vector(-16, -16, 0),
- maxs = Vector(16, 16, 1)
- });
- local edgeTrace;
- if (hullTrace.Hit and hullTrace.HitNormal.z <= 0) then
- local ledgeForward = Angle(0, hullTrace.HitNormal:Angle().y, 0):Forward();
- edgeTrace = util.TraceEntity({
- start = hullTrace.HitPos - ledgeForward * 33 + Vector(0, 0, 40),
- endpos = hullTrace.HitPos - ledgeForward * 33,
- filter = self.Owner
- }, self.Owner);
- if (edgeTrace.Hit and !edgeTrace.AllSolid) then
- local clearTrace = util.TraceHull({
- start = hullTrace.HitPos,
- endpos = hullTrace.HitPos + Vector(0, 0, 35),
- mins = Vector(-16, -16, 0),
- maxs = Vector(16, 16, 1),
- filter = self.Owner
- });
- if (!clearTrace.Hit) then
- self.groundTrace.HitPos = edgeTrace.HitPos;
- bFoundEdge = true;
- end;
- end;
- end;
- end
- end,
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Destruction",
- icon = "DES",
- description = "Hold to unleash true power on your enemies",
- image = "wos/forceicons/icefuse/destruction.png",
- cooldown = 0,
- manualaim = false,
- think = function( self )
- if ( self:GetNextSecondaryFire() > CurTime() ) then return end
- if ( self:GetForce() < 1 ) then return end
- if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then return end
- if ( !self._ForceDestruction && self:GetForce() < 50 ) then return end
- if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
- if ( !self._ForceDestruction ) then self:SetForce( self:GetForce() - 50 ) self._ForceDestruction = 5 end
- self._ForceDestruction = self._ForceDestruction + 1
- self:SetForce( self:GetForce() - 2 )
- if ( self:GetForce() > 0.99 ) then return end
- else
- if ( !self._ForceDestruction ) then return end
- end
- self.Owner:EmitSound( Sound( "npc/strider/charging.wav" ) )
- self.Owner:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 2 )
- self.Owner:SetNW2Float( "wOS.ForceAnim", CurTime() + 2 )
- local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
- local pos = tr.HitPos + Vector( 0, 0, 600 )
- local pi = math.pi
- local max = self._ForceDestruction
- local bullet = {}
- bullet.Num = 1
- bullet.Spread = 0
- bullet.Tracer = 1
- bullet.Force = 0
- bullet.Damage = 500
- bullet.AmmoType = "Pistol"
- bullet.Entity = self.Owner
- bullet.TracerName = "thor_storm"
- bullet.Callback = function( ply, tr, dmginfo )
- sound.Play( "npc/strider/fire.wav", tr.HitPos )
- end
- timer.Simple( 2, function()
- if not IsValid( self ) then return end
- bullet.Src = pos
- bullet.Dir = Vector( 0, 0, -1 )
- self.Owner:FireBullets( bullet )
- for i=1, max do
- timer.Simple( 0.1*i, function()
- if not IsValid( self ) then return end
- local dis = i + i*30
- if not IsValid( self.Owner ) then return end
- bullet.Src = pos + Vector( dis*math.sin( i*pi*1/8 ), dis*math.cos( i*pi*1/8 ), 0 )
- bullet.Dir = Vector( 0, 0, -1 )
- self.Owner:FireBullets( bullet )
- bullet.Src = pos + Vector( dis*math.sin( i*pi*3/8 ), dis*math.cos( i*pi*3/8 ), 0 )
- bullet.Dir = Vector( 0, 0, -1 )
- self.Owner:FireBullets( bullet )
- bullet.Src = pos + Vector( dis*math.sin( i*pi*5/8 ), dis*math.cos( i*pi*5/8 ), 0 )
- bullet.Dir = Vector( 0, 0, -1 )
- self.Owner:FireBullets( bullet )
- bullet.Src = pos + Vector( dis*math.sin( i*pi*7/8 ), dis*math.cos( i*pi*7/8 ), 0 )
- bullet.Dir = Vector( 0, 0, -1 )
- self.Owner:FireBullets( bullet )
- end )
- end
- end )
- self._ForceDestruction = nil
- self:SetNextAttack( 3 )
- end,
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Choke",
- icon = "CH",
- description = "I find your lack of faith disturbing",
- image = "wos/forceicons/icefuse/choke.png",
- cooldown = 0,
- manualaim = false,
- action = function( self )
- if self:GetForce() < 1 then return end
- if IsValid( self.ChokeTarget ) then return end
- local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
- if not tr.Entity then return end
- if not tr.Entity:IsPlayer() and not tr.Entity:IsNPC() then return end
- if self.Owner:GetPos():Distance( tr.Entity:GetPos() ) >= 400 then return end
- self.ChokeTarget = tr.Entity
- self.ChokeTarget:EmitSound( "wos/icefuse/choke_start.wav" )
- self.ChokePos = tr.Entity:GetPos()
- end,
- think = function( self )
- if not IsValid( self.ChokeTarget ) then return end
- if ( self:GetNextSecondaryFire() > CurTime() ) then return end
- if ( self:GetForce() < 1 ) then return end
- if not self.ChokeTarget:Alive() then self.ChokeTarget = nil return end
- if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then self.Owner:SetNW2Bool("wOS.Cast_Choke", false) return end
- self.Owner:SetNW2Bool("wOS.Cast_Choke", true)
- if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
- local Cdmg = DamageInfo()
- Cdmg:SetDamage( 0.4 ) --0.21
- Cdmg:SetDamageType( DMG_CRUSH )
- Cdmg:SetAttacker( self.Owner )
- Cdmg:SetInflictor( self )
- self.ChokeTarget:TakeDamageInfo( Cdmg )
- self.ChokeTarget:SetLocalVelocity( ( self.ChokePos - self.ChokeTarget:GetPos() + Vector( 0, 0, 0 ) )*0 )
- --self.ChokeTarget:SetPos( Vector( self.ChokePos.x, self.ChokePos.y, math.min( self.ChokeTarget:GetPos().z + 0.5, self.ChokePos.z + 55 ) ) )
- --self.ChokeTarget:SetLocalVelocity( Vector( 0, 0, 100 ) )
- self.ChokeTarget:SetNW2Bool("wOS.Choked", true)
- self.ChokeTarget:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 0.5 )
- self.Owner:SetNW2Bool("wOS.Cast_Choke", true)
- self:SetForce( self:GetForce() - 0.02 )
- if ( !self.SoundChoking ) then
- self.SoundChoking = CreateSound( self.Owner, "wos/icefuse/choke_active.wav" )
- self.SoundChoking:PlayEx( 0.25, 100 )
- else
- self.SoundChoking:PlayEx( 0.25, 100 )
- end
- timer.Create( "test" .. self.Owner:SteamID64() .. "_choke", 0.2, 1, function() if ( self.SoundChoking ) then self.SoundChoking:Stop() self.SoundChoking = nil end end )
- if ( !self.SoundGagging ) then
- self.SoundGagging = CreateSound( self.ChokeTarget, "wos/icefuse/choke_gagging.wav" )
- self.SoundGagging:Play()
- else
- self.SoundGagging:Play()
- end
- timer.Create( "test" .. self.Owner:SteamID64(), 0.2, 1, function() if ( self.SoundGagging ) then self.SoundGagging:Stop() self.SoundGagging = nil end end )
- if ( self:GetForce() <= 0 ) then
- local ed = EffectData()
- self.ChokeTarget = nil
- self.ChokeTarget:SetNW2Bool("wOS.Choked", false)
- self.Owner:SetNW2Bool("wOS.Cast_Choke", false)
- self:SetNextAttack( 1 )
- end
- if (self.ChokeTarget:Health() == 1) then
- self.ChokeTarget:SetNW2Bool("wOS.Choked", false)
- self.Owner:SetNW2Bool("wOS.Cast_Choke", false)
- end
- else
- if not IsValid( self.ChokeTarget ) then return end
- local ed = EffectData()
- self.ChokeTarget:SetNW2Bool("wOS.Choked", false)
- self.Owner:SetNW2Bool("wOS.Cast_Choke", false)
- self.ChokeTarget = nil
- self:SetNextAttack( 1 )
- end
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Group Choke",
- icon = "GCH",
- description = "Choke them all",
- image = "wos/forceicons/icefuse/choke.png",
- cooldown = 0,
- manualaim = false,
- distance = 400,
- target = 10,
- action = function( self )
- if self:GetForce() < 1 then return end
- if self.IsGroupChoking then return end
- local foundents = self:SelectTargets( 10, 400 )
- if #foundents < 1 then return end
- self.ChokeTargets = {}
- self.ChokePoss = {}
- for id, ent in pairs( foundents ) do
- if not ent:IsPlayer() then continue end
- self.ChokeTargets[ id ] = ent
- ent:EmitSound( "wos/icefuse/choke_start.wav" )
- self.ChokePoss[ id ] = ent:GetPos()
- end
- end,
- think = function( self )
- if not self.ChokeTargets then self.IsGroupChoking = false return end
- if ( self:GetNextSecondaryFire() > CurTime() ) then self.IsGroupChoking = false return end
- if ( self:GetForce() < 1 ) then self.IsGroupChoking = false return end
- if #self.ChokeTargets < 1 then self.IsGroupChoking = false return end
- if ( !self.Owner:KeyDown( IN_ATTACK2 ) && !self.Owner:KeyReleased( IN_ATTACK2 ) ) then self.Owner:SetNW2Float("wOS.Cast_Choke", false) return end
- self.Owner:SetNW2Float("wOS.Cast_Choke", true)
- if ( !self.Owner:KeyReleased( IN_ATTACK2 ) ) then
- self:SetForce( self:GetForce() - 0.02 )
- if ( !self.SoundChoking ) then
- self.SoundChoking = CreateSound( self.Owner, "wos/icefuse/choke_active.wav" )
- self.SoundChoking:PlayEx( 0.25, 100 )
- else
- self.SoundChoking:PlayEx( 0.25, 100 )
- end
- timer.Create( "test" .. self.Owner:SteamID64() .. "_choke", 0.2, 1, function() if ( self.SoundChoking ) then self.SoundChoking:Stop() self.SoundChoking = nil end end )
- self.IsGroupChoking = true
- for id, ply in pairs( self.ChokeTargets ) do
- if not IsValid( ply ) then self.ChokeTargets[ id ] = nil continue end
- if not ply:Alive() then self.ChokeTargets[ id ] = nil continue end
- local GCdmg = DamageInfo()
- GCdmg:SetDamage( 0.4 ) --0.21
- GCdmg:SetDamageType( DMG_CRUSH )
- GCdmg:SetAttacker( self.Owner )
- GCdmg:SetInflictor( self )
- ply:TakeDamageInfo( GCdmg )
- ply:SetLocalVelocity( ( self.ChokePoss[ id ] - ply:GetPos() + Vector( 0, 0, 0) )*0 )
- --self.ChokeTarget:SetPos( Vector( self.ChokePos.x, self.ChokePos.y, math.min( self.ChokeTarget:GetPos().z + 0.5, self.ChokePos.z + 55 ) ) )
- --self.ChokeTarget:SetLocalVelocity( Vector( 0, 0, 100 ) )
- ply:SetNW2Float( "wOS.Choked", true )
- ply:SetNW2Float( "wOS.SaberAttackDelay", CurTime() + 0.5 )
- self.Owner:SetNW2Float( "wOS.Cast_Choke", true )
- if ( !ply.SoundGagging ) then
- ply.SoundGagging = CreateSound( ply, "wos/icefuse/choke_gagging.wav" )
- ply.SoundGagging:Play()
- else
- ply.SoundGagging:Play()
- end
- timer.Create( "test" .. ply:SteamID64(), 0.2, 1, function() if ( ply.SoundGagging ) then ply.SoundGagging:Stop() ply.SoundGagging = nil end end )
- if ( self:GetForce() < 1 ) then
- ply:SetNW2Float( "wOS.Choked", false )
- self.Owner:SetNW2Float( "wOS.Cast_Choke", false )
- self.ChokeTargets = {}
- self:SetNextAttack( 1 )
- self.IsGroupChoking = false
- return
- end
- if (ply:Health() <= 0) then
- self.ChokeTarget:SetNW2Bool("wOS.Choked", false)
- self.Owner:SetNW2Bool("wOS.Cast_Choke", false)
- end
- end
- else
- for id, ply in pairs( self.ChokeTargets ) do
- ply:SetNW2Float( "wOS.Choked", false )
- if not IsValid( ply ) then self.ChokeTargets[ id ] = nil continue end
- if not ply:Alive() then self.ChokeTargets[ id ] = nil continue end
- end
- self.Owner:SetNW2Float( "wOS.Cast_Choke", false )
- self.ChokeTargets = {}
- self:SetNextAttack( 1 )
- self.IsGroupChoking = false
- end
- end
- })
- wOS.ForcePowers:RegisterNewPower({
- name = "Force Meteor",
- icon = "C",
- target = 1,
- texture = "star/icon/choke.png",
- description = "Shoot Meteors down from the sky",
- action = function( sel )
- if ( CLIENT ) then return end
- local ply = sel.Owner
- local ent = sel:SelectTargets( 1 )[ 1 ]
- if ( !IsValid( ent )) then sel:SetNextAttack( 0.2 ) return end
- if sel:GetForce() < 70 then return end
- for x = 1,5 do
- local meteor = ents.Create("star_metor")
- meteor.nodupe = true
- meteor:Spawn()
- meteor:SetMeteorTarget(ent)
- end
- sel:SetForce( sel:GetForce() - 70 )
- local metor = CreateSound( sel.Owner,( "gbombs/daisy/daisy_explo.wav" .. 1 ..".mp3" ))
- metor:Play()
- sel:SetNextAttack( 2 )
- sel.Owner:SetCoolDown(sel:GetActiveForcePowerType( sel:GetForceType() ).name, 60)
- end
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement