Code: Select all
if boy1_points > max(boy2_points, boy3_points, boy4_points):Sorry if this has been asked before! :/ I've tried the other codes but they just give me
Thank you SO much!
Code: Select all
if boy1_points > max(boy2_points, boy3_points, boy4_points):Code: Select all
python:
boy_points = [boy1_points, boy2_points, boy3_points, boy4_points] ## we put all points in one array to handle them better
max_points = 0 ## the maximal points archived, we will iterate through all, so no problem starting with boy1
max_points_indices = [] ## stores which boys points are the max, although the index is lowered by one due to arrays (contains 0 if boy1 has most points)
for i in range(0, len(boy_points)): ## make the loop relative to number of boys
if boy_points[i] > max_points: ## got new maximal points
max_points = boy_points[i] ## save them
max_points_indices = [i] ## renew the indices array
## up to here, this code does the same as your if statements, but now it get's interesting
if boy_points[i] == max_points: ## another one with the same points
max_points_indices.append(i) ## add him to the indices list as well
## now we got all boys with maximal points in one (indices) array
if len(max_points_indices) == 0: ## this can only happen if every boy has negative points.
pass ## If that can't happen, you cann leave the line above and this one out of your code
if len(max_points_indices) == 1: ## your old situation, only one boy with max points
renpy.jump('boy' + str(max_points_indices[0]+1) + '_ending') ## jump to the right ending
else: ## if multiple boys with max points, build a menu (python style)
boyChoiceSelection = []
for i in range(0,len(max_points_indices)): ## only the ones with max points
boyChoiceSelection.append(("Choose boy " + str(i+1), i+1)) ## add each boy (with menu text)
narrator("Which boy to choose?", interact = False) ## the menu line
choosenBoy = menu(boyChoiceSelection) ## display the menu
renpy.jump('boy' + str(choosenBoy) + '_ending')Code: Select all
else: ## if multiple boys with max points, build a menu (python style 2)
boyChoiceSelection = []
for i in range(0,len(max_points_indices)): ## only the ones with max points
## but with individual texts (of course that could have been in example 1 too with the use of another array)
if max_points_indices[i] == 0: ## boy 1
boyChoiceSelection(("choose sweet Adam", 1))
elif max_points_indices[i] == 1: ## boy 2
boyChoiceSelection(("choose sexy Barney", 2))
elif max_points_indices[i] == 2: ## boy 3
boyChoiceSelection(("choose super Charlie", 3))
elif max_points_indices[i] == 3: ## boy 4
boyChoiceSelection(("choose swag Dan", 4))
narrator("Which boy to choose?", interact = False) ## the menu line
choosenBoy = menu(boyChoiceSelection) ## display the menu
renpy.jump('boy' + str(choosenBoy) + '_ending')Code: Select all
else: ## if multiple boys with max points, build a menu (ren'py style)
has_max_points = [False, False, False, False] ## flags
for i in range(0,len(max_points_indices)): ## only the ones with max points
has_max_points[max_points_indices[i]] = True
## now we are out of python
menu:
"Which boy to choose?" ## menu line
"choose sweet Adam" if has_max_points[0]:
jump boy1_ending ## or jump adam_ending, however you named it (in this example only)
"choose sexy Barney" if has_max_points[1]:
jump boy2_ending
"choose super Charlie" if has_max_points[2]:
jump boy3_ending
"choose swag Dan" if has_max_points[3]:
jump boy4_ending
Users browsing this forum: Google [Bot], _ticlock_