Character sometimes gets stuck in one location in text based RPG

The game will ask if the character wants to fight, heal or run when they enter a location when they aren’t fighting a monster. The game also sometimes just keeps saying the character is in the same location when they try to leave.
image

1 Like

@DougieEarl can you provide a link to your Repl?

Yes I can here it is
https://replit.com/@DougieEarl/Adventure-Game?s=app

@DougieEarl do you want to get rid of the entering the location message after you beat a monster? If so you could move the place where you tell the monster to spawn:

def enterlocation(location, player):
    print(f"You have entered {location}")
    monsterappear = random.randint(1, 4)
    if monsterappear == 1 or monsterappear == 2:
        encounter_monster(location, player)
    else:
        locationtext(location, player)

To:

def findMonster():
    monsterappear = random.randint(1, 4)
    if monsterappear == 1 or monsterappear == 2:
        encounter_monster(location, player)
    else:
        locationtext(location, player)

  
def enterlocation(location, player):
    print(f"You have entered {location}")

It would make it so it doesn’t say the location over and over.

No, just look at the bottom of my screenshot. It says do you want to attack heal or run when you get to the bridge.