• Getting NPC's ragdoll?
    4 replies, posted
I use [B][URL="http://wiki.garrysmod.com/?title=Gamemode.CreateEntityRagdoll"]Gamemode.CreateEntityRagdoll [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG][/URL][/B] to get NPC's ragdoll when convar ai_keepragdolls is set to 1, but how do I get the ragdoll that gets created when its set to 0? I know that SilverLan's Trex SNPC does controls the ragdolls movement, but does he actually gets the ragdoll or does he create a new ragdoll instead?
[QUOTE=freemmaann;27003480]but how do I get the ragdoll that gets created when its set to 0?[/QUOTE] That ragdoll is clientside,you'd need to check on the client a CRagdollwhatever(can't remember the exat classname) with the same model as the npc in the ents.GetAll(). You can use [b][url=http://wiki.garrysmod.com/?title=Ents.FindByModel]Ents.FindByModel [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b],I know,you will not know which ragdoll is owned by which npc when there are multiple with the same model.
[QUOTE=Jvs;27003882]That ragdoll is clientside,you'd need to check on the client a CRagdollwhatever(can't remember the exat classname) with the same model as the npc in the ents.GetAll(). You can use [B][URL="http://wiki.garrysmod.com/?title=Ents.FindByModel"]Ents.FindByModel [img_thumb]http://wiki.garrysmod.com/favicon.ico[/img_thumb][/URL][/B],I know,you will not know which ragdoll is owned by which npc when there are multiple with the same model.[/QUOTE]Thanks, did a quick check, its C-ClientRagdoll when searched on client, but how can I do this one a moment when an NPC is killed[U][B]? [/B][/U][B][URL="http://wiki.garrysmod.com/?title=Gamemode.CreateEntityRagdoll"][b][url=wiki.garrysmod.com/?title=Gamemode.OnNPCKilled]Gamemode.OnNPCKilled [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b][/URL][/B] [B][URL="http://wiki.garrysmod.com/?title=Gamemode.EntityTakeDamage"]Gamemode.EntityTakeDamage [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG][/URL][/B] both run only on server.
[QUOTE=freemmaann;27004343]Thanks, did a quick check, its C-ClientRagdoll when searched on client, but how can I do this one a moment when an NPC is killed[U][B]? [/B][/U][B][URL="http://wiki.garrysmod.com/?title=Gamemode.CreateEntityRagdoll"][b][url=wiki.garrysmod.com/?title=Gamemode.OnNPCKilled]Gamemode.OnNPCKilled [img_thumb]http://wiki.garrysmod.com/favicon.ico[/img_thumb][/url][/b][/URL][/B] [B][URL="http://wiki.garrysmod.com/?title=Gamemode.EntityTakeDamage"]Gamemode.EntityTakeDamage [img_thumb]http://wiki.garrysmod.com/favicon.ico[/img_thumb][/URL][/B] both run only on server.[/QUOTE] Sadly,i don't know how you would do that. You can hook [b][url=wiki.garrysmod.com/?title=Gamemode.OnEntityCreated]Gamemode.OnEntityCreated [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] clientside,so when a npc dies it's ragdoll will be passed as an argument if the npc was in your pvs.
How on earth does silverlan do it? I'm having a really hard time reading other peoples code, especially silverlans :/ Searching for C-ClientRagdoll would work, but I also need the NPC that this entity belonged to, which I have no idea how to get, so I guess I'll quit on this part of the project. Still wonder how silverlan does it tho.
Sorry, you need to Log In to post a reply to this thread.