That's a rather poorly written script, as it will loop through all of the items in the chest two times per use, which could cause some issues if it's ran frequently by multiple PCs, definitely...
I might suggest on first use run the inventory count of oChest, set the total count in a variable on the module, telling the counting function that it's been stored, so it doesn't have to loop again, it just pulls the variable from the module (at run time)...
Anyway, glad to see you are happy with the script, even though it's a 50/50 shot on one pull and a 2/3 shot on the other pull, seems like it's not really going to load much very often... The junk pull should be 2/3 and the other pull should be catered to a specific %, e.g. 20% chance etc...
Also, it's a single shot chest, it will only ever spawn treasure one time, which is bad, so it should check two things, how long ago it was opened and who opened it, that way it reload the chest to a new user every X minutes apart, though a user may only spawn the treasure one time / module restart...
Anyway, if you are looking for a system with far more customization, then you can check out my 1.69 treasure system in the link below...
nwvault.ign.com/View.php
Modifié par _Guile, 12 juin 2013 - 05:18 .