I'd like for an NPC to check if the player has 3 specific items in their inventory, and if the player does, the NPC will take them and then give the player a reward. How would I go about implementing this?
MZ Checking for multiple items in the player's inventory
RPG Maker MZ Supportthe evented way, use variables to grab the items you need,
I do have a way to simplify it with conditionalBranch (untested in MZ).
if this works, you can do it fairly easy (it says MV only) as I couldn't check MZ
so if my conditonBranch work in MZ, you can do the check like:
GameCheck.has("item", [1, 2, 3]);
[1,2,3] are the item ID's which is true if they have all of them
GameCheck.has("item", [1, 2, 3], {any: true});
if the player has any of the 3 items, default is false, so you can test it out.
plugin here.
if it works in MZ, please, do tell (require my core to work) so its really powerful
one, as it is optimized, rewritten from a MV plugin from the ground up.
without plugin, you need $gameParty.numItems(dataItems[id]) or around this.
but you can find that, and use && for all 3 items, or nested condition with each one
its own (can get messy).
I do have a way to simplify it with conditionalBranch (untested in MZ).
if this works, you can do it fairly easy (it says MV only) as I couldn't check MZ
so if my conditonBranch work in MZ, you can do the check like:
GameCheck.has("item", [1, 2, 3]);
[1,2,3] are the item ID's which is true if they have all of them
GameCheck.has("item", [1, 2, 3], {any: true});
if the player has any of the 3 items, default is false, so you can test it out.
plugin here.
if it works in MZ, please, do tell (require my core to work) so its really powerful
one, as it is optimized, rewritten from a MV plugin from the ground up.
without plugin, you need $gameParty.numItems(dataItems[id]) or around this.
but you can find that, and use && for all 3 items, or nested condition with each one
its own (can get messy).
Uhhh, isn't this extremely simple without any script calls?
- if party has X:
- if party has Y:
- if party has Z:
- put reward code here
- end if
- if party has Z:
- end if
- if party has Y:
- end if
Original thread: https://forums.rpgmakerweb.com/threads/checking-for-multiple-items-in-the-players-inventory.183935/