So i' trying to create a chest for a rpg game i'm working on and i'm having a really difficult time implementing probability along with making sure one item always drops on open. I was able to get the probability down but whenever i get it to work i'm unable to make the potion drop along with the weapon. Any help would be greatly appreciated! And yes my items are named from fairy tail.
I've already tried giving the items weight but even so i'm unable to make sure the potion drops
import random
-------------------------------------------------------------------------
Chestitems = [
"constant: Potion",
"common: Bow",
"common: Sword",
"common: Spear",
"uncommon: irondragon_Bow",
"uncommon: irondragon_Sword",
"uncommon: irondragon_Spear",
"rare: skydragon_Bow",
"rare: skydragon_Sword",
"rare: skydragon_Spear",
"legendary: firedragon_bow",
"legendary: firedragon_Sword",
"legendary: firedragon_Spear"
]
while(True):
OpenChest = input("Type 'open' to open the Chest!")
if OpenChest == "open":
print(random.choice(Chestitems))
else:
break
The code i have above is what i have working. Consider i'm self taught with no schooling it's really hard to find anything that helped me completely.