So I was trying to investigate a way to use this plugin to increase the supply of default items already supplied by the vendor (Outpost Resource Vendor).
I added a water jug for sale for 100 scrap, just as a means to add the vendor to the config file for editing. Reloaded plugin. I then removed the water jug and cost, saved, and again reloaded plugin.
Now the default items for sale are greatly increasing their stock to what seems like no end.
Modified Vendors greatly increasing supply on its ownFixed
More testing: Cleared vendor to default. reloaded plugin. Values normal. I then clicked "edit" on the vendor, but changed nothing and hit save. In-Stock values seem to be increasing without stopping.
edit: Tested on a different vendor. Clicked edit, changed nothing, hit save. In-stock values continue to rise beyond default values.
Thanks for reporting! I just released v2.0.1 which fixes the issue.
This bug existed because of a single line of code which caused the plugin to miscount the number of items already in the vending machine. I had originally tested the max stock was working correctly after copying the vanilla logic, but I introduced a bug later on when implementing custom count logic in order to improve blueprint handling since vanilla logic was counting multiple blueprints as the same item.
Dude you rock! Thank you!
Merged post
I noticed another thread you mentioned a work around for changing the restock timing. Is that something that has been implemented or is it still subject to change?
RockefellerI noticed another thread you mentioned a work around for changing the restock timing. Is that something that has been implemented or is it still subject to change?
Officially it's still subject to change, but it will likely continue to be available indefinitely. What's stopping me from implementing a "proper" solution is lack of clarity on what that would be, due to lack of clarity on the exact problems people are trying to solve. When someone says "Can I change restock timers", they are essentially saying that they have an undefined problem, and that they want to solve it by changing restock timers. It would be very unwise for me to simply implement a suggested solution without understanding what the problem is first, because it might create other problems and lead to wasted development/maintenance time.
You can help me move forward by articulating (in the other thread) what problem you think are solving by altering restock timers, which items you would like to do it for, and why changing restock timers would solve that problem on your particular server configuration.
Right on man! Ill pick it up on the other thread.
Merged post
Following up on this:
Some of my edited vendors "in stock" values are skyrocketing again.
Specifically the Fishing Villages vendor that i edited and reset just for testing purposes.
And the "Scrap for Sale" vendor at Bandit, which I had to edit the prices maunally after they bugged out, in stock values are sky rocketing.
Thanks for the update. I will attempt to reproduce.
Thanks man!
I checked it out and I think what you are seeing is vanilla behavior. Can you provide a screenshot of the map view of those vending machines with and without customization? Below is what I am able to see.
"Scrap 4 Sale" vanilla:
- 1 Scrap | 6 Crude Oil (1400 left)
- 1 Scrap | 20 Metal Fragments (1400 left)
- 2 Scrap | 1 High Quality Metal (700 left)
- 1 Scrap | 1 Anti-Radiation Pills (1400 left)
- 15 Scrap | 1 Green Keycard (93 left)
- 40 Scrap | 1 Blue Keycard (35 left)
- 80 Scrap | 1 Red Keycard (17 left)
"Scrap 4 Sale" edited:
- 1 Scrap | 6 Crude Oil (835 left)
- 1 Scrap | 20 Metal Fragments (835 left)
- 2 Scrap | 1 High Quality Metal (417 left)
- 1 Scrap | 1 Anti-Radiation Pills (835 left)
- 15 Scrap | 1 Green Keycard (55 left)
- 40 Scrap | 1 Blue Keycard (20 left)
- 80 Scrap | 1 Red Keycard (10 left)
Why are the "X left" amounts so high? The refill logic that both vanilla and the plugin use causes the vending machine inventory to fill until there are at least 10 purchases of every sale order. Since one of the sale orders is for 80 scrap, the vending machine will fill to at least 800 scrap before stopping. Since the vending machine has 835 scrap, it follows naturally that you can buy 1 scrap 835 times.
Why does vanilla start with more than 10 purchases? There appears to be a "bug" in vanilla where it will initially stock 10 of every order, without incrementally checking if there's already enough items. The total scrap of all sale orders is 140, which multiplied by 10 is of course 1400. Even though vanilla initially stocks 1400, it will only refill to a number in the 800s, same as the plugin will.
Why does the vending machine not always refill to the same amount? You may have noticed this. The amount of scrap the vending machine stops at is not always the same. The reason for this is that the logic tries to refill 1 purchase for every single sale order before stopping and checking the amounts. When starting from 0 scrap, this logic results in the sequence: 140, 275, 395, 515, 595, 675, 755, 835. Notice how in the last few items of the sequence, it only fills by 80 since the rest of the sale orders have already reached their max. The jump from 395 -> 515 is 120 because both the 40 and 80 were stocked.
The above issues only manifest for vending machines that sell the same item multiple times.
Yea I think youre right. I just verified against two other servers I play on and saw similar "in stock" values. So I guess thats a non issue. /facepalm sorry.
I guess my main issue is certain vendors "for sale" amounts and "price" are bugging out. I think its worth noting these are vendors I never orignally edited in the first place, only edited them after the fact to correct the values.
For example F1 grenades are supposed to be (1) for 8 scrap, but it will change to (5) for 8 scrap.
Drop boxes are supposed to be (1) for 40 scrap, but changes to (5) for 40 scrap.
The car parts vendor is bandit does similar things, instead of 1 car part for sale they will be random numbers.
Bandits "Scrap 4 Sale" was trading everything for 1 scrap, including the colored cards.
I think there was one or two more but Im too tired to think =D
I'm going to mark this thread as solved again since the overstock issue appears to be fixed. Let's continue discussing the other issue in the other thread.