I'm trying to create an active system that will select an event from a list, particularly for a hunting system, but I will also use it for other aspect in my game.
What I mean by active is that I would like for the possible event, and their probability, to vary based on some variable like who is following you, what is your distance from the closing city, how much food you have on you, etc.
The kind of event also varies greatly, going from being attacked by wolf to finding a branch. It will also vary based on the season. For now, I have a basic code, but I'm not satisfied for two reason: first, I can't choose if a give option is possible or not, and two, I can't dynamically change the probability.
Btw, a day is composed of ten action, and cs is referring to the currant season, namely winter for now. Also, sorry for the strange define, but my script is over 500 lines long, and I only have one character yet, so I don't want to lose the event.
Code: Select all
label hunting:
define winterhunt=[None,"wwolfs","wwolf",None,"wwolf","wdear","wfox","whorse",None,"wbranch","wrock","wrock","wdear"]
$act=10
if cs==0:
while act>0:
$evt=renpy.random.choice(winterhunt)
if evt!=None:
call expression evt
else:
"you spent a bit of time looking around, but found nothing."
$act=act-1
nvl clear
returnI could I guess redefine the list each time, but that doesn't solve the problem of probability associated with each possibility.
I tried to search on the forum for previous answer, but I couldn't seem to be able to do so.