• Drag and Drop Ragdoll Problem
    3 replies, posted
myStunnedRagdoll = ents.Create("prop_ragdoll") myStunnedRagdoll:SetModel(_player.model) myStunnedRagdoll:SetPos(_player.position) myStunnedRagdoll:SetAngles(_player.angle) myStunnedRagdoll:Spawn() myStunnedRagdoll:SetName("myRagdoll") myStunnedRagdoll.timerName = ply:SteamID64() local timerName = tostring(myStunnedRagdoll.timerName)     timer.Create(timerName,5,1, function() WakeUp(ply,_player.weapons,ammo,_player.position, myStunnedRagdoll) end) So here is a part of code. Don't worry about these global variables, I am not willing to publish it. It's a SWEP, whenever you hit somebody it creates his ragdoll and makes the player spectate no problem with that. With right click, you carry the ragdoll here is the code: if self.RagdollAttached == true and IsValid(myStunnedRagdoll) then local owner = self:GetOwner() if myStunnedRagdoll == null then return end local phys = myStunnedRagdoll:GetPhysicsObject() local params =  { secondstoarrive = 0.1, pos = owner:GetShootPos() + owner:GetAimVector() * 80, maxangular = 300, maxangulardamp = 300, maxspeed = 300, maxspeeddamp = 100, dampfactor = 0.8, teleportdistance = 2000, deltatime = FrameTime() } phys:Wake() phys:ComputeShadowControl(params) end The problem begins when there are two player ragdolls, whenever I hit somebody, the new ragdoll becomes the primary ragdoll and the old one is overridden. Any help appreciated, thanks!
You might just need to index the ragdoll when it is being created self.ragdoll = myStunnedRagdoll:EntIndex()
You just made my day, Thanks!!
No problem, Glad i could help. No problem, Glad i could help.
Sorry, you need to Log In to post a reply to this thread.