Main Menu
  • Welcome to The RPG Maker Resource Kit.

Inventory Max-Out Script

Started by bunnies, September 20, 2010, 11:34:08 PM

0 Members and 1 Guest are viewing this topic.

bunnies

I would like to make a conditional branch where it detects if x amount of items are in inventory. If x >= (let's say) 50 Then display message "Inventory is Full." Else [Actions here]

How do I do this? Can I do it with a script?

bunnies

Quote from: Kyogia on September 25, 2010, 01:57:39 AM
Use Control Variables > Item. Then, use Conditional Branch: <Variable> 50 or lower.
Hope this answered your question!

I actually meant not one item, but all items in inventory. So if all items in inventory >= 50 Then display message = "Inventory full blah blah blah.."

FenixFyreX

Do you mean if you have 49 potions and 1 stimulant, the result would be 50? or do you mean 50 different types of items? < .<

If you mean the former, use this scriptlet:

class Game_Party
  def item_total
    n = 0
    for i in @items.values+@weapons.values+@armors.values
      n += i
    end
    return n
  end
end
class Game_interpreter
  def item_total
    return $game_party.item_total
  end
end


To use in a conditional branch, just use:

Coditional Branch: Script: item_total >= 50

If you meant types of items, $game_party.items.size is what you'd use.