new to coding so if my code could be more simple ill take suggestions, anyway I'm doing text based RPG just as fun and I'm stuck on a piece of code, so what I want it to do is say if you have chosen Mage as you player class you wont be able lockpick the door or smash a window but you can use a spell on the door
playerName = input("What is your name traveler?")
playerClass = "player class"
validChoice = False
while not validChoice:
classType = int(input('''
What is your class?
*----------------*
| 1 for Archer |
| 2 for Warrior |
| 3 for Mage |
| 4 for Knight |
| 5 for Thief |
*----------------*
'''))
if classType == 1:
playerClass = "Archer"
validChoice = True
elif classType == 2:
playerClass = "Warrior"
validChoice = True
elif classType == 3:
playerClass = "Mage"
validChoice = True
elif classType == 4:
playerClass = "Knight"
validChoice = True
elif classType == 5:
playerClass = "Thief"
validChoice = True
else:
print("that wasn't a option dumbass")
# begin story and ask them to make a decision
validChoice = False
while not validChoice:
storyChoice = int(input('''
Greetings {} the {}
You arrive at a small village named NewHaven,
you enter the local tavern and sit at the bar,
the tavern owner asks what you would like to drink,
Do you:
*-------------------------*
| 1 Get a drink of water? |
| 2 Get a drink of mead? |
| 3 Get a drink of ale? |
*-------------------------*
'''.format(playerName, playerClass)))
# string formatting to add choices from before
if storyChoice == 1:
print("The tavern owner laughs at you and throws the glass at you and you die")
validChoice = False
elif storyChoice == 2:
print("The other people hear you in tavern and think your a viking and burn you alive")
validChoice = False
elif storyChoice == 3:
print("The tavern owner hands you a mug of ale and you begin to drink it")
validChoice = True
else:
print("That wasn't an option")
validChoice = False
while not validChoice:
storyChoice2 = int(input('''
While drinking you over hear a group of worriers,
fresh from battle with blood over there weapons and armour,
But not there's they mention of a man who died in his house but he was said to be rich,
he had gone mad from his old age and his wealth,
No one knows how he got the money,
But he apparently had set Traps so his spoilt children who took him for granted,
Would not be able to get the money his house was up the hill just out of the village you reach the house
Do you:
*--------------------------------*
| 1 Lock pick the door? |
| 2 Smash the window? |
| 3 Use a spell to open the door?|
*--------------------------------*
'''.format(playerName, playerClass)))
playerName = input("What is your name traveler?")
playerClass = "player class"
validChoice = False
while not validChoice:
classType = int(input('''
What is your class?
*----------------*
| 1 for Archer |
| 2 for Warrior |
| 3 for Mage |
| 4 for Knight |
| 5 for Thief |
*----------------*
'''))
if classType == 1:
playerClass = "Archer"
validChoice = True
elif classType == 2:
playerClass = "Warrior"
validChoice = True
elif classType == 3:
playerClass = "Mage"
validChoice = True
elif classType == 4:
playerClass = "Knight"
validChoice = True
elif classType == 5:
playerClass = "Thief"
validChoice = True
else:
print("that wasn't a option dumbass")
# begin story and ask them to make a decision
validChoice = False
while not validChoice:
storyChoice = int(input('''
Greetings {} the {}
You arrive at a small village named NewHaven,
you enter the local tavern and sit at the bar,
the tavern owner asks what you would like to drink,
Do you:
*-------------------------*
| 1 Get a drink of water? |
| 2 Get a drink of mead? |
| 3 Get a drink of ale? |
*-------------------------*
'''.format(playerName, playerClass)))
# string formatting to add choices from before
if storyChoice == 1:
print("The tavern owner laughs at you and throws the glass at you and you die")
validChoice = False
elif storyChoice == 2:
print("The other people hear you in tavern and think your a viking and burn you alive")
validChoice = False
elif storyChoice == 3:
print("The tavern owner hands you a mug of ale and you begin to drink it")
validChoice = True
else:
print("That wasn't an option")
validChoice = False
while not validChoice:
storyChoice2 = int(input('''
While drinking you over hear a group of worriers,
fresh from battle with blood over there weapons and armour,
But not there's they mention of a man who died in his house but he was said to be rich,
he had gone mad from his old age and his wealth,
No one knows how he got the money,
But he apparently had set Traps so his spoilt children who took him for granted,
Would not be able to get the money his house was up the hill just out of the village you reach the house
Do you:
*--------------------------------*
| 1 Lock pick the door? |
| 2 Smash the window? |
| 3 Use a spell to open the door?|
*--------------------------------*
'''.format(playerName, playerClass)))