• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Storing all of an objects variables for later use? Studio 1.4

Joe

Member
You'll have to excuse me as best you can. It's been a long time (like old forums, long time). Anyway....

I'll explain the situation (best I can). I have a vendor screen that pops up from an NPC menu, with 8 different objects. These objects each have tons of randomized variables, that when the player "purchases" affect the player in all different kinds of ways (think of stats and item modifiers type deal). The problem is the player can simply cycle through creating new objects (like a reroll) until he/she finally gets the object with the desired variables (or stats).

Basically, store a bunch of variables from 8 objects, recall them if a timer isn't up.

What would be the best way to go about doing this? (i'll elaborate more if needed).

Thanks
 

Yal

šŸ§ *penguin noises*
GMC Elder
A lot of games (Dead Cells, World of Horror, Binding of Isaac, Mana Spark) force you to pay a cost of some sort to reroll shop items, so you can't reroll forever. It can be either money (DC, BoI and MS) which is easy enough to refill, or something that you only ever have a finite supply of (in WoH restocking the shop takes a chunk of the time limit before the world is destroyed). You could even have the cost increase exponentially (e.g. doubling) each time you pick the reroll option, allowing it to start affordable but quickly becoming insurmountable if the player tries to cheese their way to the best RNG.
 

Kiyl

Member
You could make those objects persistent and hide them when the player is not in the shop. I agree with Nidoking, an array or data structure would be a better way to store that information. Then have it inside a persistent object called objShopInventory. The timer could be done using current_time. When the items are first created do timeItemsCreated = current_time. Then to create new items you can check
GML:
if (current_time > timeItemsCreated + timeItemLength)
    //Get new shop items
 

TheouAegis

Member
I just had an idea: Instead of saving all the item stats, just save the seeds used to create them. When the player opens the shop module, reload the saved seed and generate the shop again.
 
Top