Aller au contenu

Photo

Persistent donation chest?


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

#1
Alassirana

Alassirana
  • Members
  • 55 messages
I'm running a server with nwnx (or at least developing the server), and would like a script that would work for creating a donation chest, which would keep anything in it over a server reset.  Could anyone help me script such a thing?  This is designed to allow higher level characters donate gear they don't want to less well equipped players, and wouldn't penalize a low level character for logging in right after reset.  Thanks in advance for the help (and if it helps at all, the version of nwnx2 I'm using is for the mysql database).

Alassirana

#2
Xardex

Xardex
  • Members
  • 217 messages
Nwnx is not required for this. There should be numerous scripts at nwvault that can do this.

#3
Alassirana

Alassirana
  • Members
  • 55 messages
I tried looking on the vault, but what they had were banking scripts, and I want something separate from my bank...(this is something anyone can access, whereas the bank vaults are keyed to one character). \\

#4
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

Alassirana wrote...

I tried looking on the vault, but what they had were banking scripts, and I want something separate from my bank...(this is something anyone can access, whereas the bank vaults are keyed to one character).



What system are you using for your bank and does it allow the storage of items? 

If you already have a system like that in place, it would be better to modify that system to handle your donation chest.   That way you do not have two systems just one to handle both cases.  

#5
Alassirana

Alassirana
  • Members
  • 55 messages
I'm using the Kitrell's banking system, which does allow storage for items.

#6
Alassirana

Alassirana
  • Members
  • 55 messages
I'll admit, that while I can merge scripts fairly well (managed to get the banking system, crp, and shayan's subraces all to work nicely together), I don't have the experience to figure out how to have a persistent chest on my own...if I have something I can copy/modify slightly, I can usually figure out how to get it working..

#7
ffbj

ffbj
  • Members
  • 593 messages
Well could'nt you just use the current ones and remove the lines that refer to the specific CD key or however they are identified. Maybe not too helpful, just thinking out loud.  Then make it so the PC must be below a certain level and then has only a bit of time, per server reset, to loot the chest.  So they can take a few things, not all of them. 

Modifié par ffbj, 25 juillet 2011 - 10:14 .


#8
Alassirana

Alassirana
  • Members
  • 55 messages
*hrms* I'll look into that...it may take me a bit, as I'm getting ready for an online pen and paper style game, but I'll see what can be done on it.

#9
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
There are about 5 versions of that system on the vault. Do you know the one you are using?

#10
zunath

zunath
  • Members
  • 83 messages
I'm going to make you a package of the item storage system I developed. Just hang tight.

#11
Alassirana

Alassirana
  • Members
  • 55 messages
Thanks, Zunath, and Lightfoot, the system is apparently version 1.7

#12
zunath

zunath
  • Members
  • 83 messages
Download

Some basic instructions are included there. You may have trouble getting the table in your database. If you do let me know and I'll walk you through it.

Hope it helps!

Modifié par zunath, 26 juillet 2011 - 01:11 .


#13
Alassirana

Alassirana
  • Members
  • 55 messages
got it up and running, and it's doing exactly what I wanted. Thank you so much.

#14
zunath

zunath
  • Members
  • 83 messages
No problem. Glad to help! :D

#15
Melkior_King

Melkior_King
  • Members
  • 135 messages
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*

#16
Baaleos

Baaleos
  • Members
  • 1 330 messages
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.

#17
zunath

zunath
  • Members
  • 83 messages

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. :)

#18
Greyfort

Greyfort
  • Members
  • 234 messages
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.