Page 1 of 1

Change Clothing of an NPC

PostPosted: Sat Dec 17, 2011 5:56 am
by Christopher
I tried to spawn a global avatar (Male) as NPC. Then I wanted to change it's clothing, but it seems that the NPC has no Clothing group and so the NPC is all time a standard male avatar. I wanted to ask if it is possible to give NPCs a Clothing group, so they can be customized. It would open many new possibilities in age creation.

Christopher

Re: Change Clothing of an NPC

PostPosted: Sat Dec 17, 2011 11:06 am
by D'Lanor
Been there, tried it and failed. :(

I don't think it has anything to do with the clothing group though. The Male and Female avatars still retain their clothing groups when you spawn them as NPCs. With PlasmaShop I even found their clothing stored in the age state. It should be possible to change it there but I have no idea how. As you have already found out the regular methods for avatar dressing don't work on NPCs. And when I modified the clothing in the age state with PlasmaShop it made the age crash.

Re: Change Clothing of an NPC

PostPosted: Sat Dec 17, 2011 12:33 pm
by Christopher
I made used NPC.avatar.getAvatarClothingGroup() (NPC is the sceneobject of the NPC) to get the clothing group from the avatar. The result was -1. If you use this command for an player you'll get 0 for male, 1 for female and 2 for an custom avatar. So I thought that it has no clothing group set. Maybe I should also say, that I tried this on a MOULa testing shard, not in TPOTS.

Christopher

Re: Change Clothing of an NPC

PostPosted: Sat Dec 17, 2011 4:29 pm
by D'Lanor
Returning the number -1 is often Plasma's way of saying "sorry, I could not find what you were looking for". None of the methods in the ptAvatar class I tried work on NPCs and that includes all the clothing stuff. If you do the check NPC.isAvatar() you'll see that it returns false. This confirms that NPCs are not true avatars and therefore the ptAvatar class does not always apply to them.

Edit: btw, if I do try to put clothing on a plain Male or Female NPC it raises an "unidentifiable C++ exception".

Re: Change Clothing of an NPC

PostPosted: Sun Dec 18, 2011 3:33 am
by Christopher
Because of this problem, I wrote this into this forum. I hoped maybe someone can find the problem in the client and fix it...

Christopher

PS: And thank you for trying this out D'Lanor ;)