Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Conditional Branch scripting question

SPN

Member

Hey guys, quick question for all you scripters out there. I haven't found a clean, reliable way to make a conditional branch for how many of a certain item I have. There's a simple optional task where you need to collect a certain amount of an item for someone. If the item was obtained through events themselves, I could just add to a variable every time and use that, but the item is a %drop from a monster, so variables aren't reliable for this.

The actual question being: What script snippet would I have to put in the conditional branch condition for it to check for a quantity of an item, and not just having the item in general? I have a decent idea of what it would look like, but there are plenty of wrong ways to write it out, heh.

Thanks!
 
Call conditional branch then choose script. Then in script write:

$game_party.item_number(ITEM ID HERE) >= amount you wish

for instance

if you want to check on if you got 5 or more potions and you have and item called Potion in database with id 001 then write

$game_party.item_number(1) >= 5

and you're set. :)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top