Author Topic: Adding items to vendor via script  (Read 652 times)

Legacy_Wallack

  • Full Member
  • ***
  • Posts: 221
  • Karma: +0/-0
Adding items to vendor via script
« on: April 18, 2016, 10:58:20 am »


               

Hi.


 


I don't have the toolset close and won't have it until 7 more hours so wanted to ask womething.


 


I use Commche's random loot generator for my module (will be an action oriented module for levels 1-80 that will announce in a couple of weeks, mostly for fun) and is great.


 


The thing is, I was thinking about adding some vendors that would sell items generated randomly. To do that, my idea was to use a hidden chest, generate the items there, and then, make the vendor read the chest to sell those items.


 


Is this possible at all? Do you guys have anyother suggestion?


 


Thanks.



               
               

               
            

Legacy_Wallack

  • Full Member
  • ***
  • Posts: 221
  • Karma: +0/-0
Adding items to vendor via script
« Reply #1 on: April 18, 2016, 12:37:09 pm »


               

Ok, so correct me if I'm wrong. A store has an inventory so I can just get the store (an object) and add items to its inventory is that right ? I think it should be really easy to do so then.



               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Adding items to vendor via script
« Reply #2 on: April 18, 2016, 12:41:22 pm »


               

Yup, thats pretty much how its done.


Anything that has an inventory, can receive items via 


CreateItemOnObject();


or


AssignCommand(oStore,ActionTakeItem());


 


Just be careful with loading stores with Items from scripts, you can overload them, which affects performance.



               
               

               
            

Legacy_Wallack

  • Full Member
  • ***
  • Posts: 221
  • Karma: +0/-0
Adding items to vendor via script
« Reply #3 on: April 18, 2016, 01:06:57 pm »


               


Yup, thats pretty much how its done.


Anything that has an inventory, can receive items via 


CreateItemOnObject();


or


AssignCommand(oStore,ActionTakeItem());


 


Just be careful with loading stores with Items from scripts, you can overload them, which affects performance.




 


Thanks. I just want some vendors to sell some randomly generated items so on every restart they will have new and interesting stuff.