Add setup_ending. Endings are now determined and setup the moment branching is required.

This commit is contained in:
Map 2024-10-02 07:27:34 -05:00
parent 3059d469f2
commit c3e365d01c
3 changed files with 26 additions and 21 deletions

View file

@ -447,10 +447,11 @@ label chapter_11:
#Naser Drama #Naser Drama
#THIS SECTION IS SCORE DEPENDENT #THIS SECTION IS SCORE DEPENDENT
# Determine ending and set up ending chapters
$ setup_ending(get_ending())
# Doomer ending skips this segment # Doomer ending skips this segment
$ ending_score = get_ending() if ending_route_number == 2:
if ending_score == 2:
stop music fadeout 3 stop music fadeout 3
pause 2 pause 2
jump lPromAnnouncement jump lPromAnnouncement
@ -586,9 +587,9 @@ label chapter_11:
Nas "Dont take it the wrong way, but my mind just screamed at me worst case scenario." Nas "Dont take it the wrong way, but my mind just screamed at me worst case scenario."
pause .5 pause .5
if ending_score == 4: # Golden if ending_route_number == 4: # Golden
jump lSortingThings jump lSortingThings
elif ending_score == 3: # tradwife elif ending_route_number == 3: # tradwife
jump lMendingThings jump lMendingThings
else: else:
jump lBreakingThings # All else fails, go to shooter. jump lBreakingThings # All else fails, go to shooter.
@ -5212,7 +5213,7 @@ label chapter_11:
pause .5 pause .5
if ending_score == 3: # tradwife if ending_route_number == 3: # tradwife
"Things are going pretty well. When we discount Trishs weekly attempt to talk with Fang." "Things are going pretty well. When we discount Trishs weekly attempt to talk with Fang."
@ -5467,7 +5468,7 @@ label chapter_11:
"{cps=*.1}...{/cps}" "{cps=*.1}...{/cps}"
# skip this segment if we're doing ending 1 # skip this segment if we're doing ending 1
if ending_score == 1: #shooter if ending_route_number == 1: #shooter
$ next_story_chapter() $ next_story_chapter()
# the following segment makes sense in the context of 11B+11C+11D # the following segment makes sense in the context of 11B+11C+11D

View file

@ -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 default current_chapter = chapter_list[chapter_list_index] # Store the name of the label as a string
# What ending we're on # 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 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

View file

@ -13,25 +13,17 @@ init -1 python:
init python: init python:
def next_story_chapter(): 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: if chapter_list_index < chapter_list_length:
chapter_list_index += 1 chapter_list_index += 1
current_chapter = chapter_list[chapter_list_index] current_chapter = chapter_list[chapter_list_index]
renpy.call(current_chapter) 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 # We're at an ending
else: else:
ending_image() ending_image()
@ -40,3 +32,14 @@ init python:
renpy.quit() renpy.quit()
else: else:
renpy.call("lending") 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