• Trying to render point_tesla clientside
    0 replies, posted
So I'm trying to create a point_tesla, but I don't think it's rendering on clientside since I can't see the arcs. Can anybody help with this? Thanks. /*     Created by: Metamorphics     STEAM_1:1:52851671 */ TeslaTrail = {} TeslaTrail.__index = TeslaTrail function TeslaTrail:new(ent, attachmentId, color, radius, minInterval, maxInterval, minBeamcount, maxBeamcount, minThickness, maxThickness, minLifetime, maxLifetime)   local tesla = ents.Create("point_tesla")   local newTeslaTrail = {     ent = ent,     attachmentId = attachmentId,     color = color,     radius = radius,     minInterval = minInterval,     maxInterval = maxInterval,     minBeamcount = minBeamcount,     maxBeamcount = maxBeamcount,     minThickness = minThickness,     maxThickness = maxThickness,     minLifetime = minLifetime,     maxLifetime = maxLifetime,     tesla = tesla   }   local strRed = tostring(newTeslaTrail.color.r)   local strGreen = tostring(newTeslaTrail.color.g)   local strBlue = tostring(newTeslaTrail.color.b)   local strColor = strRed.." "..strGreen.." "..strBlue.." 255"   tesla:Spawn()   tesla:Activate()   tesla:SetParent(ent, newTeslaTrail.attachmentId)   tesla:SetLocalPos(Vector(0, 0, 0))   tesla:SetKeyValue("texture", "trails/laser.vmt")   tesla:SetKeyValue("m_Color", strColor)   tesla:SetKeyValue("m_flRadius", newTeslaTrail.radius)   tesla:SetKeyValue("interval_min", newTeslaTrail.minInterval)   tesla:SetKeyValue("interval_max", newTeslaTrail.maxInterval)   tesla:SetKeyValue("beamcount_min", newTeslaTrail.minBeamcount)   tesla:SetKeyValue("beamcount_max", newTeslaTrail.maxBeamcount)   tesla:SetKeyValue("thick_min", newTeslaTrail.minThickness)   tesla:SetKeyValue("thick_max", newTeslaTrail.maxThickness)   tesla:SetKeyValue("lifetime_min", newTeslaTrail.minLifetime)   tesla:SetKeyValue("lifetime_max", newTeslaTrail.maxLifetime)   tesla:Fire("TurnOn", "", 0)   PrintTable(newTeslaTrail)   setmetatable(newTeslaTrail, TeslaTrail)   return newTeslaTrail end function TeslaTrail:RemoveFromPlayer()   SafeRemoveEntity(self.tesla)   self = nil end function TeslaTrail:IsValid()   return (self != nil) end setmetatable( TeslaTrail, { __call = TeslaTrail.new }) /*     Created by: Metamorphics     STEAM_1:1:52851671 */ include("classes/ParticleTrail.lua") include("classes/TeslaTrail.lua") AddCSLuaFile() AddCSLuaFile("classes/ParticleTrail.lua") AddCSLuaFile("classes/TeslaTrail.lua") game.AddParticles("particles/tfs_lightning_trail_yellow.pcf") game.AddParticles("particles/tfs_lightning_trail_red.pcf") game.AddParticles("particles/tfs_lightning_trail_blue.pcf") game.AddParticles("particles/tfs_lightning_trail_green.pcf") game.AddParticles("particles/tfs_lightning_trail_orange.pcf") game.AddParticles("particles/tfs_lightning_trail_purple.pcf") game.AddParticles("particles/tfs_lightning_trail_black.pcf") game.AddParticles("particles/tfs_lightning_trail_white.pcf") PrecacheParticleSystem("tfs_yellow_lightning") PrecacheParticleSystem("tfs_red_lightning") PrecacheParticleSystem("tfs_blue_lightning") PrecacheParticleSystem("tfs_green_lightning") PrecacheParticleSystem("tfs_orange_lightning") PrecacheParticleSystem("tfs_purple_lightning") PrecacheParticleSystem("tfs_black_lightning") PrecacheParticleSystem("tfs_white_lightning") hook.Add("Move", "tfs_trails", function(ply, mv)     if !(IsValid(ply) and ply:Alive()) then return end     local speedKeyDown = mv:KeyDown(IN_SPEED)     local speedsterWeaponActive = ply:GetActiveWeapon():GetClass() == "tfs_speedster"     if !(speedsterWeaponActive) then return end     if (mv:KeyPressed(IN_SPEED)) then         if (ply:GetInfoNum("tfs_spriteTrails", 0) == 1) then             ParticleEffectAttach("tfs_yellow_lightning", PATTACH_POINT_FOLLOW, ply, 0)         end         if (ply:GetInfoNum("tfs_particleTrails", 0) == 1) then             ply:addParticleLightning()         end         if (ply:GetInfoNum("tfs_TeslaTrails", 0) == 1) then             ply:addTeslaLightning()         end     end     if (mv:KeyReleased(IN_SPEED)) then         ply:StopParticles() //Find solution for using ply:StopParticlesNamed(). Move hook isn't called clientside in singleplayer since it is predicted. StopParticlesNamed method is clientside only.         if IsValid(ply) and IsValid(ply.tfs_ParticleTrail) then             ply.tfs_ParticleTrail:RemoveFromPlayer()         end         if IsValid(ply) and IsValid(ply.tfs_TeslaTrail) then             ply.tfs_TeslaTrail:RemoveFromPlayer()         end     end end) hook.Add("PlayerDeath", "tfs_TrailDeath", function(ply)     if IsValid(ply) and IsValid(ply.tfs_ParticleTrail) then         ply.tfs_ParticleTrail:RemoveFromPlayer()     end     if IsValid(ply) and IsValid(ply.tfs_TeslaTrail) then         ply.tfs_TeslaTrail:RemoveFromPlayer()     end end) local ply = FindMetaTable("Player") function ply:addParticleLightning()   local attachmentId = 2   local numberOfTrails = 24   local color = Color(self:GetInfoNum("tfs_particleTrailRed", 255), self:GetInfoNum("tfs_particleTrailGreen", 255), self:GetInfoNum("tfs_particleTrailBlue", 255))   local additive = 0   local startWidth = self:GetInfoNum("tfs_particleTrailStartWidth", 10)   local endWidth = 0   local lifeTime = self:GetInfoNum("tfs_particleTrailLifeTime", 0.35)   local texture = self:GetInfo("tfs_particleTrailMaterial")..".vmt"     self.tfs_ParticleTrail = ParticleTrail(self, attachmentId, numberOfTrails, color, additive, startWidth, endWidth, lifeTime, 1/startWidth*0.5, texture) end function ply:addTeslaLightning()     local color = Color(self:GetInfoNum("tfs_teslaTrailRed", 255), self:GetInfoNum("tfs_teslaTrailGreen", 255), self:GetInfoNum("tfs_teslaTrailBlue",255))     local radius = 150     local minInterval = 0.0005     local maxInterval = 0.05     local minBeamcount = 1     local maxBeamcount = 3     local minThickness = 5     local maxThickness = 10     local minLifetime = 0.1     local maxLifetime = 0.25     self.tfs_TeslaTrail = TeslaTrail(self, 2, color, radius, minInterval, maxInterval, minBeamcount, maxBeamcount, minThickness, maxThickness, minLifetime, maxLifetime) end
Sorry, you need to Log In to post a reply to this thread.