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.

Empty Bottle > Full Bottle (SOLVED)

I would like to request a script that simulates the empty bottle system in The Legend of Zelda: Ocarina of Time/Wind Waker and any others I didnt mention.

how it works:
you get empty bottles along the way, and certain items you can put in them, like a fish and water, potions, and misc other stuff, and when you use, let go whatever was in the bottle, its empty again.

what I'm requesting:
A script that allows me to do this but with a customizable area to input the items that can be put into the bottle, like:

"Items to be put in the bottle" => [Item_id]

and whatever else you can think of to further enhance it.

credit and much thanks will be given.
 
Mmm, this is a simple one.  Paste this in a new section above main

Code:
#============================================================================
# ** Bottle System
#----------------------------------------------------------------------------
# vpcdmd
# 1.0
# 2/14/2008
#---
# ~ Originally requested by                 : HotSpot6
#============================================================================
module VPCBOT
  #id of empty bottle item
  EMPTYBOTTLE = [33,34,35,36]
end
#------------------------------------------------------------------------------
# ** Scene_Map
#------------------------------------------------------------------------------
class Scene_Map
  alias vpcdmd_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    vpcdmd_update
    if $game_system.add_item != 0
      first = VPCBOT::EMPTYBOTTLE[0]
      size = VPCBOT::EMPTYBOTTLE.size + first
      for i in first...size
        if $game_party.item_number(i) > 0
          bottle = $data_items[i]
          if bottle.name == 'Empty Bottle'
            item = $data_items[$game_system.add_item]
            bottle.name = item.name + ' Bottle'
            break
          end
        end
      end
      $game_system.add_item = 0
    end
    if $game_system.use_item != 0
      first2 = VPCBOT::EMPTYBOTTLE[0]
      size2 = VPCBOT::EMPTYBOTTLE.size + first2
      for i in first2...size2
        if $game_party.item_number(i) > 0
          bottle = $data_items[i]
          item = $data_items[$game_system.use_item]
          if bottle.name == item.name + ' Bottle'
            bottle.name = 'Empty Bottle'
            $game_system.use_item_found = true
            break
          end
        end
      end
      $game_system.use_item = 0
    end
  end
end
#------------------------------------------------------------------------------
# ** Game_System
#------------------------------------------------------------------------------

class Game_System
  attr_accessor :add_item
  attr_accessor :use_item
  attr_accessor :use_item_found
  alias vpcdmd_initialize initialize
  #--------------------------------------------------------------------------
  # * Initialization
  #--------------------------------------------------------------------------
  def initialize
    vpcdmd_initialize
    @add_item = 0
    @use_item = 0
    @use_item_found = false
  end
  #--------------------------------------------------------------------------
  # * add_item
  #--------------------------------------------------------------------------
  def add_item
    return @add_item
  end
  #--------------------------------------------------------------------------
  # * use_item
  #--------------------------------------------------------------------------
  def use_item
    return @use_item
  end
  #--------------------------------------------------------------------------
  # * use_item_found
  #--------------------------------------------------------------------------
  def use_item_found
    return @use_item_found
  end
end

Now, at the top of the scrip you will see this line

Code:
EMPTYBOTTLE = [33,34,35,36]

You have to put the id's for the "empty  bottle" items that you'll use.  Zelda usually  has four, so I set it up using id's 33-36.

Now, to fill a bottle you must place the following in an script call.
make the event's trigger "Action Button"

Code:
$game_system.add_item = i

in which i is the id of the item that you want to put inside the bottle.

Simply walk to that tile and press the C button to fill your bottle. (only one bottle will be filled, to fill another one, you must press the C button again)

Now, to use the item inside a bottle use the following commands

Code:
@> script: $game_system.use_item = i
@> Wait: 1 frame(s)
@> Conditional Branch: Script: $game_system.use_item_found
    @> Whatever you want to happen after using the item
    @>Script: if $game_system.use_item_found
     :          :$game_system.use_item_found = false
     :          :end
    @>
  :  Branch End
@>

Again, i (on the first line) is the id of the item you need to use.


Enjoy!  :thumb:
 

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