Checking if Hidden Item A Inventory is Empty (MV)

Frigg

Quiet
Veteran
Joined
Jun 15, 2017
Messages
31
Reaction score
6
First Language
English
Primarily Uses
RMMV
Hello!

I'm aware that there's a way to check if items/armor/weapons equate to zero in the player's inventory, but is there a particular way of checking if there are specifically no Key Items? Or Hidden Inventory Items? I ask because I'd like to have a way of not being able to access a combined item screen if there aren't any items in Hidden Item A, while there are still items in the Key Item scene.

Thank you in advance!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,305
Reaction score
8,750
First Language
German
Primarily Uses
RMMV
only by manual loop - checking each item if it is of type hidden A and if yes check its amount.
break if some is there, if no break in the loop then nothing is there.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,780
Reaction score
1,629
First Language
English
Primarily Uses
RMMV
You could also use a script call. Do Conditional Branch -> tab 4 -> Script:
Code:
$gameParty.items().filter(item => item.itypeId==2).length==0

will be true if you have no key items. I'm guessing that replacing that with itypeId==3 or itypeId==4 will check for hidden items A and B respectively. If you want to check for the absence of any hidden items, you could do itypeId>2
 

Piyan Glupak

Veteran
Veteran
Joined
Nov 14, 2016
Messages
125
Reaction score
63
First Language
English
@ATT_Turan Works like a charm! Thank you. (I use Hidden A items to keep track of dead party members in two of my current projects.)
 

Frigg

Quiet
Veteran
Joined
Jun 15, 2017
Messages
31
Reaction score
6
First Language
English
Primarily Uses
RMMV
Thank you! I’ll give this a shot when I get home!
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,780
Reaction score
1,629
First Language
English
Primarily Uses
RMMV
I use Hidden A items to keep track of dead party members in two of my current projects.
Without knowing exactly how your system works or what you do with that...if it's literally just to track who's died, there are a few ways you could go about that without having to define an item in your database for every party member, add it to the party, and then figure out how to ignore it.

You could simply use a switch for each actor, then check if HaroldDead = ON

You could also use a single variable and a few script calls. Have an autorun at the beginning of your game that initializes one as an array, e.g. $gameVariables.setValue(5, [])

Then when a character dies, you can add it in:
$gameVariables.value(5).push(actor._actorId)

And to check if a character has died:
$gameVariables.value(5).includes(character'sActorId)
 

Piyan Glupak

Veteran
Veteran
Joined
Nov 14, 2016
Messages
125
Reaction score
63
First Language
English
@ATT_Turan - Dead characters get removed from the party and a Hidden A item with the dead actor's name gets given to the party. This works well if the actors don't get renamed by the player. One project has 4 party members except for a few instances where another actor joins for a short while, or for a couple of missions when the party splits. Another project has the player pick 4 actors from a choice of 16 pre-named actors with classes already assigned. The main benefit is that you can use the editor command "Choose Item" as an easy menu to choose dead comrades to revive, so no need to do a lot of work with the Himeworks hiddenChoices plugin.

When a party member is returned to life, the hidden A item with their name is removed, of course.

For the experimental project that has 4 party members that the player chooses face and sprite, gender, class and name for, I do use a switch for each, because I don't know of any way to change the name of a hidden A item during play. It is not cumbersome because there are only a small number of possible actors used in the party outside of cut-scenes.

I do like your suggestion of using an array, though. Might try it some time.
 

Latest Threads

Latest Profile Posts

"Yeah. It's been a rough road lately. But that's the thing about the Rangers. It doesn't matter how hard it gets, or how many of them fall. They never stop fighting. The Rangers NEVER stop fighting".

Angela Deth, you are a hero of mine. Sorry for my first run of Wasteland 3.
We must press on. For all those we couldn't save. For all those we might yet save.
FirestormNeos wrote on DarkPlasmaBall's profile.
asking this here instead of the thread in question to avoid derailing it, but I'm curious; is there a particular reason you'd include a "Terms of Use" for an RPG Maker game? Like, are there multiplayer features for the game you're working on?
The holidays are upon us! Everyone search for safety from the grocery store music!
I don't understand people sometime. Walking to work today came across someone walking the opposite way in a nice suit, I politely move to the side into the shrubbery so he doesn't have to get his suit dirty and say "good morning" as he passes me, he turns around glaring daggers and asks "why are you talking to me?" like he's bloody offended by me wishing him a good morning or something. Just, why?

Forum statistics

Threads
117,137
Messages
1,104,890
Members
153,201
Latest member
OpalWysty
Top