Thread: Python RPG help

Results 1 to 2 of 2
  1. #1
    Sylasybn's Avatar
    Join Date
    Sep 2017
    Gender
    male
    Posts
    206
    Reputation
    11
    Thanks
    15
    My Mood
    Psychedelic

    Python RPG help

    I'm having a small problem when I go to the mini zombie to interact with it non of this code executes. When I do move to the zombie it just notifies me that im there and stops. Any information would be appreciated thanks!!
    Code:
    def mini_zombie():
        actions_dict = {"check":"you lick your lips staring at the mini zombie ready to eat.",
                        "poke":" You pull out your new sword and poke at the zombie to try and wake him up.",
                        "chew":"You pick up the zombie and toss it into your mouth and proceed to chew it like bubble gum. "}
        while True:
            action = input("what do you do? [check | poke | chew] ")
            if action in actions_dict.keys():
                print(actions_dict[action])
                if action == "check":
                    print(" You inch closer and closer to the zombie licking your lips. You can't stop thinking about eating its BRAINS!!")
                    print(" You ate the zombie and fell through a trap door you are now free to go home")
                    return
                elif action == "chew":
                    you_died(" As you tried to blow a bubble with the chewed up zombie it came back to life and melted down your throat. You died. \n<Game Over>")
    Full code:
    Code:
    you_died(why):
        print(f"{why}. Good Job")
    
        exit(0)
    
    def mini_zombie():
        actions_dict = {"check":"you lick your lips staring at the mini zombie ready to eat.",
                        "poke":" You pull out your new sword and poke at the zombie to try and wake him up.",
                        "chew":"You pick up the zombie and toss it into your mouth and proceed to chew it like bubble gum. "}
        while True:
            action = input("what do you do? [check | poke | chew] ")
            if action in actions_dict.keys():
                print(actions_dict[action])
                if action == "check":
                    print(" You inch closer and closer to the zombie licking your lips. You can't stop thinking about eating its BRAINS!!")
                    print(" You ate the zombie and fell through a trap door you are now free to go home")
                    return
                elif action == "chew":
                    you_died(" As you tried to blow a bubble with the chewed up zombie it came back to life and melted down your throat. You died. \n<Game Over>")
    
    
    def blue_hallway():
        box = ["sword", "tall goat", "cat treat", "extra life"]
        print("You walk down the hallway only to run into a wall of goats. You see a box to your right and a mini sleeping zombie on your left.")
    
    
        action = input(" What do you choose??")
    
        if action in ("box", "right"):
            print(" Look a box!! ")
    
            print("break it open ? press '1' ")
            print("kiss it? press '2' ")
            choice = input("")
    
            if choice == "1":
                print("SMASHH!!! /grins ")
                print("This item appears on the ground.")
    
                for items in box:
                    print(items)
    
                print("what items do you wanna pick up?")
    
                num_items_in_box = len(box)
    
                print(f" Take all {num_items_in_box} items, press '1'" )
                print("leave it, press '2' ")
    
                item_choice= input("")
                if item_choice == "1":
                    box.remove("sword")
                    print("\tYou take the shinier sword from the box. It does looks exceedingly shiney.")
                    print("\tWoohoo! Bounty and a shiney new sword. /drops your crappy sword in the empty treasure chest.")
    
                    temp_box_list = box[:]
                    box_contents = ", ".join(box)
                    print(f"\tYou also receive {box_contents}.")
    
                    for items in temp_box_list:
                        box.remove(items)
    
                    box.append("Turd on a stick")
                    print(f"\tYou drop the Turd on a stick to the ground for the next adventurer to play with.")
                    print("Back to the tiny zombie.")
                elif item_choice == "2":
                    print("why did you smash the box for nothing...")
            elif choice == "2":
                print("Im gonna eat the mini zombie :)")
        elif action in ["mini", "zombie", "sleeping", "left"]:
            print("i'm gonna eat the zombie.")
        else:
            print("I'm not sure what you picked. Let eat the zombie anyway.")
    
    
    
    def red_hallway():
        print("You see a giant cat with ne eye!")
        print("It looks at you with an evil glare.")
        print("Do you flee or stay?")
    
        next_move = input(">  ")
    
        if "flee" in next_move:
            start_adventure()
    
        else:
            you_died("It eats you! Umm that was tasty!!")
    
    
    
    def start_adventure():
        print(" You wake up in a dark room with a Blue hallway on your left and a Red hallway to the right. ")
        hallway_picked = input("Do you pick the Blue hallway or the Red hallway??")
    
        if hallway_picked == "red":
            red_hallway()
    
        elif hallway_picked == "blue":
            blue_hallway()
    
        else:
            print("It's red or blue that needs to be picked. Sorry you are the weakest link. Goodbye ")
    
    
    
    
    
    
    def main():
    
        player_name = input(" What is your name? ")
        print(" Your name is {}. You are a {}.".format(player_name, "Radio DJ"))
    
        start_adventure()
    
    if __name__ == '__main__':
        main()

  2. #2
    grthwgeaefwqw's Avatar
    Join Date
    Jul 2019
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    you forgot to call the function 'mini_zombie'. i've attached an image showing the solution
    Attached Thumbnails Attached Thumbnails
    MiniZombie.PNG  

    Last edited by grthwgeaefwqw; 07-10-2019 at 07:10 PM.

Similar Threads

  1. Replies: 6
    Last Post: 04-30-2018, 06:06 AM
  2. [Hiring] Looking for Advanced Python Programming Help.
    By benronit in forum Work & Job Offers
    Replies: 8
    Last Post: 06-23-2017, 11:23 AM
  3. Replies: 3
    Last Post: 06-23-2017, 11:22 AM
  4. [Help] Python Cheats help
    By dan143389 in forum Counter-Strike 2 Coding & Resources
    Replies: 0
    Last Post: 08-26-2015, 11:21 PM
  5. Python: Need help with GeoIP tracing
    By xTennox in forum Programming Tutorials
    Replies: 1
    Last Post: 10-30-2014, 10:45 PM