Author Topic: Merchant inventory  (Read 412 times)

Legacy_Terrorble

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Merchant inventory
« on: September 12, 2011, 05:59:14 am »


               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?
               
               

               
            

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
Merchant inventory
« Reply #1 on: September 12, 2011, 09:27:09 am »


               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 .
                     
                  


            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Merchant inventory
« Reply #2 on: September 12, 2011, 04:51:28 pm »


               Use this function..

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

               


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


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Merchant inventory
« Reply #3 on: September 12, 2011, 09:09:14 pm »


               

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.