• Giving NPCs hats without editing the model
    10 replies, posted
I've seen this done in mods before, but whenever I try doing it I always end up with the model floating over the NPC's head and rotated at a weird angle. I tried just parenting a prop_dynamic to the NPC but I'm sure it's probably more complicated than that to make it work.
I think parenting a prop_dynamic is how Valve did it with the Vorts cooking in Black Mesa East.
Parent the prop_dynamic to the correct [url=http://developer.valvesoftware.com/wiki/Attachment]attachment point[/url]
So from what I'm seeing it looks like I have to use the SetParentAttachment input, but when I tried that the hat just ended up floating there not even parented to the NPC. I made a logic_auto with the output OnMapSpawn SetParentAttachment TestHat ValveBiped.bip01_head1, but I'm pretty sure that's not actually how you do it and I'm assuming you have to put the parent's name somewhere in there besides the prop_dynamic's settings, but I have no idea where.
You can open the model in the model viewer and see what and where the attachment points are. Then, first parent the prop_dynamic to the npc. Then do SetParentAttachment to the a given point. If it doesn't put it the right place, then try SetParentAttachmentOffset (I believe it's called).
That's what I did, and Model Viewer said the attachment point was ValveBiped.Bip01_Head1, but it didn't work ingame.
[QUOTE=DZ987;29148700]That's what I did, and Model Viewer said the attachment point was ValveBiped.Bip01_Head1, but it didn't work ingame.[/QUOTE] yeah, the attachment point is called "head" what you got was actually the bone the only other working one is hip or something
Make sure the default parent is set to the NPC before using SetParentAttachment, and the input has to be at least 0.01 seconds after the entity was parented.
That second part isn't true.
[url]http://developer.valvesoftware.com/wiki/Entity_Hierarchy_%28parenting%29[/url] [QUOTE=Valve Dev Wiki] SetParentAttachment [B]Note: Entities must be parented before being sent this input. Use at least a 0.01 second delay between SetParent and SetParentAttachment inputs. [/B] You can also fire a SetParentAttachment input at the child-entity to attach it to a specific attachment point on its parent. The parameter is the name of the attachment point. The Child instantly teleports to the attachment point. This is the only method which does not maintain the offset. [/QUOTE]
Try doing it. Worked for me when I was trying to make a projected texture parented to alyx's hip. [editline]13th April 2011[/editline] and her hand.
Sorry, you need to Log In to post a reply to this thread.