Hi all! I have this code that is working and all, but the problem is it won't push the ragdoll locally. So everytime it's spawned it flies towards the same direction. target -means the npc that will spawn the ragdoll on death. I do have damageinfo that gets passed to this function, but I don't know how I would utilize it to make my thing happen. Basically I wan't the ragdoll to fly relative to the shooter. This script is run from serverside.
[CODE]
--Create ragdoll
local rag = ents.Create("prop_ragdoll")
rag:SetName("ragdoll_test")
rag:SetPos(target:GetPos())
rag:SetAngles(target:GetAngles())
rag:SetModel(target:GetModel())
rag:Spawn()
rag:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
rag:GetPhysicsObject():AddVelocity(rag:LocalToWorld(Vector(0, math.random( 100, 200 ), math.random( 50, 100 ) )))
[/CODE]
This might work, but if not, you could try [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/GetAimVector]Player:GetAimVector[/url] on the attacker
[CODE]
rag:GetPhysicsObject():AddVelocity(dmginfo:GetDamagePosition() * dmginfo:GetDamageForce())
[/CODE]
Sorry, you need to Log In to post a reply to this thread.