I'm working on a "board" game, with randomly generated board, where player has to do the actions that are shown on the cell they land on, and I'd like to add the possibility to choose how often or rare should each type of the cell be present on the board. For example, I have the following "tasks" for the player to do: jump, run, sit, stand. And before the game starts player would choose for each type of the task to be shown: 1) none, 2) rarely, 3) normal or 4) often.
And each cell would be generated with a random task from the weighted list.
I'm not good with coding, so I don't really know how to do it. I've found how to make a weighted random choice here, but I have no idea how to add the possibility for the player to edit the "weight" of each type of cell right from the game.
Right now I have a very simple code for each cell:
$ cell001 = renpy.random.choice(['jump', 'run', 'sit', 'stand'])
and if I want more "jump" tasks compared to the other tasks for example, I just edit the code like this:
$ cell001 = renpy.random.choice(['jump', 'jump', 'jump', 'jump', 'run', 'sit', 'stand'])
And it becomes some kind of a simple weighted choice, jump with weight of 4 and other types with a weight of 1.
And I was thinking, maybe there is a way to make it conditional, so I don't have to use any python code and keep it simple for me.
The player would choose the jump task to appear rarely, normally, often or not shown at all, and for each option there would be following variables:
jump_none = True or False, jump_rare = True or False, jump_normal = True or False, jump_often = True or False., And for example if a player would choose jumps to be shown normally, jump_none, jump_rare and jump_normal would be == True and jump_often would be == False
And if there is a way to make renpy.random.choice conditional it would be perfect, I would add something like this for each cell:
$ cell001 = renpy.random.choice([if jump_none == True then 'jump', if jump_rare == True then 'jump', if jump_normal == True then 'jump', if jump_often == True then 'jump', 'run', 'sit', 'stand'])
so it would add or remove "jump"s to the list of outcomes to choose from making it a "weighted" random choice. But I have no idea if it's even possible to put variables into the random choice code.
I hope it makes at least a little sense. I understand that this might be a very simple task for someone who can code, but I'm not good with this stuff, so I'm trying to improvise a little