simple check for item amount?

Status
Not open for further replies.

Woland

Veteran
Veteran
Joined
Mar 26, 2017
Messages
350
Reaction score
98
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
31,434
Reaction score
7,713
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
350
Reaction score
98
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
31,434
Reaction score
7,713
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
279
Reaction score
244
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
350
Reaction score
98
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
3,729
Reaction score
4,685
First Language
English
Primarily Uses
RMMZ

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 Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,048
Messages
1,018,543
Members
137,834
Latest member
EverNoir
Top