From ba0024f2514a2f3229c717ff0fe13b1fe5622ea9 Mon Sep 17 00:00:00 2001 From: Iggy Date: Sun, 18 Aug 2024 21:06:13 -0300 Subject: [PATCH] Modify storyline to extend the chapters array once the common chapters are finished --- game/storyline.rpy | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/game/storyline.rpy b/game/storyline.rpy index 0b2e4b5..b72c40f 100644 --- a/game/storyline.rpy +++ b/game/storyline.rpy @@ -27,6 +27,8 @@ default ending_route_number = None default current_ending_chapter = None default ending_chapter_index = 0 +default is_end_reached = False + init -1 python: def ending_image(): @@ -47,23 +49,37 @@ init python: global chapter_index global current_general_chapter global ending_route_number + global is_end_reached - if is_end_of_chapters(): + if not is_end_reached and is_end_of_chapters(): ending_route_number = get_ending() - reset_debug_scores() - next_ending_chapter() - # return - - chapter_index += 1 - current_general_chapter = general_chapters[chapter_index] - - renpy.call(current_general_chapter) - + add_ending_chapters() + is_end_reached = True + + if chapter_index < chapters_array_length: + chapter_index += 1 + current_general_chapter = general_chapters[chapter_index] + renpy.call(current_general_chapter) + else: + ending_image() + renpy.call("lending") + def is_end_of_chapters(): return chapter_index >= chapters_array_length + def add_ending_chapters(): + global general_chapters + global chapters_array_length + + if ending_route_number in ending_routes: + general_chapters.extend(ending_routes[ending_route_number]) + chapters_array_length = len(general_chapters) - 1 + # renpy.block_rollback() BLOQUEAR O CAMBIARLO A TUPLE + general_chapters = tuple(general_chapters) + + def next_ending_chapter(): global ending_route_number global ending_chapter_index @@ -88,8 +104,3 @@ init python: else: return - - def reset_debug_scores(): - if config.developer and persistent.enable_debug_scores: - debug_story_variables(False) - debug_story_variables(True, True)