Equip Wearables on NPCs only solution...

... seems to be to make the NPCs playable and jump in to use player object wear method and jump back out in the same frame, unbeknownst to player. If you try otherwise, it just goes from that NPC to the player. Am I missing something? Curious as to why it's not already a thing without the possession step. I'll probably try looking how it's done in the library and see if that can happen for NPCs, maybe.

You'd probably need to duplicate most of the code in CoreWearable.aslx; because all the wearable code assumes the player.

The function I ended up using so far is:

<function name="NPCWear" parameters="object, clothing">
    // we have to switch into a character and back out to change NPC clothing...
    ChangePOV (object)
    foreach (n, clothing) {
      WearGarment (n)
    ChangePOV (player)
    // This will clear the screen and show the room description... may not work well for all cases

Clearing the screen sounds like it might be a little clunky. In that case, it might be better to do:

<function name="NPCWear" parameters="object, clothing">
    // Disable the changescript which normally handles changes of POV:
    changescript = game.changedpov
    game.changedpov = null

    // change POV without displaying a new descriptions
    game.pov = object

    // handle wearing the stuff:
    foreach (n, clothing) {
      WearGarment (n)

    // put the player back in control
   game.pov = player

    // and enable all the changed-pov magic again
    game.changedpov = changescript

A more robust way might be to duplicate the functions WearGarment and SetBonuses for NPCs, doing the same things but not assuming that game.pov is the character doing the wearing. But that's likely to be quite a big job.

Long time programmer but figuring out where everything is and reading others' code takes time. I wish things (anything in the tree) had actual inheritance in their construction, it would be easier to reuse code. Thanks for the method.

Well, there's egg and bacon; egg sausage and bacon; egg and spam; egg bacon and spam; egg bacon sausage and spam; spam bacon sausage and spam; spam egg spam spam bacon and spam; spam sausage spam spam bacon spam tomato and spam;

(formatted for Split())

Log in to post a reply.