Aller au contenu

Photo

How to remove an item from an NPC?


  • Veuillez vous connecter pour répondre
1 réponse à ce sujet

#1
Qwinn1234

Qwinn1234
  • Members
  • 144 messages
I'm working on a fix for a bug:  during the quest Crime Wave, if you get Ser Nancine's Ornamental Sword via dialogue, you can then pickpocket it from her again.  I'm trying to remove the sword from her altogether, but having difficulty.  Here's the bit from her script that unequips the sword so you can't see it:

            case THIEF_PICK2_SUCCESSFUL:
            {
                // Unequip Nancine's sword
                oTarg = UT_GetNearestCreatureByTag(oPC, DEN_CR_PICK2_NANCINE);
                object oItem = GetItemInEquipSlot(INVENTORY_SLOT_MAIN, oTarg);
                UnequipItem(oItem, oTarg);

Since neither UT_RemoveItemFromInventory or RemoveItem seem suitable (both seem to work only on the player's inventory.... I eventually found an instance of RemoveItem in another script, and it only took the item as a parameter, so I'm guessing that's the case anyway).  But I did find uses of RemoveItemsByTag that seem to allow for an object to be passed to it, so I tried it:

            case THIEF_PICK2_SUCCESSFUL:
            {
                string sItemTag;
                // Unequip Nancine's sword
                oTarg = UT_GetNearestCreatureByTag(oPC, DEN_CR_PICK2_NANCINE);
                object oItem = GetItemInEquipSlot(INVENTORY_SLOT_MAIN, oTarg);
                UnequipItem(oItem, oTarg);
                // Qwinn: Removing sword so it can't be pickpocketed afterwards
                sItemTag = GetTag(oItem);
                RemoveItemsByTag (oTarg, sItemTag);

Unfortunately, that didn't work.  I can still pickpocket a second copy off of her after I've already acquired one via dialogue.

Any hints or help?

Qwinn

Modifié par Qwinn1234, 01 avril 2010 - 06:20 .


#2
Qwinn1234

Qwinn1234
  • Members
  • 144 messages
Never mind, I figured it out. Realized that you CAN pass an optional object to UT_RemoveItemFromInventory to override the default that it applies to the PC. Did so, and it worked. Not sure why the above didn't also work, but I see no need to get that method working now, UT_RIFI is easier.

I was initially having trouble pulling up parameter lists and toolset help for those functions... the overview says to double-click or right click on them, but doesn't specify that you have to do so -in the script editor-... I kept trying to click them in the list window that appears next to the editor, the list that you can change to constants or templates, etc. So, now that I can see documentation on these functions, life should get a lot simpler.

Thanks for taking the time to read.

Qwinn

Modifié par Qwinn1234, 01 avril 2010 - 06:43 .