WearGarment for NPC

I seem to be missing something here, using the standard wearable setup; I can use a script to change what the player is wearing (WearGarment(garment)). Is there an equivalent that lets you specify which object should be wearing something?

http://docs.textadventures.co.uk/quest/wearables.html lists functions like: ListWornFor (char) but gives no hints on how to get a NPC to wear an item in the first place, or to change it.


Do you have this library?


It has an easy way to make an NPC wear something. Plus, it's just altogether awesome, anyway!

I was hoping for a native way, but will take a look at that. Thanks.

I was hoping for a native way

You could make the NPC a surface, then you can...


It's much easier to use that library. If it doesn't work out for you, come back and let us know. We'll post some code to make things work, but it won't be quick and painless.

I figured out how the library does it, can just make a function like:

<function name="NpcWear" parameters="npc, obj">
if (not obj.worn) {
  obj.worn = true
  obj.parent = npc

Obviously this does not do any checking or anything, but it does mean that functions like GetOuterFor will return the correct value

Wearable attributes should already be in the game. I don't know how it works though.

I thought you would either have to make and/or set a boolean or a string. For the funcfions to work. Something like...

armor.wearable = true


armor.wearable = "wearable"


armor.wearable1 = true


armor.wearable1 = "wearable"

Log in to post a reply.