Save data issue for Aardwolf

Posted by Trepid on Fri 24 Apr 2015 02:26 AM — 4 posts, 18,395 views.

#0
I apologize for the long post, but it is somewhat of a complicated issue for me. I am building an area in Aardwolf, and within my area I am trying to get a game called "bones" work properly. Here is the information on the game:

There are 10 chests, and each chest has a different starting amount of prize gold in it :

chest # Starting amount

chest 1 10,000
chest 2 25,000
chest 3 50,000
chest 4 100,000
chest 5 250,000
chest 6 500,000
chest 7 1,000,000
chest 8 2,500,000
Chest 9 5,000,000
Chest 10 10,000,000

Your gold buy-in is 1,000,000, and you can only play once a day.

Your gold is dispersed across the chests

chest 1 (2%) 10,000 + 20,000 = 30,000
chest 2 (4%) 25,000 + 40,000 = 65,000
chest 3 (6%) 50,000 + 60,000 = 110,000
chest 4 (8%) 100,000 + 80,000 = 180,000
chest 5 (8%) 250,000 + 80,000 = 330,000
chest 6 (10%) 500,000 + 100,000 = 600,000
chest 7 (12%) 1,000,000 + 120,000 = 1,120,000
chest 8 (14%) 2,500,000 + 140,000 = 3,640,000
chest 9 (16%) 5,000,000 + 160,000 = 5,160,000
chest 10 (20%) 10,000,000 + 200,000 = 10,200,000

How the game works:

After you buy-in and your money is dispersed into the chests, you are given a bone by the mob to throw on a large stone in the room. As you throw the bone on the stone, it shatters into a large amount of pieces. The mob counts the number of pieces, and the number of shattered pieces equals your score. 1-10 pieces would mean chest 1, 11-20 pieces chest 2, and the same all the way up to chest 10.

Your chances for winning the chests would be the reverse percentages as your buy-in money disbursement:

chest 1 (20% chance to win) 30,000
chest 2 (16% chance to win) 65,000
chest 3 (14% chance to win) 110,000
chest 4 (12% chance to win) 180,000
chest 5 (10% chance to win) 330,000
chest 6 (8% chance to win) 600,000
chest 7 (8% chance to win) 1,120,000
chest 8 (6% chance to win) 3,640,000
chest 9 (4% chance to win) 5,160,000
chest 10 (2% chance to win) 10,200,000

If no winners hit the prize money for that chest, the total would stay in that chest for the next game. The chest that the winner takes from starts the prize money for that chest over. For example, if you won chest 9 , you would win that money, and chest 9 would start over at 5 million for next game. If no one won the 1,140,000 in chest 8 that prize money would stay. The gold amounts would stay until either someone wins it.

So somehow I need to come up with a way to savedata on the amount of gold in each chest. I assume the only way to do this is with a table? I am having a hard time understanding how I would write this into script.

Is there another way to save data other than with a table?
USA #1
First, you're going to need a LOT of data carryover and may need to modify the copyover process if you want a fully persistent value on the chests between games/days. You're also going to need to track which characters have played somehow, be it a new char variable (safer for copyover) or a tracking token created by the mob running the game.

That said, I'd start your testing with a single chest to get the bugs worked out and come back with code as you progress and run into issues. Also, my personal advice would be to simply bleed off any gold that went to chests that aren't winners every game rather than trying to retain the increases until someone wins.
#2
a
Amended on Fri 24 Apr 2015 11:18 PM by Trepid
USA Global Moderator #3
I think asking on the Aardwolf build/test port makes more sense than asking here.