Aller au contenu

Photo

Merchant inventory


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
Terrorble

Terrorble
  • Members
  • 194 messages
How do I add/remove items from a merchant inventory via scripting?  I am assuming it is done via the OnOpenStore and OnStoreClosed events, but I guess I do not know which functions to use.

I have already created the merchant in the toolset, associated it with an NPC, and it opens and has the regular junk I set it up to have in it.  Now, I'd like to occasionally have it add other items depending on certain factors.  Do I use CreateItemOnObject()?  Or if I want to remove something: cycle thru the store's inventory to find what I want to remove?  Do those things work for merchants?

#2
Xardex

Xardex
  • Members
  • 217 messages
They should work assuming the target has an inventory, though I have never tried to use them with merchants... Why not just test it out yourself?

Modifié par Xardex, 12 septembre 2011 - 08:27 .


#3
_Guile

_Guile
  • Members
  • 685 messages
Use this function..

object CreateItemOnObject(
    string sItemTemplate,
    object oTarget = OBJECT_SELF,
    int nStackSize = 1,
    string sNewTag = ""
);

Modifié par _Guile, 12 septembre 2011 - 03:54 .


#4
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

Terrorble wrote...

How do I add/remove items from a merchant inventory via scripting?  I am assuming it is done via the OnOpenStore and OnStoreClosed events, but I guess I do not know which functions to use.

I have already created the merchant in the toolset, associated it with an NPC, and it opens and has the regular junk I set it up to have in it.  Now, I'd like to occasionally have it add other items depending on certain factors.  Do I use CreateItemOnObject()?  Or if I want to remove something: cycle thru the store's inventory to find what I want to remove?  Do those things work for merchants?


Yes,  those things work for merchants.