Sorry if this question has been asked too many times but, I wanted an NPC to give an object to the player but, I don't want so that every time you talk to the NPC he gives the item again, how can I close this cycle?
Make so a cycle doesn't repeat?
RPG Maker VXAce SupportCreate a second event page with self-switch A turned on, and have it set Self Switch A to ON after giving the player the item.
Alternatively, you can use conditional branches, and if the player already has the item have the NPC not give it to them again, but that wouldn't work with consumables.
Alternatively, you can use conditional branches, and if the player already has the item have the NPC not give it to them again, but that wouldn't work with consumables.
Indeed this, but as Iron Brew mentioned, if the item is removed from the inventory (such as a consumable or quest item) then the NPC will give the item again because the conditional "If Player has item" is no longer being met.
So, if it is for a quest, you can do quest staging through a variable.
Create a new variable "NPCItemQuest"
Then, set a conditional on the NPC.
If NPCItemQuest = 0
Give item
Set NPCItemQuest to 1
(alternatively: Add 1 to NPCItemQuest. Choose 1 of these methods)
Else
Message Box: "What? You want more!?! Don't be greedy!"
You can increase this variable as the player moves through the quest, so when the player uses the item, you can set the quest variable to 2, and maybe after the item is used the NPC can have special dialogue about the player having used the item:
same event page, same NPC
If NPCItemQuest = 2
Message Box: "What you ate it? Are you an imbecile? That was dog food, you idgit."
Hopefully that illustrates how quest staging works.
Best of luck with your game make!
Original thread: https://forums.rpgmakerweb.com/threads/make-so-a-cycle-doesnt-repeat.161159/