Author Topic: Tracking Buying and Selling of Items per merchant  (Read 375 times)

Legacy_Birdman076

  • Sr. Member
  • ****
  • Posts: 320
  • Karma: +0/-0
Tracking Buying and Selling of Items per merchant
« on: February 07, 2012, 04:37:56 pm »


               Is it possible to track items sold to a merchant and keep a running tally of gold amounts for bought and sold items so that at a certain level a player would gain a discount for using that merchant extensively? I use the nwn db and item db setup currently because I just don't have a ton of time to devote to learning sql atm. This would lead to another question which is what are the variable storing limits on a placeable? Say a door that would keep track of unlock attempts and/or visits by a rogue so that one could script a surprise for them should they use the same establishment or home for thier gain to many times?
               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Tracking Buying and Selling of Items per merchant
« Reply #1 on: February 07, 2012, 05:36:05 pm »


               For your merchants a DB is most probably the best approach, indeed. Since in this precise case the DB is not queried very often and you don't need much flexibility, using the Bio DBs is probably sufficient, yet you should ensure that your code cleans your tables periodically since the Bio DBs tend to uselessly become very large and slow rather quickly.

By variable storing limits, do you mean the number of variables a placeable can hold? IIRC it would be a few thousands, preferably less than 5000. But since thousands of players on a server is quite improbable, the limit should not be a concern.


Kato
               
               

               


                     Modifié par Kato_Yang, 07 février 2012 - 05:44 .
                     
                  


            

Legacy_Birdman076

  • Sr. Member
  • ****
  • Posts: 320
  • Karma: +0/-0
Tracking Buying and Selling of Items per merchant
« Reply #2 on: February 07, 2012, 08:54:03 pm »


               Kato,

Yes I mean the number of variables a placeable can hold and I came to the same conclusion on player limits as well but wanted some sort of an idea as to what limitations if any would exist.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Tracking Buying and Selling of Items per merchant
« Reply #3 on: February 07, 2012, 09:31:18 pm »


               

Birdman076 wrote...

Kato,

Yes I mean the number of variables a placeable can hold and I came to the same conclusion on player limits as well but wanted some sort of an idea as to what limitations if any would exist.


The var table is a list of structures.  So the limit on the number of local variables that you can place on an object is just under 4.3 billion.  Lets just say you would run into memory and speed problems before you could exhaust the number of varaiables that you could place on an object.


Is it possible to track items sold to a merchant and keep a running tally of gold amounts for bought and sold items so that at a certain level a player would gain a discount for using that merchant extensively?

 

Yes, you can do it.  The aquire and unaquire events do not fire for stores, So you will need to hook it from the aquire and unaquire events for the PC and compaire the object they got/gave it to vs the Object type or Tag of the store.


I use the nwn db and item db setup currently because I just don't have a ton of time to devote to learning sql atm.

Another option here would be to just use a DB object in the PC's inventory.   Or the NW DB would work just fine.    If you did not use NDBE, like it sounds like you are planning, from the question about local count,  You could just run DataPack.exe on your NWDB every once in awhile to deflate the DB back down.
               
               

               


                     Modifié par Lightfoot8, 07 février 2012 - 09:32 .
                     
                  


            

Legacy_Birdman076

  • Sr. Member
  • ****
  • Posts: 320
  • Karma: +0/-0
Tracking Buying and Selling of Items per merchant
« Reply #4 on: February 08, 2012, 12:04:36 am »


               Thank you very much for the insight Light, I am planning on using either a DB Item or the Bio DB for the time being until I have time enough to dig in and learn SQL.
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Tracking Buying and Selling of Items per merchant
« Reply #5 on: February 08, 2012, 03:25:02 am »


               This is one of those times I would just use a database item on the player since the information needed for the discount would pertain to that particular player anyway. Faster reads and writes and the info stays with the player.