• util.ParticleTracer
    10 replies, posted
This hardly mentioned function appeared recently in the Fretta Gamemode Base thread by garry and was listed on the wiki yet lacked a page. [URL]http://www.facepunch.com/showthread.php?t=763878&page=5[/URL] Even so the problem being with this function is that the #2 parameter of it does not work. util.ParticleTracer(strName, [B]vecStart[/B], vecEnd, boolWhizz ) I fiddled about with it for awhile with varying degrees of certainty and each time the console informed me of my evil programming ways. With that, I contacted a coding friend of mine and he fixed up what I was working on, according to him, this should have worked: [code] --cl_init.lua include ("shared.lua"); SWEP.PrintName = "Vortigaunt"; SWEP.Slot = 3; SWEP.SlotPos = 1; SWEP.DrawAmmo = false; SWEP.DrawCrosshair = false; --init.lua AddCSLuaFile ("cl_init.lua"); AddCSLuaFile ("shared.lua"); include ("shared.lua"); SWEP.Weight = 5; SWEP.AutoSwitchTo = false; SWEP.AutoSwitchFrom = false; --shared.lua SWEP.Author = ""; SWEP.Contact = ""; SWEP.Purpose = ""; SWEP.Instructions = ""; SWEP.Category = "" SWEP.Spawnable = true; SWEP.AdminSpawnable = true; SWEP.ViewModel = "models/weapons/v_pistol.mdl"; SWEP.WorldModel = "models/weapons/w_pistol.mdl"; SWEP.Primary.ClipSize = 1000; SWEP.Primary.DefaultClip = 1000; SWEP.Primary.Automatic = false; SWEP.Primary.Ammo = "smg"; if SERVER then function SWEP:PrimaryAttack() self:SendWeaponAnim( ACT_VM_PRIMARYATTACK ); self:TakePrimaryAmmo( 1 ) local trace = self.Owner:GetEyeTrace(); util.ParticleTracer("vortigaunt_beam", trace.StartPos, trace.HitPos, true) if IsValid(trace.Entity) and trace.Entity:IsPlayer() then local dmginfo = DamageInfo(); dmginfo:SetDamage( 5 ); dmginfo:SetAttacker( self.Owner ); dmginfo:SetInflictor( self ); dmginfo:SetDamagePosition( trace.HitPos ); dmginfo:SetDamageType( DMG_ENERGYBEAM ); end end end [/code] What occurs in this instance is no lua errors whatsoever, unfortunately the particle originates from the origin of the map, not the gunbarrel. Did I use a wrong parameter or is the function itself simply broken?
Try using self.Owner:EyePos()
With trace as self.Owner.EyePos() I received: [QUOTE]weapons\vortigaunt\shared.lua:27: bad argument #3 to 'ParticleTracer' (Vector expected, got nil)[/QUOTE] With the #3 parameter as self.Owner.EyePos() I received: [QUOTE]weapons\vortigaunt\shared.lua:27: bad argument #1 to 'EyePos' (Entity expected, got no value)[/QUOTE] self.Owner.EyeVector() got similar results, when assigned to trace I received: [QUOTE]weapons\vortigaunt\shared.lua:26: attempt to call method 'EyeVector' (a nil value) [/QUOTE] With the #3 parameter as self.Owner.EyeVector() [QUOTE]weapons\vortigaunt\shared.lua:27: attempt to call field 'EyeVector' (a nil value) [/QUOTE]
I recently tried ParticleEffect(strName, startVec, Ang, entity) and it was successful only in that it emitted from the gunbarrel. However, with the third parameter being "Ang", ParticleTracer() is the only viable option and if it's broken then this can't be done unless there is another function that can use particles in this manner.
Multiple sources have told me this method is broken, if it's otherwise I'd like to know what instead of trace.StartPos() would go in the second parameter. Other items that have not worked have been called off as functions, tables, or otherwise (with or without self.Owner identifiers) have been: GetEyeTrace() TraceLine() (Accompanied with Player:GetByID()) GetShootPos() GetAimVector() GetPlayerTrace() Maybe some others, I would not count any of these out as I may have made mistakes. These were already unlikely to work but seeing as the most obvious did not, I took a few shots in the dark with the above methods.
This is known. Tracer particles are required to come from a SWEP, it uses the muzzle as Vecstart.
[QUOTE=Empty_Shadow;19602434]This is known. Tracer particles are required to come from a SWEP, it uses the muzzle as Vecstart.[/QUOTE] What would be the method for that which would fit as a parameter in the ParticleTracer method? All the methods I have seen besides the Combine Portal Gun SWEP (Which doesn't have the particles emit from the muzzle) have used Effects, not particles. For instance the Manhack gun uses "Sparks" with util.Effect(string,effectdata), some other SWEPs use the ToolTracer effect and so on. Here's the issue of the particle coming from the origin of the map, this is using trace.StartPos: [IMG]http://s256.photobucket.com/albums/hh185/Cowgeneral/?action=view&current=sweperrors.jpg&newest=1[/IMG][IMG]http://i256.photobucket.com/albums/hh185/Cowgeneral/sweperrors.jpg[/IMG] [IMG]http://s256.photobucket.com/albums/hh185/Cowgeneral/?action=view&current=sweperrors.jpg&newest=1[/IMG]
Use util.ParticleTracerEx. I had this problem with util.ParticleTracer, so I tried util.ParticleTracerEx and it works.
[QUOTE=Jinto;19605390]Use util.ParticleTracerEx. I had this problem with util.ParticleTracer, so I tried util.ParticleTracerEx and it works.[/QUOTE] What would the last two parameters be for in that method? [B]util.ParticleTracerEx[/B]( strName, vecStart, vecEnd, boolWhizz, [B]int iEntity[/B], [B]int iAttachment[/B] )
If you don't want to use attachments you can just make them 0 and -1 respectively.
Thanks, I got it to work with the ParticleTracerEx, I don't know why the other came from the origin. (I was moving forward which explains the offset up.) [IMG]http://i256.photobucket.com/albums/hh185/Cowgeneral/gm_flatgrass0000.jpg[/IMG] I appreciate your help, thanks a bundle.
Sorry, you need to Log In to post a reply to this thread.