From 297ca81c7cf0191ed77149ef227878f4a3f4f0d8 Mon Sep 17 00:00:00 2001 From: Iggy Date: Thu, 8 Aug 2024 19:19:48 -0300 Subject: [PATCH] - Add array containing general chapters labels - Add dictionary for endings - Add chapter transition functions --- game/storyline.rpy | 66 ++++++++++++++++++++++++++++++++++++++++++++++ game/utility.rpy | 12 +++++++++ 2 files changed, 78 insertions(+) diff --git a/game/storyline.rpy b/game/storyline.rpy index e5139a7..b1cc307 100644 --- a/game/storyline.rpy +++ b/game/storyline.rpy @@ -1,3 +1,31 @@ +default persistent.old_endings = None +default persistent.endings = None + +# Store the general chapters inside an array for easy manipulation +define general_chapters = [ + "chapter_1", "chapter_2", "chapter_3", "chapter_4", "chapter_5", + "chapter_6", "chapter_7", "chapter_8", "chapter_9", "chapter_10", "chapter_11" +] + +define ending_routes = { + 4: ["chapter_11D", "chapter_12D", "chapter_12_5D", "chapter_13D", "chapter_14D"], + 3: ["chapter_11C", "chapter_12C", "chapter_12_5C", "chapter_13C", "chapter_14C"], + 2: ["chapter_11B", "chapter_12B", "chapter_13B", "chapter_14B"], + 1: ["chapter_11A", "chapter_12A", "chapter_12_5D", "chapter_13A", "chapter_14A"] +} + +# Index number for the current position of the general chapters array +define chapter_index = 0 + +# This will store the name of the label as a string +define current_chapter = None + +default chapters_array_length = len(general_chapters) - 1 + +define ending_route_number = None +define ending_chapter_index = 0 + + init -1 python: def ending_image(): #0b0000, DCBA, flash the bits with |=, check with & @@ -10,6 +38,44 @@ init -1 python: persistent.old_endings = persistent.endings persistent.endings = endings + +init python: + + def next_story_chapter(): + global chapter_index + global current_chapter + global ending_route_number + + if is_end_of_chapters(): + ending_route_number = get_ending() + next_ending_chapter() + return + + + def is_end_of_chapters(): + return chapter_index >= chapters_array_length + + + def next_ending_chapter(): + global ending_route_number, ending_chapter_index + + if ending_route_number in ending_routes: + # Save the ending chapters array from + # the ending_routes dictionary + current_ending_list = ending_routes[ending_route_number] + + if ending_chapter_index < len(current_ending_list): + # Stores the label name from the current_ending_list array in the item variable + item = current_ending_list[ending_chapter_index] + # Increases the index and jumps to the label + ending_chapter_index += 1 + renpy.jump(item) + else: + return + else: + return + + label storyline: call chapter_1 from _call_chapter_1 call chapter_2 from _call_chapter_2 diff --git a/game/utility.rpy b/game/utility.rpy index 591f274..ce4bf65 100644 --- a/game/utility.rpy +++ b/game/utility.rpy @@ -20,3 +20,15 @@ label get_ending: return(2) # Doomer else: return(1) # Shooter + + +init python: + def get_ending(): + if anonscore >= 4 and fangscore >= 4 and wingStory: + return 4 # Golden + elif anonscore >= 3 and fangscore <=4: + return 3 # Tradwife + elif anonscore <= 3 and fangscore >=3: + return 2 # Doomer + else: + return 1 # Shooter