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,023
Reaction score
7,026
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,023
Reaction score
7,026
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,921
Reaction score
3,951
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 Profile Posts

Please do not buy games from g2a.com. The sellers have total power over you. The website has many scam sellers. It looks cheap, but the key code didn't work.
A while back I was having fun making my own custom tiles, then I hit carpet... why is it so difficult!? Lol.
Weekend is finally here... what would you like to see (?):
1) Pokemon into zelda minish-cap style
or
2) Pokemon into zelda gbc style
or
3) Zelda into pokemon style

#= Choose ===============#
||__[ Full mockup ]_[ Charset ]__||
#=======================#
I know someday I'll start working on this...

I'm so happy that I got Steam achievements to work in my game, thanks in large part to the posts by other RPG Maker devs on this issue!

Forum statistics

Threads
97,940
Messages
948,046
Members
129,188
Latest member
MATHOOX
Top