The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NPC Restock
Author Message
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #4
RE: NPC Restock
When restocking all vendor containers are emptied, default ones will be generated again by the system but custom ones will be lost.

// Restock occurs every 10 minutes of inactivity (unless region tag specifies different time)
So, to avoid this you can set region.tag.NoRestock=1.

However this will make npcs to no restock their items and they will eventually lose them ... so you'll have to manually 'regenerate' these items.

Best idea I can give you is to store the amount of each item in a tag after NPCRestock, something like this:

Code:
[function f_stock_tags_set]
ref1=<uid>
forcont layer_stock
ref1.tag.<baseid>=<amount> // a tag with the id of the item will be created with it's amount, ie 'tag.i_deed_vendor=18'.
endfor

So you will be able to periodically call in that region a custom restock at the time you want.

Code:
[function f_stock_regenerate]
if !(<brain>) // no call on players.
return 0
endif
ref1=<uid>
forcont layer_stock
if (<ref1.tag0.<baseid>>) //if we have a tag for this item
  amount = <ref1.tag.<baseid>> // we set the item to the amount stored in the tag
endif
endfor

So now you have a region not restocking the vendors inside and a function to store how much items of each one the vendor will have and another setting it back, you only need something timing from time to time calling region.allchars.f_stock_regenerate and you should have your problem solved.
07-20-2015 05:46 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes XuN's post
Post Reply 


Messages In This Thread
NPC Restock - escribano - 07-19-2015, 12:51 PM
RE: NPC Restock - azmanomer - 07-19-2015, 04:19 PM
RE: NPC Restock - Paulo_BR - 07-20-2015, 03:59 AM
RE: NPC Restock - XuN - 07-20-2015 05:46 PM
RE: NPC Restock - escribano - 07-21-2015, 08:01 AM
RE: NPC Restock - escribano - 07-21-2015, 09:29 AM
RE: NPC Restock - XuN - 07-22-2015, 06:14 PM
RE: NPC Restock - escribano - 07-23-2015, 12:55 AM
RE: NPC Restock - XuN - 07-24-2015, 06:47 PM
RE: NPC Restock - escribano - 07-25-2015, 04:27 PM
RE: NPC Restock - XuN - 07-27-2015, 07:40 AM
RE: NPC Restock - escribano - 07-27-2015, 12:43 PM
RE: NPC Restock - escribano - 08-01-2015, 02:36 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)