• Changing owner for entityflame
    2 replies, posted
In my gamemode that I'm creating, I'm using GDCW weapons, which has White Phosphorus weapons. In this gamemode, I'm also implementing a kill counter and kill streaks, stored in NetworkedInts. The weapons use this to ignite entities in the blast area: [LUA] for k, v in pairs ( ents.FindInSphere( tr.HitPos, 500 ) ) do if v:IsPlayer() || v:IsNPC() then local trace = {} trace.start = tr.HitPos+tr.HitNormal*30 trace.endpos = v:GetPos() + Vector(0,0,30) trace.filter = self.Entity local wp = util.TraceLine( trace ) if wp.Entity:IsPlayer() || wp.Entity:IsNPC() then v:Ignite( 5, 100 ) end end [/LUA] In the kill counter, I'm using killer:GetOwner() and killer:GetParent(). When I trace the source of the death, killer returns entityflame and killer:GetParent() returns the victim. killer:GetOwner() returns NULL. Is there a way to set entityflame's Owner to the inflicting weapon instead of the victim, while still Igniting the victim? GDCW weapons use ents instead of traces to deal damage in all of their weapons. So, in this case, I'm using the M202 rocket launcher, which fires the M74 rocket. The Rocket in turn, ignites the entities. gdcw_m202 ---> gdcwa_m74 ----> v:Ignite()
[QUOTE=wranders;39202034]In my gamemode that I'm creating, I'm using GDCW weapons, which has White Phosphorus weapons. In this gamemode, I'm also implementing a kill counter and kill streaks, stored in NetworkedInts. The weapons use this to ignite entities in the blast area: [LUA] for k, v in pairs ( ents.FindInSphere( tr.HitPos, 500 ) ) do if v:IsPlayer() || v:IsNPC() then local trace = {} trace.start = tr.HitPos+tr.HitNormal*30 trace.endpos = v:GetPos() + Vector(0,0,30) trace.filter = self.Entity local wp = util.TraceLine( trace ) if wp.Entity:IsPlayer() || wp.Entity:IsNPC() then v:Ignite( 5, 100 ) end end [/LUA] In the kill counter, I'm using killer:GetOwner() and killer:GetParent(). When I trace the source of the death, killer returns entityflame and killer:GetParent() returns the victim. killer:GetOwner() returns NULL. Is there a way to set entityflame's Owner to the inflicting weapon instead of the victim, while still Igniting the victim? GDCW weapons use ents instead of traces to deal damage in all of their weapons. So, in this case, I'm using the M202 rocket launcher, which fires the M74 rocket. The Rocket in turn, ignites the entities. gdcw_m202 ---> gdcwa_m74 ----> v:Ignite()[/QUOTE] When a weapon sets someone on fire, set a variable on the player that was ignited directing to the weapon's owner.
Thanks for reading. [QUOTE=skullorz;39202641]When a weapon sets someone on fire, set a variable on the player that was ignited directing to the weapon's owner.[/QUOTE] That's the problem, I can't find a link between Ignite and the weapon. The weapon tells the player to Ignite itself, instead of actually igniting them. You know of a way to make that happen? If you did, that would honestly solve my problem. [U][B]EDIT:[/B][/U] Fixed. I ended up making the connection using networked variables, as skullorz suggested. Took a bit of tinkering, but it's fully functional now. Weapon code: [LUA] for k, v in pairs ( ents.FindInSphere( tr.HitPos, 500 ) ) do if v:IsPlayer() || v:IsNPC() then local trace = {} trace.start = tr.HitPos+tr.HitNormal*30 trace.endpos = v:GetPos() + Vector(0,0,30) trace.filter = self.Entity local wp = util.TraceLine( trace ) if wp.Entity:IsPlayer() || wp.Entity:IsNPC() then v:Ignite( 5, 100 ) v:SetNetworkedString( "attacker", self.Entity:GetOwner() ) end end [/LUA] Killstreak code: [LUA] local atkr = victim:GetNetworkedString("attacker") victim:SetNetworkedInt( "killstreak", 0 ) atkr:SetNetworkedInt( "kills", atkr:GetNetworkedInt( "kills" ) + 1 ) atkr:SetNetworkedInt( "killstreak", atkr:GetNetworkedInt( "killstreak" ) + 1 ) victim:SetNetworkedString("attacker", " ") return end [/LUA]
Sorry, you need to Log In to post a reply to this thread.