Hey there!
I've been having some issues with a simple bit of code I've been trying out. I want to set the model of a TTT corpse entity when it's identified if the body belonged to a Traitor. However, I can't seem to set the model without making it invisible for anyone who was within render range of the entity. The only way to get the entity to render again is to leave its render area and come back.
My issue with most things is that I am only allowed to use [b]serverside[/b] functions because of the way the [b]TTTBodyFound[/b] hook works. I could do some networking, but I'd prefer to stay away from it unless it's the only way to go, mostly because I'm not sure how I would go about this using networking.
If anyone knows what might be the issue and/or the solution, [b]please[/b], let me know.
The code I'm trying to use ([b]in lua/autorun[/b]):
[code]
local changeling = Model("models/player/mlp/changeling_player_colorable_v2.mdl")
if SERVER then
hook.Add("TTTBodyFound", "pp3-set-changeling-model", function(finder, deadply, corpse)
if corpse.was_role == ROLE_TRAITOR then
corpse:SetModel(changeling)
end
end)
end
[/code]
Again, if you know anything of use, please help out! Thank you!
[b]ninja edit:[/b] Removed silly hacky attempt at getting things to work --- same problem with or without it.
Try
[CODE]
local changeling = "models/player/mlp/changeling_player_colorable_v2.mdl"
[/CODE]
[QUOTE=Jiwer;50933418]Try
[CODE]
local changeling = "models/player/mlp/changeling_player_colorable_v2.mdl"
[/CODE][/QUOTE]
I'll try that when I get the chance, but what would that do besides not precache the model?
You can't just set the Model of a corpse.
You still have to redo physics of the ragdoll etc.
[QUOTE=deinemudda32;50935035]You can't just set the Model of a corpse.
You still have to redo physics of the ragdoll etc.[/QUOTE]
The models we're using should be on the same skeleton, etc, and they render and work fine. The only issue is, again, them not appearing until re-rendered.
Sorry, you need to Log In to post a reply to this thread.