itemsInExistence = []
#items are put into this matrix in a save function
#Ex. ['Sword Mk II', 4, 4]
gains = random.randint(1, 3)
if gains == 2:
gained_weapon = random.choice(itemsInExistence)
print("You gained the item", gained_weapon)
itemMatrix.append(gained_weapon)
for i in itemsInExistence:
if gained_weapon == itemsInExistence[i]:
del itemsInExistence[i]
break
It keeps giving me the error:
if gained_weapon == itemsInExistence[i]:
TypeError: list indices must be integers or slices, not str.
How would I go about fixing this without seriously changing how the items are set up?
Aucun commentaire:
Enregistrer un commentaire