The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: bunnies on September 20, 2010, 11:34:08 PM

Title: Inventory Max-Out Script
Post by: bunnies on September 20, 2010, 11:34:08 PM
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?
Title: Re: Inventory Max-Out Script
Post by: bunnies on November 09, 2010, 11:32:50 PM
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.."
Title: Re: Inventory Max-Out Script
Post by: FenixFyreX on November 20, 2010, 09:36:32 AM
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.