Hey,
I was wondering if it would be possible to prevent zombies from spawning headcrabs upon dying. At the moment, I'm spawning a "npc_zombie" and changing the model to a custom one, which works perfectly. However, if I kill it and it decides it should drop a headcrab, the model changes back to the Half-Life 2 one and a headcrab appears, which is a problem for me.
I'd really appreciate any advice that you could give.
Thanks very much,
Josh
Not sure if this'd work but uh here:
[lua]
function ThinkShit()
for _,v in pairs(ents.FindByName("npc_headcrab")) do
v:Remove()
end
end
hook.Add("Think","RemoveDaCrabzyo",ThinkShit)
[/lua]
Look in that direction. If it doesn't work then it's probably cus I got the headcrab name wrong.
[QUOTE=jrj996;30539764]Not sure if this'd work but uh here:
[lua]
function ThinkShit()
for _,v in pairs(ents.FindByName("npc_headcrab")) do
v:Remove()
end
end
hook.Add("Think","RemoveDaCrabzyo",ThinkShit)
[/lua]
Look in that direction. If it doesn't work then it's probably cus I got the headcrab name wrong.[/QUOTE]
Thanks for the advice. Unfortunately, the corpse of my zombies would still have the model of the Half-Life 2 model. I suppose I could do the same function to check the texture of all corpses and then change appropriately... but isn't it inefficient/expensive to use "think" like this?
I guess, you could find another way but it was a quick suggestion.
As far as I know, with client side ragdolls, all default model settings are applied on death. That includes model, colour, etc. To circumvent this, you'd have to spawn prop_ragdolls on death, server side, which would get very messy, and inefficient.
A better method, rather than using Think would be to hook [b][url=wiki.garrysmod.com/?title=Gamemode.OnNPCKilled]Gamemode.OnNPCKilled [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] instead.
Sorry, you need to Log In to post a reply to this thread.