I'm currently working on a gore/dismemberment mod, but I'm at a loss on coding and I need some help. I have a template that's already been made by a friend, but he's busy working on another project and I'm trying to progress the mod. I'm able to do the modeling and such in a way similar to headspack. I've reached a point where I am making the entire body of the Combine split in half around the stomach area and I'm not sure how to spawn a ragdoll...properly. The coding that's been done by my friend makes the piece of the body being separated stand in place as if it was still attached to an invisible model. The physics are greatly messed up as well. Here's a piece of the code:
[CODE] if ( hitgroup == HITGROUP_RIGHTARM ) then if (dmginfo:GetDamage()* math.Rand(0.75,2) >= CriticalDamage) then
ParticleEffect("blood_headshoot",pos,Angle(0,0,0),nil)
if (npc:GetModel() == "models/combine_soldier.mdl") then
npc:SetModel("models//arms/combine_soldier_armless.mdl")
Gib(npc,pos,HeadshootGibAmount,HeadShootForce,direction)
RightArmGib(npc,pos,"models//arms/combine_rightarm.mdl",HeadShootForce,direction)
end
end
end[/CODE]
Here's the function that is supposed to spawn the piece of the body being shot off:
[CODE] function RightArmGib(ent,pos,headmodel,force,direction)
for i=1, 1 do
if (GetGlobalInt("gibsnum") >= GetConVar("g_maxgibs"):GetInt() ) then return end
local gib = ents.Create("prop_ragdoll")
gib:SetPos(pos + Vector(0,0,10))
gib:Spawn()
gib:Activate()
gib:SetModel(headmodel)
gib:SetAngles(ent:GetAngles())
local phys = gib:GetPhysicsObject()
if !phys:IsValid() then
return
end
phys:ApplyForceOffset(direction/2,direction)
gib:Fire( "kill", "", math.random(GibLifetimemin+3,GibLifetimemax+4))
end
end[/CODE]
This specific style of coding leads to no arm and the console errors:
Attempting to precache model, but model name is NULLRagdoll () has no model!
Is there a better way to spawn a ragdoll? I'm sure the model itself is just fine...
Sorry, you need to Log In to post a reply to this thread.