• Changing Position of a corpse (ttt)
    3 replies, posted
I wanted to spawn a corpse, but instead of spawning it at the dead player's location I want to spawn it elsewhere. So I thought I could just use SetPos() because the CORPSE:Create() method returns the ragdoll. But it doesn't do anything and just spawns it at the dead player's location. This is the code I used:     local rag = CORPSE.Create(ply, ply, DamageInfo()) -- Dummy damage info.     -- We have to modify some things on our ragdoll.     CORPSE.SetCredits(rag, 0) -- No Credits     local dmgtype = DMG_BULLET     rag.was_role = role     rag.dmgtype = dmgtype -- Add our Damage Type.     rag.was_headshot = dmgtype == DMG_BULLET -- Bullet Damage is always a headshot.     rag.dmgwep = dmgtype == DMG_BULLET and GetRandomWeapon() or "" -- Give it a random weapon if needed     rag:SetPos(pos)
Make sure the position is the location where the player died and not where the player "spawns" as a spectator.
Yep , I did that, but because it still didn't work I solved it as follows:     local rag = CORPSE.Create(owner, owner, DamageInfo()) -- Dummy damage info.     -- We have to modify some things on our ragdoll.     CORPSE.SetCredits(rag, 0) -- No Credits     CORPSE.SetPlayerNick(rag, ply)     local dmgtype = DMG_BULLET     rag.was_role = role     rag.dmgtype = dmgtype -- Add our Damage Type.     rag.was_headshot = dmgtype == DMG_BULLET -- Bullet Damage is always a headshot.     rag.dmgwep = dmgtype == DMG_BULLET and GetRandomWeapon() or "" -- Give it a random weapon if needed I just spawn it as the corpse of the player in the location, I want to spawn it at and afterwards I just change the corpse's name.
In fact you cannot use E:SetPos(V) on a ragdoll. That way you will move the head or torso and the other partts will stuck in the map or something. Try moving each individual part by getting the bone for head, torso,arms and legs. Them move thouse individually based on defined local vector.
Sorry, you need to Log In to post a reply to this thread.