[lua]
// Variables that are used on both client and server
AddCSLuaFile( "shared.lua" )
SWEP.Author = "Flubadoo"
SWEP.Purpose = "Precison counts"
SWEP.Instructions = ""
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_atgun.mdl"
SWEP.WorldModel = "models/jaanus/atgun.mdl"
SWEP.Primary.ClipSize = 8
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.PrintName = "Flechette Sniper Rifle"
SWEP.Slot = 1
SWEP.SlotPos = 2
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true
local ShootSound = Sound( "NPC_Hunter.FlechetteShoot" )
Zoom = 0
/*---------------------------------------------------------
Reload does nothing
---------------------------------------------------------*/
function SWEP:Reload()
self.Weapon:DefaultReload( ACT_VM_RELOAD );
end
/*---------------------------------------------------------
Think does nothing
---------------------------------------------------------*/
function SWEP:Think()
end
/*---------------------------------------------------------
PrimaryAttack
---------------------------------------------------------*/
function SWEP:PrimaryAttack()
self.Weapon:SetNextPrimaryFire( CurTime() + 1 )
self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
self:EmitSound( ShootSound )
self:ShootEffects( self )
// The rest is only done on the server
if (!SERVER) then return end
self:TakePrimaryAmmo( 0 )
local x
for x = 1, 15 do
local r1 = math.random(-20, 20) / 10000
local r2 = math.random(-20, 20) / 10000
local r3 = math.random(-20, 20) / 10000
local Forward = self.Owner:EyeAngles():Forward()
local ent = ents.Create( "hunter_flechette" )
if ( ValidEntity( ent ) ) then
ent:SetPos( self.Owner:GetShootPos() + Forward * 32 )
ent:SetAngles( self.Owner:EyeAngles() )
ent:Spawn()
ent:SetVelocity( Forward * 3000 )
end
ent:Fire("addoutput","basevelocity 0 0 -30",0.1)
ent:Fire("addoutput","basevelocity 0 0 -30",0.3)
ent:Fire("addoutput","basevelocity 0 0 -30",0.5)
ent:Fire("addoutput","basevelocity 0 0 -30",0.7)
ent:Fire("addoutput","basevelocity 0 0 -30",1)
ent:Fire("addoutput","basevelocity 0 0 -30",1.3)
ent:Fire("addoutput","basevelocity 0 0 -30",1.5)
ent:Fire("addoutput","basevelocity 0 0 -30",1.7)
ent:Fire("addoutput","basevelocity 0 0 -30",2)
ent:Fire("addoutput","basevelocity 0 0 -30",2.3)
ent:Fire("addoutput","basevelocity 0 0 -30",2.5)
ent:Fire("addoutput","basevelocity 0 0 -30",2.7)
ent:Fire("addoutput","basevelocity 0 0 -30",3)
-- ent:AddEffects( EF_ITEM_BLINK | EF_BRIGHTLIGHT );
ent:SetOwner( self.Owner )
util.ScreenShake( ent:GetPos(), 2, 2, 0.7, 100 )
ParticleEffectAttach("larvae_glow_extract",PATTACH_ABSORIGIN_FOLLOW,ent,0)
timer.Simple(2.7,function() ParticleEffectAttach("striderbuster_explode_dummy_core",PATTACH_ABSORIGIN_FOLLOW,ent,0) end)
end
end
/*---------------------------------------------------------
SecondaryAttack
---------------------------------------------------------*/
function SWEP:SecondaryAttack()
if(Zoom == 0) then
if(SERVER) then
self.Owner:SetFOV( 25, 0.25 )
end
self:EmitSound("Weapon_AR2.Special1")
Zoom = 1
else
if(SERVER) then
self.Owner:SetFOV( 0, 0.25 )
end
self:EmitSound("Weapon_AR2.Special2")
Zoom = 0
end
end
/*---------------------------------------------------------
Name: ShouldDropOnDie
Desc: Should this weapon be dropped when its owner dies?
---------------------------------------------------------*/
function SWEP:ShouldDropOnDie()
return true
end
function SWEP:Equip(ply)
ParticleEffectAttach("Weapon_Combine_Ion_Cannon_Explosion",PATTACH_ABSORIGIN_FOLLOW,ply,0)
end
[/lua]
Ok, in the above code, when the flechette hits an npc, the effects don't run. Ok, I'm fine with that. But now:
[lua]AddCSLuaFile( "shared.lua" ) //YOU NEED A DECENT COMPUTER TO RUN THIS SHIT TO THE GROUND!!!
SWEP.Author = "Flubadoo & Swat player & Jaanus for model"
SWEP.Purpose = "Precison counts"
SWEP.Instructions = ""
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_atgun.mdl"
SWEP.WorldModel = "models/jaanus/atgun.mdl"
SWEP.Primary.ClipSize = 8
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.PrintName = "Heavy Plasma Sniper Rifle"
SWEP.Slot = 1
SWEP.SlotPos = 2
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true
local ShootSound = Sound( "NPC_Hunter.FlechetteShoot" )
Zoom = 0
/*---------------------------------------------------------
Reload does nothing
---------------------------------------------------------*/
function SWEP:Reload() //Infinite ammo and no reloading ftwwwwww
return false
end
/*---------------------------------------------------------
Think does nothing (insert strikethrough) something
---------------------------------------------------------*/
function SWEP:Think()
if self.Owner:KeyPressed(IN_RELOAD) then
RunConsoleCommand("host_timescale", "0.45")
end
end
/*---------------------------------------------------------
PrimaryAttack
---------------------------------------------------------*/
function SWEP:PrimaryAttack()
self.Weapon:SetNextPrimaryFire( CurTime() + 0.85 )
self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
self:EmitSound( ShootSound )
self:ShootEffects( self )
// The rest is only done on the server and shit
if (!SERVER) then return end
self:TakePrimaryAmmo( 0 )
local x
for x = 1, 12 do
local r1 = math.random(-20, 20) / 10000
local r2 = math.random(-20, 20) / 10000
local r3 = math.random(-20, 20) / 10000
Forward = self.Owner:EyeAngles():Forward()
local flec = ents.Create( "hunter_flechette" )
if ( ValidEntity( flec ) ) then
flec:SetPos( self.Owner:GetShootPos() + Forward * 30 )
flec:SetAngles( self.Owner:EyeAngles() )
flec:Spawn()
flec:SetVelocity( Forward * 3000 ) //LET THERE BE BULLET DROP! IN THIS CASE, FLECHETTEs.
end
flec:Fire("addoutput","basevelocity 0 0 -30",0.1)
flec:Fire("addoutput","basevelocity 0 0 -30",0.3)
flec:Fire("addoutput","basevelocity 0 0 -30",0.5)
flec:Fire("addoutput","basevelocity 0 0 -30",0.7)
flec:Fire("addoutput","basevelocity 0 0 -30",1)
flec:Fire("addoutput","basevelocity 0 0 -30",1.3)
flec:Fire("addoutput","basevelocity 0 0 -30",1.5)
flec:Fire("addoutput","basevelocity 0 0 -30",1.7) //useless mumbo jumbo
flec:Fire("addoutput","basevelocity 0 0 -30",2)
flec:Fire("addoutput","basevelocity 0 0 -30",2.3)
flec:Fire("addoutput","basevelocity 0 0 -30",2.5)
flec:Fire("addoutput","basevelocity 0 0 -30",2.7)
flec:Fire("addoutput","basevelocity 0 0 -30",3)
flec:AddEffects( EF_ITEM_BLINK | EF_BRIGHTLIGHT );
flec:SetOwner( self.Owner )
util.ScreenShake( ent:GetPos(), 2, 2, 0.7, 100 )
ParticleEffectAttach("larvae_glow_extract",PATTACH_ABSORIGIN_FOLLOW,flec,0) //INSERT FUCKLOAD OF EFFECTS RIGHT HERE!!!!
ParticleEffectAttach("vortigaunt_hand_glow",PATTACH_ABSORIGIN_FOLLOW,flec,0)
ParticleEffectAttach("test_beam",PATTACH_ABSORIGIN_FOLLOW,flec,0)
timer.Simple(2.7,function() ParticleEffectAttach("electrical_arc_01_system",PATTACH_ABSORIGIN_FOLLOW,flec,0) end)
timer.Simple(2.7,function() ParticleEffectAttach("cingularity",PATTACH_ABSORIGIN_FOLLOW,flec,0) end)
timer.Simple(2.7,function() ParticleEffectAttach("aurora_02b",PATTACH_ABSORIGIN_FOLLOW,flec,0) end)
end
end
/*---------------------------------------------
When the flechette hits an npc is gets removed, attaching an effect to a null entity poses it at world origin. Good luck with the rest!
[QUOTE=ralle105;25317788]When the flechette hits an npc is gets removed, attaching an effect to a null entity poses it at world origin. Good luck with the rest![/QUOTE]
But wouldn't the same apply to the first script?
I pretty much get what you mean too, and I kind of have an idea of how to do it, but why doesn't it happen on the first script? It is basically the same code, with less effects.
Perhaps the striderbuster effect needs an entity to appear and the other don't? I'm not really sure how OB particles work to be honest.
Ok, so I pretty much fixed it, but I'm still curious, since when I inserted the striderbuster explosion in the second code, it went to the middle, even though it was the same effect as the above code. The code is the nearly the same, but when putting the striderbuster effect on the second one, the effect goes to the middle, while on the first one, it just disappears...
I think it all just depends on the effect. Some effects (if you use EffectAttach) need a constant ent to emit, I ran into this problem with my Morph Ball.
If you can't get it to work correctly, I suggest spawning a Particle Effect entity and placing that whereever your flacette is. You might need to update the position on think or something but at least then it would just base off itself and not rely on a parent entity (Note: Don't parent the particle effect entity to the flacette, because when the flacette dies, so will the effect entity, giving you the same problem you have now)
I know my advice is worded poorly, but theres some nugget of help in there, somewhere =P
Good luck
[QUOTE=Feihc;25326880]I think it all just depends on the effect. Some effects (if you use EffectAttach) need a constant ent to emit, I ran into this problem with my Morph Ball.
If you can't get it to work correctly, I suggest spawning a Particle Effect entity and placing that whereever your flacette is. You might need to update the position on think or something but at least then it would just base off itself and not rely on a parent entity (Note: Don't parent the particle effect entity to the flacette, because when the flacette dies, so will the effect entity, giving you the same problem you have now)
I know my advice is worded poorly, but theres some nugget of help in there, somewhere =P
Good luck[/QUOTE]
Yeah, I pretty much made a particle effect entity that updates with the flechette using think. Hell, I may as well scrap the built in flechette entity and make my own flechette, since the HL2 one has so many limitations.
Sorry, you need to Log In to post a reply to this thread.