Community Forum

Issues with store scripting

Forum Overview >> Scripting

Created24.03.2021 18:02

54reddog 24.03.2021 18:02

I'm beginning to play about with an idea I have had for multiple shops instead of the current, "buy everything at one place" type situation we currently have. I was contemplating supressing the entire in game GUI for stores, and building my own but thought there might be a cleverer way of doing it, cloning the store items, clearing them, then only adding in the ones I wanted when the player is at a specific location. I've started playing about with this, but the following code isn't even successfully removing the items from the store.

for _, item in pairs(g_storeManager:getItems()) do
self:printDebug(" removed")

The log file is showing that the iteration through the table is occurring and the items are being "removed". However they're still very much visible in the game.

Is this because I'm modifying while iterating (terrible I know, I'm just playing about) or because the method removeItemByIndex doesn't actually work at all?

Bilbo Beutlin (BBeutlin) 26.03.2021 13:22
The game has several table copies of the store vehicles in other places.

54reddog 26.03.2021 15:03

So the tidy shop mod seems to be ok modifying the g_storeManager, which begs the question why this doesn't. I can't understand why there would be multiple store managers running, it doesn't make much sense to have that information duplicated.

Would you happen to know where these copies are located and how they're referred to?

Note: Log in to post. Create a new account here.