I’m trying to make a special weapon for TTT that dissolves the victim’s corpse when they die, but all the methods I’ve been able to find so far haven’t worked. Any tips on how to get this done?
Have a look at the flare gun’s source code, that’s what it’s built to do.
True, but I was hoping to make a gun that uses the AR2 dissolve effect rather than the flame one from the flare gun. It seems a bit more complicated.
Look through the wiki for anything involving disintegrating or the ar2. Sadly the ar2 is coded in c (or c++, idk) and the public can’t see that code.
Have a look at this thread: http://forum.facepunch.com/showthread.php?t=1378865
Thank you crazyscouter! The information in that thread was not complete but I was able to figure it out from there. In case anyone comes to this topic looking for it, here is the final code I used to get it working:
local function dissolveBody(victim, inflictor, attacker) if weaponclass == "weapon_ttt_nanorifle" then local corpse = corpse_find(victim) corpse:SetName("cleanser_dissolve") local dissolver = ents.Create( "env_entity_dissolver" ) dissolver:SetPos( corpse:GetPos() ) dissolver:Spawn() dissolver:Activate() dissolver:SetKeyValue( "target", "cleanser_dissolve" ) dissolver:SetKeyValue( "magnitude", 100 ) dissolver:SetKeyValue( "dissolvetype", 2 ) dissolver:Fire( "Dissolve" ) --dissolver:Remove() (This line prevented the code from working but I'm not sure what the drawbacks of removing it are.) end end hook.Add("PlayerDeath", "BodyDissolverHook", dissolveBody)