This is bad ass!
I just wrote this chunk of code that works a lot like Fallout New Vegas, in that every dialogue choice you make checks from a list of conditions and will let you choose special dialogue options if one of those conditions are met.
Is your corruption high enough, what are you dressed in, what inventory items do you have, does the other character like you enough, how high is your sneak, did you do that quest before? If you condition is met, you can choose the extra dialogue option. If not, it will be greyed out and tell you you can't choose it. If you're not a programmer this will look like another language to you but trust me, it's REALLY cool. I'll need to put some more work into it to make sure it all works smoothly... Haven't tested yet. But I wrote the code so, that's done.
# systems/system_dialogue_choices.rpy
init python: # Global threshold value for unlocking choices that require a certain corruption level. CORRUPTION_THRESHOLD_DEFAULT = 50
# Helper function to check if a choice's conditions are met. # The conditions parameter is a dictionary that may contain one or more of the following keys: # "corruption": numeric threshold for global corruption (game_state["corruption"]["value"]) # "affinity": a dict with {"character": <name>, "value": <threshold>} to check game_state["affinity"][name]["value"] # "sneak": numeric threshold for sneak (game_state["sneak"]["value"]) # "outfit": a string representing the required outfit for Annika (checked via get_annika_outfit_key()) # "inventory": a string or list of strings required to be in game_state["inventory"] # "flag": a dict with {"flag": <flag_name>, "value": <expected_value>} to check game_state["flags"][flag_name] # # Returns True if all specified conditions are met, otherwise False. def are_conditions_met(conditions): # If no conditions provided, the choice is unlocked by default. if not conditions: return True
# Check global corruption. if "corruption" in conditions: if game_state["corruption"]["value"] < conditions["corruption"]: return False
# Check character affinity. if "affinity" in conditions: cond = conditions["affinity"] # Ensure the character exists in game_state["affinity"]. if cond["character"] not in game_state["affinity"]: return False if game_state["affinity"][cond["character"]]["value"] < cond["value"]: return False
# Check sneak stat. if "sneak" in conditions: if game_state["sneak"]["value"] < conditions["sneak"]: return False
# Check outfit condition (for Annika) using your unified outfit system. if "outfit" in conditions: # get_annika_outfit_key() returns the current outfit key. # Compare it to the required outfit specified in the condition. from renpy import store if store.get_annika_outfit_key() != conditions["outfit"]: return False
# Check inventory condition. if "inventory" in conditions: required = conditions["inventory"] # If a single item (string), check if it's in the inventory. if isinstance(required, str): if required not in game_state["inventory"]: return False # If a list of items, ensure all are present. elif isinstance(required, list): for item in required: if item not in game_state["inventory"]: return False
# Check flag condition. if "flag" in conditions: cond = conditions["flag"] # Check if the flag exists and has the expected value. if game_state["flags"].get(cond["flag"], None) != cond["value"]: return False
# All conditions met. return True
# Define a custom style for disabled dialogue choices.style disabled_choice: color "#FF0000" # Red text to indicate the choice is locked. insensitive True # Makes the button non-interactive. hover_color "#FFAAAA" # Optional: lighter red on hover.
