simple check for item amount?

Status
Not open for further replies.

Woland

Veteran
Veteran
Joined
Mar 26, 2017
Messages
308
Reaction score
55
First Language
Polish
Primarily Uses
RMMV
I want to make a conditional branch checking for the number of items not just if the item type is in your posession.

I'm sure there's one nifty JS line for that?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,012
Reaction score
7,024
First Language
German
Primarily Uses
RMMV
no need for any javascript, that is default eventing
1) control variable > game data > item count
2) conditional branch variable >= wanted number
 

Woland

Veteran
Veteran
Joined
Mar 26, 2017
Messages
308
Reaction score
55
First Language
Polish
Primarily Uses
RMMV
I know I can go around it but I don't want to introduce yet another variable or use an existing one and risk conflicts.

I want to do it in a cleaner way and learn something in the process :)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,012
Reaction score
7,024
First Language
German
Primarily Uses
RMMV
I don't want to introduce yet another variable or use an existing one and risk conflicts.
For that reason one of the first things I do in a new project is designate the first few variables as "temp" variables. Whenever I use those variables I know that I will never store data there, they are always temporary for direct use like in these cases. That way there will never be conflicts and I always have variables to discard at the beginning of the list of variables (=easier to find later).
 

TSR

The Northern Frog
Veteran
Joined
Nov 14, 2019
Messages
188
Reaction score
131
First Language
French
Primarily Uses
RMMV
Hello, maybe you're looking for something like that:
Code:
$gameParty.numItems($dataItems[x]) //will return number of item with database Id x
//you can also use $dataArmors[x] or dataWeapons[x]
 

Woland

Veteran
Veteran
Joined
Mar 26, 2017
Messages
308
Reaction score
55
First Language
Polish
Primarily Uses
RMMV
Exactly what I needed! Thank you, TSR!
 
  • Like
Reactions: TSR

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
2,916
Reaction score
3,949
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Ive got a long lost half uncle. Thats real cool.
I forget what is bumping rule in this forum. Is anyone know? Thank you.
BCj
Ew, why does my blogpost on the rpgmaker.net site look like a garbled mess? Are html codes disabled or something?
I feel that I should cut down on my order queue so I can get some more time for my projects, its been quite a longggg while since I worked on them LOL
I friend of mine insisted on practicing dubbing things with him... and its quite funny, yet, it really takes a huge amount of practice!

Forum statistics

Threads
97,883
Messages
947,622
Members
129,117
Latest member
Babiboo
Top