diff --git a/game/script/11.school-assignment-and-route-lock.rpy b/game/script/11.school-assignment-and-route-lock.rpy index 2b47b73..332ca50 100644 --- a/game/script/11.school-assignment-and-route-lock.rpy +++ b/game/script/11.school-assignment-and-route-lock.rpy @@ -447,10 +447,11 @@ label chapter_11: #Naser Drama #THIS SECTION IS SCORE DEPENDENT + # Determine ending and set up ending chapters + $ setup_ending(get_ending()) + # Doomer ending skips this segment - $ ending_score = get_ending() - - if ending_score == 2: + if ending_route_number == 2: stop music fadeout 3 pause 2 jump lPromAnnouncement @@ -586,9 +587,9 @@ label chapter_11: Nas "Don’t take it the wrong way, but my mind just screamed at me ‘worst case scenario’." pause .5 - if ending_score == 4: # Golden + if ending_route_number == 4: # Golden jump lSortingThings - elif ending_score == 3: # tradwife + elif ending_route_number == 3: # tradwife jump lMendingThings else: jump lBreakingThings # All else fails, go to shooter. @@ -5212,7 +5213,7 @@ label chapter_11: pause .5 - if ending_score == 3: # tradwife + if ending_route_number == 3: # tradwife "Things are going pretty well. When we discount Trish’s weekly attempt to talk with Fang." @@ -5467,7 +5468,7 @@ label chapter_11: "{cps=*.1}...{/cps}" # skip this segment if we're doing ending 1 - if ending_score == 1: #shooter + if ending_route_number == 1: #shooter $ next_story_chapter() # the following segment makes sense in the context of 11B+11C+11D diff --git a/game/src/chapter_variables.rpy b/game/src/chapter_variables.rpy index 4ad5ca8..cc91231 100644 --- a/game/src/chapter_variables.rpy +++ b/game/src/chapter_variables.rpy @@ -24,4 +24,5 @@ default chapter_list_index = 0 # Index number for the current position of the ch default current_chapter = chapter_list[chapter_list_index] # Store the name of the label as a string # What ending we're on -default ending_route_number = None # A value of None signals to get_ending() to determine the value based off anon/fang scores when it is called \ No newline at end of file +default ending_route_number = None # A value of None signals to get_ending() to determine the value based off anon/fang scores when it is called +default ending_chapters_determined = False \ No newline at end of file diff --git a/game/src/storyline.rpy b/game/src/storyline.rpy index 7247c08..7df87c5 100644 --- a/game/src/storyline.rpy +++ b/game/src/storyline.rpy @@ -13,25 +13,17 @@ init -1 python: init python: def next_story_chapter(): - global chapter_list_index, current_chapter, chapter_list, ending_route_number, is_end_reached, chapter_list_length + global chapter_list_index, current_chapter, chapter_list, ending_route_number, chapter_list_length, ending_chapters_determined - # Add check "is_end_reached" to have this if statement be executed only once when finishing the general chapters - if not is_end_reached and chapter_list_index >= chapter_list_length: - # Add ending chapters - ending_route_number = get_ending() - if route_number in ending_routes: - chapter_list.extend(ending_routes[ending_route_number]) - - # Updates variables for newly extended 'chapter_list' with ending chapters - chapter_list_length = len(chapter_list) - 1 # chapter_list_length is updated to reflect the addition to the chapter_list array - is_end_reached = True - - if chapter_list_index < chapter_list_length: chapter_list_index += 1 current_chapter = chapter_list[chapter_list_index] renpy.call(current_chapter) + # Safeguard if setup_ending wasn't called somehow + elif not ending_chapters_determined: + setup_ending(get_ending()) + # We're at an ending else: ending_image() @@ -40,3 +32,14 @@ init python: renpy.quit() else: renpy.call("lending") + + def setup_ending(ending): + global ending_route_number, chapter_list, chapter_list_length, ending_chapters_determined + + ending_route_number = ending + + # Add ending chapters + chapter_list.extend(ending_routes[ending_route_number]) + chapter_list_length = len(chapter_list) - 1 # chapter_list_length is updated to reflect the addition to the chapter_list array + + ending_chapters_determined = True \ No newline at end of file