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,483
Reaction score
720
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
933
Reaction score
492
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 Posts

Latest Profile Posts

Every game that has an option to choose to turn on the subtitle at the first time setup deserves an award.
Only eaten once during breakfast. No lunch
Not that I have any use for them, but Humble Bundle has a new RPG Asset Bundle available for those interested. You can find it here. Happy asset hoarding. :LZSwink:
Tired of just doing mobile. Now you can Play the game in ur Browser! https://bigmala-productions.itch.io/rpg-forever
I managed to fix my car at last... :biggrin:

Forum statistics

Threads
111,282
Messages
1,059,918
Members
144,589
Latest member
Pavlacalm
Top