Page 1 of 1

Automatic refilling of containers.

Posted: Wed Jul 14, 2004 6:09 pm
by jarkari
I'm wondering if someone could give me an idea of how to make chests/flowers/trees etc, automatically refill, just like Avlis does, with their wheat/appletrees etc. Any help would be great.

Thank you.

Posted: Wed Jul 14, 2004 6:28 pm
by dougnoel
Are you trying to just refill the placeable immediately after something is "picked", or are you trying to implement a time-delay?

Posted: Wed Jul 14, 2004 8:19 pm
by jarkari
I'd like to do a time delay. I was thinking I could make a table mysql database side, if someone removed something from the container, I could put a row into said table, with a timestamp. Then everytime someone opens the container I could check that timestamp to see if enough time had gone buy and I should restock the item. Kind of complicated and I was hoping there was an easier way.

Thanks.

Posted: Thu Jul 15, 2004 6:30 am
by Alustriel
A simple solution without using the database and interfering current database generating scripts is the use of local integers, setting and delay deleting them.

For standard containers, like bioware barrels, chests etc, just add this line before the ShoutDisturbed line in the onopen script (e.g. nw_o2_classlow), for other treasure generating object probably something silmilar will do the trick:

DelayCommand(500.0, DeleteLocalInt(OBJECT_SELF, "NW_DO_ONCE"));

This will remove the local integer on the chest after 500 seconds and the chest will generate loot again once it is opened again.