• Setting a players RagDoll position
    2 replies, posted
Hi all, I'm trying to set the players ragdoll so that is spawns crouched, I've tried a variety of different methods and none of them work quite right. I'm using the following code to hook the player death [code] function PlayerDied( pl, weapon, killer ) -- Code here end hook.Add( "PlayerDeath", "PlayerDeath", PlayerDied ) [/code] I'm then trying to set the sequence of the player before/after they die, however the player entity seems to ignore this and the radgoll spawns at standing height. [code] local sequence = pl:LookupSequence("crouchidlehide") pl:SetPlaybackRate( 1.0 ) pl:SetSequence(sequence) pl:ResetSequence( sequence ) pl:SetCycle( 1 ) sequence = pl:GetSequence() pl:SetColor(Color(255,255,255,255)) pl:CreateRagdoll() [/code] So I tried setting the ragdoll to a sequence, which is also ignored: [code] pl:CreateRagdoll() local ent = pl:GetRagdollEntity() sequence = ent:LookupSequence("crouchidlehide") ent:SetPlaybackRate( 1.0 ) ent:SetSequence(sequence) ent:ResetSequence( sequence ) ent:SetCycle( 1 ) [/code] I tried a different tact, spawning a prop_physics and trying to call BecomeRagdollOnClient(), but nothing happens the prop just despawned [code] --local ent = ents.Create("npc_zombie") -- This creates our zombie entity pl:DrawViewModel( false ) pl:StripWeapons() local doll = ents.Create( "prop_physics" ) doll:SetModel( "models/Humans/Group01/Male_05.mdl" ) doll:SetPos( pl:GetPos() ) doll:SetAngles( pl:GetAngles() ) doll:SetCollisionGroup( COLLISION_GROUP_WEAPON ) doll:Spawn() sequence = doll:LookupSequence("crouchidlehide") doll:SetPlaybackRate( 1.0 ) doll:SetSequence(sequence) doll:ResetSequence( sequence ) doll:SetCycle( 1 ) doll:BecomeRagdollOnClient() [/code] We also tried spawning and npc, getting them to crouch, but couldn't call kill() on the npc and a few other permutations of spawning props/ragdolls/npc's Does anyone know if it is possible to set the sequence/position of a ragdoll to look like it is crouched? How do you do it?
[code]local doll = ents.Create( "prop_physics" )[/code] Try making that a prop_ragdoll instead.
Same issue! It's like entity set sequence doesn't work for these models?
Sorry, you need to Log In to post a reply to this thread.