Author Topic: Persistent donation chest?  (Read 474 times)

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Persistent donation chest?
« Reply #15 on: July 29, 2011, 01:47:51 pm »


               Why not use a store instead?

I integrated a nwnx_odbc StorePersistentObject   with a Store system, so that anything bought, is removed from the database, and anything sold to the store, goes into the database.

To free up memory on the module, the items are destroyed from the store when the store conversation closes, and then re-created when the store opens.

If I remember correctly, Stores have aLOT of space, so would not suffer from the lack of inventory space issue.

All you need to do, is make sure that the person donating, doesnt get a monetary reward for the item he 'gives' to the store.

Im guessing that this could be done via

Placeable chest , on the close event, this chest takes its belongings, and then transfers them into the store, and then when finished, destroy the items in the chest, upload the ones in the store, and then destroy the local copy of the ones in the store.

This means, you are limited to uploading in a single batch, the maximum capacity of a single placeable object.
               
               

               
            

Legacy_zunath

  • Full Member
  • ***
  • Posts: 152
  • Karma: +0/-0
Persistent donation chest?
« Reply #16 on: July 29, 2011, 05:40:20 pm »


               

Melkior_King wrote...

One note of warning about persistent chests in general:

All of the persistent chests which I have seen use a hidden NPC to hold the items to be saved.

A NPC has a limited amount of inventory space.  Far less than that available to a placeable object.

Therefore, if more items keep on being added to the chest than are removed from the chest, the NPC will sooner or later drop some items due to not having the inventory space.

The result will be items vanishing from the chest.

This may not be especially noticable if the chest is public, but it will happen.

I'm thinking of a way around this problem but until and unless I can come up with a workable solution:
*You Have Been Warned*


The system I  posted does not use an NPC. The item objects themselves are stored into their own field which explains the cap of 100 items.

Baaleos wrote...

Why not use a store instead?

I integrated a nwnx_odbc
StorePersistentObject   with a Store system, so that anything bought, is
removed from the database, and anything sold to the store, goes into
the database.

To free up memory on the module, the items are
destroyed from the store when the store conversation closes, and then
re-created when the store opens.

If I remember correctly, Stores have aLOT of space, so would not suffer from the lack of inventory space issue.

All you need to do, is make sure that the person donating, doesnt get a monetary reward for the item he 'gives' to the store.

Im guessing that this could be done via

Placeable
chest , on the close event, this chest takes its belongings, and then
transfers them into the store, and then when finished, destroy the items
in the chest, upload the ones in the store, and then destroy the local
copy of the ones in the store.

This means, you are limited to uploading in a single batch, the maximum capacity of a single placeable object.


The store idea is an interesting one. However, I  strongly advise NOT to update it OnClose. If you do this and the server crashes, goes down, or whatever all changes will be lost. This is why I recommend updating it OnDisturb instead. If you've got a lot of items in there though, this could end up being laggy for you.

You're also doing more work by creating the store object, copying the items to it, and then storing the store into the database. You can avoid all this by simply adding/removing the items when they're added/removed from the chest. Must simpler approach. '<img'>
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
Persistent donation chest?
« Reply #17 on: August 07, 2011, 07:08:36 pm »


               Here is my example on the vault of persistant: Merchants(traveling/stationary), chests, Guild Chests
current versions useing nwndb, later versions will include nwnxdb.
http://nwvault.ign.c....Detail&id=3823

If you have any questions please ask and if you need something customized please ask.