I am trying to make a RPG game using python but I am having trouble as I have to allow a user to receive a certain Item only once. If the user interacts with a NPC for the first time they should receive an item, if the user interacts with the same NPC again, they should receive a quote. Is there any way to prevent the NPC to give the user the same thing if they are interacted more than once?
def function():
print("What do you want to do?")
userInput = input("1. Talk to the blacksmith \n2. Leave\n")
if userInput == "1":
# if the user hasnt already received the sword:
print("the BLACKSMITH gifts you a sword")
else:
print("Hi, how can I help?")
function()
function()