Need some help about the code executes one thing and then stop executing another



false_count = 3
Current_Melee_Weapon = ""
Current_Ranged_Weapon = ""
Current_Magic_Weapon = ""

MeleeATK = 0
RangedATK = 0
MagicATK = 0
Health_Pack = 0
Healing_Drink = 0
answer_count = 0
HP = 5
maxHP = 5

while answer_count == 0 and false_count > 0:
	Intro = input ("<>Hey you! Answer 'yes' or I gonna bang you in the head!!! (Yes//No) : ").lower().strip()
	if Intro == "yes":
		answer_count += 1
		print ("<----[" + str(answer_count) + "]---->")

		print ("<>So heres the thing : WWIII broke out and as a soldier you are now in a army camp in Area 51,")
		print ("<>Here are some of your equipment : ")

		print ("< Army Knife > : MeleeATK + 2")
		MeleeATK += 2
		Current_Melee_Weapon = "army knife"

		print ("< Glock 18 > : RangedATK + 2")
		RangedATK += 2
		Current_Ranged_Weapon = "glock 18"

		print ("< Health Pack > : [2]")
		Health_Pack += 2

		print ("< Healing Drink > : [2]")
		Healing_Drink += 2

		print ("<>Oh crap!")
		print ("<>The Neo-Nazis are coming! They have missles and tanks and stuff...")
		print ("<>Incoming a Nazi Soldier towards your way...")
		answer = input ("<>Wut ya gonna do? (Attack//Escape) : ").lower().strip()

		if answer == "attack" and answer_count == 1:
			answer_count += 1
			print ("<----[" + str(answer_count) + "]---->")

			print ("<>The Nazi dude rushes your way and pulls out his HK417...")
			print ("*panic*")
			answer = input ("<>What ya gonna attack him with? (" + Current_Melee_Weapon + "//" + Current_Ranged_Weapon + ") : ").lower().strip()
			
		elif answer == "escape" and answer_count == 1:
			answer_count += 1
			print ("<" + str(answer_count) + ">")

			print ("<>As the largest coward in the whole universe, you tried to run away...")
			print ("<>But the Nazis had supreme Athletic Training and you are just a weebo that somehow joined the army,")
			print ("<>you have no choice but to fight him.")
			print ("*panic*")
			answer = input ("<>What ya gonna attack him with? (" + Current_Melee_Weapon + "//" + Current_Ranged_Weapon + ") : ").lower().strip()

		elif answer_count == 1:
			answer_count += 1
			print ("<----[" + str(answer_count) + "]---->")

			print ("<>You were so messed up you arent even sure what ya wanna do,")
			print ("<>the next thing you know, the Nazi dude shot the ■■■■ outta you, you died, the end...")
			print ("[DEAD]")
			HP -= maxHP

		if answer == Current_Melee_Weapon and answer_count == 2:
			answer_count += 1
			print ("<----[" + str(answer_count) + "]---->")

			print ("<>You attacked him with the " + Current_Melee_Weapon + "...")
			print ("<>He bled so much he turned into tofu!")
			print ("*deeply terrified and amazed all at the same time*")

		> elif answer == Current_Ranged_Weapon and answer_count == 2:
> 			answer_count += 1
> 			print ("<----[" + str(answer_count) + "]---->")
> 
> 			print ("<>He fires at you and you got shot in the leg,")
> 			print ("[HP - 1]")
> 			HP -= 1
> 			print ("[Current HP : " + str(HP) + "]")
> 			print ("<>but you managed to use your gamer reflexes and slid under his feet and you shot him in the balls while doing that...")
> 			print ("<>he died in great pain and horror, and you are the reason.")
> 			print ("*feels sorry*")
		
		elif answer == 2:
			print ("<----[" + str(answer_count) + "]---->")

			print ("<>You did nothing and the Nazi dude happily shoots you at the face...")
			print ("<>luckily some mighty weebo aura caused some of the bullets to miss...")
			print ("<>You think you survived didnt you!?")
			print ("<>No you didnt!")
			print ("[DEAD]")
			HP -= maxHP

	elif Intro == "no":
		answer_count += 1
		print ("<----[" + str(answer_count) + "]---->")

		print ("<>OK if this is what you wanted the whole time, fudge you. Get rekt.")
		print ("*gets shot in the head*")
		print ("<>And of course you died being a useless weebo")
		print ("[DEAD]")
		HP -= maxHP

	else:
		false_count -= 1
		print ("<----[" + str(answer_count) + "]---->")

		print ("<>Invalid Answer")
		if false_count > 0:
			print ("<>Try Again...")
	
	if false_count == 0:
		print ("<>OK if this is what you wanted the whole time, fudge you. Get rekt.")
		print ("*gets shot in the head*")
		print ("<>And of course you died being a useless weebo")
		print ("[DAED]")
		HP -= maxHP


if Health_Pack > 0 and HP < 3 and not HP <= 0:
	heal = input ("<>Do you wanna heal your wounds (perhaps your soul too) with a Health Pack? (Yes//No) : ").lower().strip()
	if heal == "yes":
		Health_Pack -= 1
		print ("<>You healed yourself with a Health Pack and your wounds recovered.")
		print ("[HP + 3]")
		HP += 3
		print ("[Current HP : " + str(HP) + "]")

	elif heal == "no":
		print ("<>Ok Boomer :/")
		print ("[Current HP : " + str(HP) + "]")
	
	else:
		print ("<>I dunno what ya talking about but I dont care anyway...")
		print ("[Current HP : " + str(HP) + "]")
		
> if Healing_Drink > 0 and HP < 5 and not HP <= 0:
> 	heal = input ("<>Do you wanna heal your wounds with a Healing Drink? (Yes//No) : ").lower().strip()
> 	if heal == "yes":
> 		Healing_Drink -= 1
> 		print ("<>You healed yourself with a Healing Drink and your wounds recovered.")
> 		print ("[HP + 1]")
> 		HP += 1
> 		print ("[Current HP : " + str(HP) + "]")
> 
> 	elif heal == "no":
> 		print ("<>Ok Boomer :/")
> 		print ("[Current HP : " + str(HP) + "]")
> 	
> 	else:
> 		print ("<>I dunno what ya talking about but I dont care anyway...")
> 		print ("[Current HP : " + str(HP) + "]")


if HP <= 0:
	print ("GAME OVER")

so here is my code over here, the part when u chooseCurrent_Ranged_Weapon will 1 HP and then the code Healing Drinkwill run and heal HP +1… so what i want is , too add some code under the Current_Melee_Weapon and Current_Ranged_Weapon chunk of code, and no under any of it but directly under it
the code will be like

> if answer_count == 3 and (answer == Current_Melee_Weapon or Current_Ranged_Weapon:
> 
> print ("Retarts tastes good)

then the code would somehow run the Healing_drink part and skip the above "Retart " part, or it will just run in front of the Healing Potion code even runs.
and i kinda know whats the problem but i wanna know what can i do to have the Current_Ranged_Weaponpart run , then the Healing_potionpart then go back up to run the retart part…
so i quoted the important relevent parts, so the goal here is to:
let the retart code run after the Current_Ranged_Weapon part runs and jumps into the healing_potion part at the bottom of the code

Thank you all for wasting time reading my stupid post, its probaly some common mistake

It’s kind of hard to follow your question as is. But no worries! Can you break it up into numbered points and comment in your code what each number refers to?

1 Like

i quoted some important parts of the code , dunno if that helps my code is kinda messy i know