Mallowbird

Villager
Member
Joined
Jul 26, 2020
Messages
12
Reaction score
6
First Language
English
Primarily Uses
RMMV
Hello! I suppose the the title says most of my question already, but how can I check if the player's Items inventory is empty?

Preferably this would be either via a script call or otherwise as a condition in a conditional branch (which is how my event is set up so far, but if no such method exists, any other workaround is fine too). I guess what I am trying to achieve is something along these lines:

If: Player's Items inventory is empty: <- I am trying to figure out how to check for this
(actions)

Else:
(other actions)

I know that it is possible to check whether there is a specific item in the player's Items inventory, but I'm not sure about checking for whether the Items inventory contains anything as a whole. The intended purpose is to check if the player actually has anything in their Items inventory at all upon interacting with an NPC to see whether further dialogue is required.

Does anybody know how I can achieve this? Any and all help would be appreciated!
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,484
Reaction score
721
First Language
indonesian
Hello! I suppose the the title says most of my question already, but how can I check if the player's Items inventory is empty?

Preferably this would be either via a script call or otherwise as a condition in a conditional branch (which is how my event is set up so far, but if no such method exists, any other workaround is fine too). I guess what I am trying to achieve is something along these lines:

If: Player's Items inventory is empty: <- I am trying to figure out how to check for this
(actions)

Else:
(other actions)

I know that it is possible to check whether there is a specific item in the player's Items inventory, but I'm not sure about checking for whether the Items inventory contains anything as a whole. The intended purpose is to check if the player actually has anything in their Items inventory at all upon interacting with an NPC to see whether further dialogue is required.

Does anybody know how I can achieve this? Any and all help would be appreciated!
maybe try conditional branch -> script:
Code:
$gameParty.allItems().length == 0
this will return true when no item at all at inventory... this also include UNEQUIPPED weapon / armor... so if you unequip your weapon and it enter inventory... this will return false (go to else branch)

some variation for above:
if you want to check only no ITEM in inventory (armor and weapon will be ignored)
change to:
Code:
$gameParty.items().length == 0

if you want to check only no ARMOR in inventory (item and weapon will be ignored)
change to:
Code:
$gameParty.armors().length == 0

if you want to check only no WEAPON in inventory (item and armor will be ignored)
change to:
Code:
$gameParty.weapons().length == 0

hope this help.
 

BrentBAM

Veteran
Veteran
Joined
Jul 22, 2020
Messages
80
Reaction score
44
First Language
English
Primarily Uses
RMVXA
Hello!

I found a concept of how to do something similar like this on the forums before. What you need to do is:

1) control variable : Game Data : item in inventory


this will load the number of the item in inventory into the variable


2) conditional branch : variable = 0


If the variable is zero (or whatever number you wanted), you can execute the dialogue you wanted for your character.
 

Mallowbird

Villager
Member
Joined
Jul 26, 2020
Messages
12
Reaction score
6
First Language
English
Primarily Uses
RMMV
Thank you both so much for your help! I tried the code snippet for checking if there are no items in the inventory and it worked like a charm! I think this is a great help for everyone else who encounters a situation like mine and comes across this thread, too. Thank you both again!
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
947
Reaction score
497
First Language
English
Primarily Uses
RMMV
Hello!

I found a concept of how to do something similar like this on the forums before. What you need to do is:
This is not very helpful for the OP because it only checks one item at a time. In order for him to use it for his stated purpose, he would need to type out a conditional like this for every single item in his entire database.It makes much more sense to use the script call for the party's item array.
 

Latest Threads

Latest Profile Posts

I feel so dumb I forgot to set parameters and thought the plugin wasn't working
I can come up with all of the magic skills in the world, but I can hardly think of creative physical weapon skills within the JRPG realm. One of those ones....
It's time for episode 19 of our Make a Cliff Map in RPG Maker MZ... I mean, Make a Game in RPG Maker MZ! Today we're working on our cliff map again. Let's see if we can finish it this time!

A side story is almost getting into the next stage. Almost everything in this game has real-life references.
unfinishedbuildingwip1.jpg
Everyday life is full of absurdity. This is just a reflection.

Forum statistics

Threads
111,413
Messages
1,060,929
Members
144,765
Latest member
tinsel2
Top