• Get NPC's ragdoll after death
    8 replies, posted
Does anyone know how to get the ragdoll entity after you kill an NPC? Goremod does something similar when you shoot an NPC's head off or something like that, but I can't for the life of me figure it out. There is the "BecomeRagdoll" input for NPC's, but if I do anything to the NPC beforehand the change doesn't carry to the ragdoll. Thoughts?
Put all ragdolls in a table, if a ragdoll is created and its not in the table, associate it with the last killed npc or whatever and then put the ragdoll in the table. Not very explanatory but I think you'll get it.
Trying that, and it works, but how do you propose I tell if the death associated with this ragdoll was from the weapon I am using that I want this effect to be done with
Make a queue table or a single variable that holds this info (from the last killed npc) and fetch it when associating the ragdoll with the death.
Hook CreateClientsideRagdoll on the client. [lua] local function npckilled(npc,ragdoll) print("A Clientside ragdoll is being made by the engine, test if we should override it") print("npc=",npc,"ragdoll=",ragdoll) end hook.Add("CreateClientsideRagdoll", "Superzombie wants your ragdolls", npckilled)[/lua] The only problem I've had with this is when exploding npcs, if you get gibs or crawling zombies, it may not work 100%. EDIT: Syntax highlighting seems stuffed up on my Lua...
[QUOTE=wh1t3rabbit;40807883]Hook CreateClientsideRagdoll on the client. [lua] local function npckilled(npc,ragdoll) print("A Clientside ragdoll is being made by the engine, test if we should override it") print("npc=",npc,"ragdoll=",ragdoll) end hook.Add("CreateClientsideRagdoll", "Superzombie wants your ragdolls", npckilled)[/lua] The only problem I've had with this is when exploding npcs, if you get gibs or crawling zombies, it may not work 100%. EDIT: Syntax highlighting seems stuffed up on my Lua...[/QUOTE] Awesome, that works a lot better for what I need. Now my question is, how do I modify the head size on the ClientRagdoll entity?
Shameless bump, anyone know?
[QUOTE=Feihc;40818894]Shameless bump, anyone know?[/QUOTE] Someone asked this a few days ago. [url]http://facepunch.com/showthread.php?t=1272086[/url]
[QUOTE=_Kilburn;40825785]Someone asked this a few days ago. [URL]http://facepunch.com/showthread.php?t=1272086[/URL][/QUOTE] That's what I've been trying, but it doesn't seem to work on the clientside ragdolls. If you have ai_serverragdolls enabled then the ragdolls get created as actual prop_ragdoll entities, and it works fine there, but if you don't, and they're clientside, then they are C_ClientRagdoll entities and the scaling just makes the entity disappear
Sorry, you need to Log In to post a reply to this thread.