Cheat code to enter

For discussion and support of other visual novel engines.
Post Reply
Posts: 5
Joined: Tue Mar 22, 2022 5:09 am
Deviantart: TheXlize

Cheat code to enter

#1 Post by Oceane_Kudo »

Hello everyone,

I've been working on a cheat code system for my Renpy Game and I don't understand why it doesn't work... For some context on what I'd like to achieve: I wanna open a Patreon where you could have access to "Cheat codes". What I programmed is that you enter the Patreon code that gives you 10 cheat points. Then, you can enter cheat codes to add money, add affinity with the characters etc... Here is the code that I used:

Code: Select all

def validate_cheat_code(cheat_code):
        # Define your non-versioned cheat codes here
        valid_cheat_codes = {
            "Megumiplusplus": ("love_megumi", 30, "lust_megumi", 30),
            "Erinaplusplus": ("love_erina", 30, "lust_erina", 30),
            "Ryokoplusplus": ("love_ryoko", 30, "lust_ryoko", 30),
            "Aliceplusplus": ("love_alice", 30, "lust_alice", 30),
            "Neneplusplus": ("love_nene", 30, "lust_nene", 30),
            "Rindoplusplus": ("love_rindo", 30, "lust_rindo", 30),
            "Aratoplusplus": ("love_arato", 30, "lust_arato", 30),
            "Mitoplusplus": ("love_mito", 30, "lust_mito", 30),
            "Yukiplusplus": ("love_yuki", 30, "lust_yuki", 30),
            "Yukihiraplus": ("love_yukihira", 30),
            "Maruiplus": ("love_marui", 30),
            "Ibusakiplus": ("love_ibusaki", 30),
            "Isshikiplus": ("love_isshiki", 30),
            "Takumiplus": ("love_takumi", 30),
            "Lovingsex": ("sex_stamina", 20),
            "Incognito": ("stealth", 20),
            "Addingingredients": ("meat_fish", 10, "pastry_ingredients", 10, "knowledge_books", 10, "traditional_ingredients", 10),
            "Skillacademic": ("meatfish_skills", 20,"pastry_skills", 20, "know_skills", 20, "trad_skills", 20, "french_skills", 20),
            "Moneymoneymoney": ("pocket_money", 300)

        if cheat_code in valid_cheat_codes:
            return valid_cheat_codes[cheat_code]
            return None  # Return None for invalid codes
 def validate_cheat_patreon(cheat_code, game_version):
        # Define your versioned cheat codes here
        valid_cheat_codes = {
            "0.1": {
                "Hello_Megumi": ("Cheat_points", 10)
            "0.2": {
                "Hello_FW": ("Cheat_points", 10)

        # Ensure the persistent.used_cheat_codes list exists
        if not hasattr(persistent, 'used_cheat_codes') or persistent.used_cheat_codes is None:
            persistent.used_cheat_codes = []

        if cheat_code in persistent.used_cheat_codes:
            # Cheat code has already been used
            return -1

        if game_version in valid_cheat_codes and cheat_code in valid_cheat_codes[game_version]:
            return valid_cheat_codes[game_version][cheat_code]
            # Fallback to non-versioned cheat codes
            return validate_cheat_code(cheat_code)

Code: Select all

"Cheat codes":
                        if game_version != config.version:
                            $ game_version = config.version
                        "You can enter a Patreon code or cheat codes here to finish the game more quickly. Cheat points: [Cheat_points]"
                        $ cheat_code = renpy.input("You can enter a Patreon code or cheat codes here to finish the game more quickly. Cheat points: [Cheat_points]")
                        $ cheat_code = cheat_code.strip()
                        $ points = validate_cheat_patreon(cheat_code, game_version)
                        $ cheat_effects = validate_cheat_code(cheat_code)
                        $ cheat_effects_points = validate_cheat_patreon(cheat_code, game_version)
                        if Cheat_points == 0:
                            $ renpy.notify("No cheat code")
                            "You don't have any cheat points"
                            jump menu_computer_after1
                        if cheat_effects_points == -1:
                            $ renpy.notify("Cheat code used")
                            "This cheat code has already been used."
                            jump menu_computer_after1
                        if cheat_effects is not None:
                            # Apply the cheat effects
                            $ Cheat_points -= 1
                                notifications = []
                                for i in range(0, len(cheat_effects), 2):
                                    variable = cheat_effects[i]
                                    amount = cheat_effects[i+1]
                          [variable] += amount
                                    notifications.append(f"{variable} +{amount}")

                            $ renpy.notify("Cheat activated")
                            # Show notifications
                                for note in notifications:
                            jump menu_computer_after1
                            $ renpy.notify("Invalid cheat code")
                            "Invalid cheat code."
                            jump menu_computer_after1
The code seems to work just fine to add up Cheat codes if you have cheat points. However, it seems like whenever I enter the "Patreon code" (which is Hello_Megumi" for now), the game ends up saying that the code has already been used no matter what. I have tried deleting the persistent data via renpy but it's still the same result...

Could someone help please?

Post Reply

Who is online

Users browsing this forum: No registered users