• The Eevee Expo Game Jam #10 has concluded, congratulations to all participants! Now it's time for the judges to play through the games, and you can play along to vote who deserves the community choice spotlight.
    You can check out the submitted games here!
    Play through the games and provide some feedback to the devs while you're at it!
  • Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
BOTW-Like Item Gathering

Resource BOTW-Like Item Gathering 1.0

Kyu

Novice
Member
Joined
Apr 1, 2017
Posts
11
Kyu submitted a new resource:

BOTW-Like Item Gathering - Fast item gathering. Ideal for exploration-heavy and fast paced games


View attachment 3400
Author: Kyu
Compatible with: v16, v17 and v18.1
Overview
This resource adds an alternative way of gathering items and berries, though the last one is optional.
A notification will appear on screen without showing any messages or stopping the action, making it ideal for exploration-heavy and fast paced games.


Features
  • Alternative way of...

Read more about this resource...
 

Vena Cava

Rookie
Member
Joined
Apr 14, 2018
Posts
5
Updated to to v19 thanks to Vendily
Code:
Expand Collapse Copy
# BOTW-Like Item Gathering by: Kyu
# Updated to v19 by: Vendily
################################################################################
# How to install:
#   Add Object.png to the Graphics/Pictures folder.
#   Add this script over main.
#
# CREDITS MUST BE GIVEN TO EVERYONE LISTED ON THE POST
################################################################################
# CONSTANTS
################################################################################
NEWPICKBERRY = true # if true, berries will be picked directly with the new anim.
ITEMGETSE = "Voltorb Flip point" # ME that will play after obtaining an item.
################################################################################

if defined?(PluginManager)
  PluginManager.register({
    :name => "BOTW-Like Item Gathering",
    :version => "1.0",
    :credits => "Kyu"
  })
end
 
#UI Object with timer, animation and other relevant data
class UISprite < SpriteWrapper
  attr_accessor :scroll
  attr_accessor :timer

  def initialize(x, y, bitmap, viewport)
    super(viewport)
    self.bitmap = bitmap
    self.x = x
    self.y = y
    @scroll = false
    @timer = 0
  end

  def update
    return if self.disposed?
    @timer += 1
    case @timer
    when (0..10)
      self.x += self.bitmap.width/10
    when (100..110)
      self.x -= self.bitmap.width/10
    when 111
      self.dispose
    end
  end
end


class Spriteset_Map
  # Handles all UI objects in order to control their positions on screen, timing
  # and disposal. Acts like a Queue.
  class UIHandler
    def initialize
      @viewport = Viewport.new(0,0,Graphics.width,Graphics.height) # Uses its own viewport to make it compatible with both v16 and v17.
      @viewport.z = 9999
      @sprites = []
    end

    def addSprite(x, y, bitmap)
      @sprites.each{|sprite|
        sprite.scroll = true
      }
      index = @sprites.length
      @sprites[index] = UISprite.new(x, y, bitmap, @viewport)
    end

    def update
      removed = []
      @sprites.each_index{|key|
        sprite = @sprites[key]
        if sprite.scroll
          sprite2 = @sprites[key + 1]
          if sprite.x >= sprite2.x && sprite.x <= sprite2.bitmap.width + sprite2.x
            if sprite.y >= sprite2.y && sprite.y <= sprite2.bitmap.height + sprite2.y + 5
              sprite.y += 5
            end
          else
            sprite.scroll = false
          end
        end
        sprite.update
        if sprite.disposed?
          removed.push(sprite)
        end
      }
     
      removed.each{|sprite|
        @sprites.delete(sprite)
      }
    end
       
    def dispose
      @sprites.each{|sprite|
        if !sprite.disposed?
          sprite.dispose
        end
      }
      @viewport.dispose
    end
  end
 
  alias :disposeOld :dispose
  alias :updateOld :update

  def dispose
    @ui.dispose if @ui
    disposeOld
  end

  def update
    @ui = UIHandler.new if !@ui
    @ui.update
    updateOld
  end

  def ui
    return @ui
  end
end


class Scene_Map
  def addSprite(x, y, bitmap)
    self.spriteset.ui.addSprite(x, y, bitmap)
  end
end


def itemAnim(item,qty)
  bitmap = Bitmap.new("Graphics/Pictures/Object")
  pbSetSystemFont(bitmap)
  base = Color.new(248,248,248)
  shadow = Color.new(72,80,88)
 
  if qty > 1
    textpos = [[_INTL("{1} x{2}",item.name_plural,qty),5,15,false,base,shadow]]
  else
    textpos = [[_INTL("{1}",item.name),5,15,false,base,shadow]]
  end
  pbDrawTextPositions(bitmap,textpos)
  bitmap.blt(274,5,Bitmap.new(GameData::Item.icon_filename(item.id)),Rect.new(0,0,48,48))
  pbSEPlay(ITEMGETSE)
  $scene.addSprite(-bitmap.width,200,bitmap)
end


def pbItemBall(item,quantity=1)
  item = GameData::Item.get(item)
  return false if !item || quantity<1
  itemname = (quantity>1) ? item.name_plural : item.name
  if $PokemonBag.pbStoreItem(item,quantity)   # If item can be picked up
    itemAnim(item,quantity)
    return true
  else   # Can't add the item
    if item == :LEFTOVERS
    pbMessage(_INTL("{1} found some \\c[1]{2}\\c[0]!\\wtnp[30]",$Trainer.name,itemname))
    elsif item.is_machine?   # TM or HM
      pbMessage(_INTL("\\l[2]{1} found \\c[1]{2} {3}\\c[0]!\\wtnp[30]",$Trainer.name,itemname,GameData::Move.get(move).name))
    elsif quantity>1
      pbMessage(_INTL("\\l[2]{1} found {2} \\c[1]{3}\\c[0]!\\wtnp[30]",$Trainer.name,quantity,itemname))
    elsif itemname.starts_with_vowel?
      pbMessage(_INTL("\\l[2]{1} found an \\c[1]{2}\\c[0]!\\wtnp[30]",$Trainer.name,itemname))
    else
      pbMessage(_INTL("\\l[2]{1} found a \\c[1]{2}\\c[0]!\\wtnp[30]",$Trainer.name,itemname))
    end
    pbMessage(_INTL("But your Bag is full..."))
    return false
  end
end

alias :oldBerry :pbPickBerry
def pbPickBerry(berry,qty=1)
  if !NEWPICKBERRY # Old Animation
    oldBerry(berry,qty)
  else # New Animation
    interp=pbMapInterpreter
    thisEvent=interp.get_character(0)
    berryData=interp.getVariable
    berry=GameData::Item.get(berry)
    itemname=(qty>1) ? berry.name_plural : berry.name
    if !$PokemonBag.pbCanStore?(berry,qty)
      pbMessage(_INTL("Too bad...\nThe bag is full."))
      return
    end
    $PokemonBag.pbStoreItem(berry,qty)
    itemAnim(berry,qty)
    if defined?(NEWBERRYPLANTS) #Compatibility with essentials v18.1
      if NEWBERRYPLANTS
        berryData=[0,nil,0,0,0,0,0,0]
      else
        berryData=[0,nil,false,0,0,0]
      end
    else
      berryData=[0,nil,false,0,0,0]
    end
    interp.setVariable(berryData)
    pbSetSelfSwitch(thisEvent.id,"A",true)
  end
end
 

AenaonDogsky

Arbiter of Doggos
Member
Joined
Dec 12, 2017
Posts
506
The Compiler_Maps_and_Events script contains changes to methods and reference names, that are automatically applied to events in your game. But it cannot automatically replace those in your scripts.

In this case the error happens because the "here add this item to your bag" and "let's check if you can add this item" def has changed its name in v21.

To manually update the script to v21, replace all instances of

Ruby:
Expand Collapse Copy
$PokemonBag.pbCanStore?

with

Ruby:
Expand Collapse Copy
$bag.can_add?

and


Ruby:
Expand Collapse Copy
$PokemonBag.pbStoreItem

with

Ruby:
Expand Collapse Copy
$bag.add

Notice that there is a berry section that might or might not be handled differently in v21, but the bag defs should be changed there as well.
 

ardicoozer

Cooltrainer
Member
Joined
Sep 29, 2020
Posts
171
Here Update for v20/20.1
Code:
Expand Collapse Copy
# BOTW-Like Item Gathering by: Kyu
# Updated to v19 by: Vendily
# Updated to v20/20.1 by: Ardicoozer
################################################################################
# How to install:
#   Add Object.png to the Graphics/Pictures folder.
#   Add this script over main.
#
# CREDITS MUST BE GIVEN TO EVERYONE LISTED ON THE POST
################################################################################
# CONSTANTS
################################################################################
NEWPICKBERRY = true # if true, berries will be picked directly with the new anim.
ITEMGETSE = "Voltorb Flip point" # ME that will play after obtaining an item.
################################################################################

if defined?(PluginManager)
  PluginManager.register({
    :name => "BOTW-Like Item Gathering",
    :version => "1.0",
    :credits => "Kyu"
  })
end
 
#UI Object with timer, animation and other relevant data
class UISprite < SpriteWrapper
  attr_accessor :scroll
  attr_accessor :timer

  def initialize(x, y, bitmap, viewport)
    super(viewport)
    self.bitmap = bitmap
    self.x = x
    self.y = y
    @scroll = false
    @timer = 0
  end

  def update
    return if self.disposed?
    @timer += 1
    case @timer
    when (0..10)
      self.x += self.bitmap.width/10
    when (100..110)
      self.x -= self.bitmap.width/10
    when 111
      self.dispose
    end
  end
end


class Spriteset_Map
  # Handles all UI objects in order to control their positions on screen, timing
  # and disposal. Acts like a Queue.
  class UIHandler
    def initialize
      @viewport = Viewport.new(0,0,Graphics.width,Graphics.height) # Uses its own viewport to make it compatible with both v16 and v17.
      @viewport.z = 9999
      @sprites = []
    end

    def addSprite(x, y, bitmap)
      @sprites.each{|sprite|
        sprite.scroll = true
      }
      index = @sprites.length
      @sprites[index] = UISprite.new(x, y, bitmap, @viewport)
    end

    def update
      removed = []
      @sprites.each_index{|key|
        sprite = @sprites[key]
        if sprite.scroll
          sprite2 = @sprites[key + 1]
          if sprite.x >= sprite2.x && sprite.x <= sprite2.bitmap.width + sprite2.x
            if sprite.y >= sprite2.y && sprite.y <= sprite2.bitmap.height + sprite2.y + 5
              sprite.y += 5
            end
          else
            sprite.scroll = false
          end
        end
        sprite.update
        if sprite.disposed?
          removed.push(sprite)
        end
      }
     
      removed.each{|sprite|
        @sprites.delete(sprite)
      }
    end
       
    def dispose
      @sprites.each{|sprite|
        if !sprite.disposed?
          sprite.dispose
        end
      }
      @viewport.dispose
    end
  end
 
  alias :disposeOld :dispose
  alias :updateOld :update

  def dispose
    @ui.dispose if @ui
    disposeOld
  end

  def update
    @ui = UIHandler.new if !@ui
    @ui.update
    updateOld
  end

  def ui
    return @ui
  end
end


class Scene_Map
  def addSprite(x, y, bitmap)
    self.spriteset.ui.addSprite(x, y, bitmap)
  end
end


def itemAnim(item,qty)
  bitmap = Bitmap.new("Graphics/Pictures/Object")
  pbSetSystemFont(bitmap)
  base = Color.new(248,248,248)
  shadow = Color.new(72,80,88)
 
  if qty > 1
    textpos = [[_INTL("{1} x{2}",item.name_plural,qty),5,15,false,base,shadow]]
  else
    textpos = [[_INTL("{1}",item.name),5,15,false,base,shadow]]
  end
  pbDrawTextPositions(bitmap,textpos)
  bitmap.blt(274,5,Bitmap.new(GameData::Item.icon_filename(item.id)),Rect.new(0,0,48,48))
  pbSEPlay(ITEMGETSE)
  $scene.addSprite(-bitmap.width,200,bitmap)
end


def pbItemBall(item,quantity=1)
  item = GameData::Item.get(item)
  return false if !item || quantity<1
  itemname = (quantity>1) ? item.name_plural : item.name
  if $bag.add(item,quantity)   # If item can be picked up
    itemAnim(item,quantity)
    return true
  else   # Can't add the item
    if item == :LEFTOVERS
    pbMessage(_INTL("{1} found some \\c[1]{2}\\c[0]!\\wtnp[30]", itemname))
    elsif item.is_machine?   # TM or HM
      pbMessage(_INTL("\\l[2]{1} found \\c[1]{2} {3}\\c[0]!\\wtnp[30]", itemname,GameData::Move.get(move).name))
    elsif quantity>1
      pbMessage(_INTL("\\l[2]{1} found {2} \\c[1]{3}\\c[0]!\\wtnp[30]", quantity,itemname))
    elsif itemname.starts_with_vowel?
      pbMessage(_INTL("\\l[2]{1} found an \\c[1]{2}\\c[0]!\\wtnp[30]", itemname))
    else
      pbMessage(_INTL("\\l[2]{1} found a \\c[1]{2}\\c[0]!\\wtnp[30]", itemname))
    end
    pbMessage(_INTL("But your Bag is full..."))
    return false
  end
end

alias :oldBerry :pbPickBerry
def pbPickBerry(berry, qty = 1)
  if !NEWPICKBERRY # Old Animation
    oldBerry(berry,qty)
  else # New Animation
    interp = pbMapInterpreter
    this_event = pbMapInterpreter.get_character(0)
    berryData=interp.getVariable
    berry = GameData::Item.get(berry)
    itemname=(qty>1) ? berry.name_plural : berry.name
    if !$bag.can_add?(berry,qty)
      pbMessage(_INTL("Too bad...\nThe bag is full."))
      return
    end
    $bag.add(berry,qty)
    itemAnim(berry,qty)
    if defined?(NEWBERRYPLANTS) #Compatibility with essentials v18.1
      if NEWBERRYPLANTS
        berryData=[0,nil,0,0,0,0,0,0]
      else
        berryData=[0,nil,false,0,0,0]
      end
    else
      berryData=[0,nil,false,0,0,0]
    end
  this_event = pbMapInterpreter.get_self
  pbSetSelfSwitch(this_event.id, "A", true)
    return true
  end
end
 

StarWolff

Cooltrainer
Member
Joined
Aug 23, 2021
Posts
238
it doesn't work on v21 and v21.1 bcz SpriteWrapper is now BitmapSprite, if anyone finds a way to fix it, I would love to use this plugin
 

AenaonDogsky

Arbiter of Doggos
Member
Joined
Dec 12, 2017
Posts
506
it doesn't work on v21 and v21.1 bcz SpriteWrapper is now BitmapSprite, if anyone finds a way to fix it, I would love to use this plugin

Try this

V21:
Expand Collapse Copy
# BOTW-Like Item Gathering by: Kyu
# Updated to v19 by: Vendily
################################################################################
# How to install:
#   Add Object.png to the Graphics/Pictures folder.
#   Add this script over main.
#
# CREDITS MUST BE GIVEN TO EVERYONE LISTED ON THE POST
################################################################################
# CONSTANTS
################################################################################
NEWPICKBERRY = false # if true, berries will be picked directly with the new anim.
ITEMGETSE = "Voltorb Flip point" # ME that will play after obtaining an item.
################################################################################

if defined?(PluginManager)
  PluginManager.register({
    :name => "BOTW-Like Item Gathering",
    :version => "1.0",
    :credits => "Kyu"
  })
end
 
#UI Object with timer, animation and other relevant data
class UISprite < Sprite
  attr_accessor :scroll
  attr_accessor :timer

  def initialize(x, y, bitmap, viewport)
    super(viewport)
    self.bitmap = bitmap
    self.x = x
    self.y = y
    @scroll = false
    @timer = 0
  end

  def update
    return if self.disposed?
    @timer += 1
    case @timer
    when (0..10)
      self.x += self.bitmap.width/10
    when (100..110)
      self.x -= self.bitmap.width/10
    when 111
      self.dispose
    end
  end
end


class Spriteset_Map
  # Handles all UI objects in order to control their positions on screen, timing
  # and disposal. Acts like a Queue.
  class UIHandler
    def initialize
      @viewport = Viewport.new(0,0,Graphics.width,Graphics.height) # Uses its own viewport to make it compatible with both v16 and v17.
      @viewport.z = 9999
      @sprites = []
    end

    def addSprite(x, y, bitmap)
      @sprites.each{|sprite|
        sprite.scroll = true
      }
      index = @sprites.length
      @sprites[index] = UISprite.new(x, y, bitmap, @viewport)
    end

    def update
      removed = []
      @sprites.each_index{|key|
        sprite = @sprites[key]
        if sprite.scroll
          sprite2 = @sprites[key + 1]
          if sprite.x >= sprite2.x && sprite.x <= sprite2.bitmap.width + sprite2.x
            if sprite.y >= sprite2.y && sprite.y <= sprite2.bitmap.height + sprite2.y + 5
              sprite.y += 5
            end
          else
            sprite.scroll = false
          end
        end
        sprite.update
        if sprite.disposed?
          removed.push(sprite)
        end
      }
   
      removed.each{|sprite|
        @sprites.delete(sprite)
      }
    end
     
    def dispose
      @sprites.each{|sprite|
        if !sprite.disposed?
          sprite.dispose
        end
      }
      @viewport.dispose
    end
  end
 
  alias :disposeOld :dispose
  alias :updateOld :update

  def dispose
    @ui.dispose if @ui
    disposeOld
  end

  def update
    @ui = UIHandler.new if !@ui
    @ui.update
    updateOld
  end

  def ui
    return @ui
  end
end


class Scene_Map
  def addSprite(x, y, bitmap)
    self.spriteset.ui.addSprite(x, y, bitmap)
  end
end


def itemAnim(item,qty)
  bitmap = Bitmap.new("Graphics/Pictures/Object")
  pbSetSystemFont(bitmap)
  base = Color.new(248,248,248)
  shadow = Color.new(72,80,88)
 
  if qty > 1
    textpos = [[_INTL("{1} x{2}",item.name_plural,qty),5,15,false,base,shadow]]
  else
    textpos = [[_INTL("{1}",item.name),5,15,false,base,shadow]]
  end
  pbDrawTextPositions(bitmap,textpos)
 
                                                           
  bitmap.blt(274,5,Bitmap.new(GameData::Item.icon_filename(item.id)),Rect.new(0,0,48,48))
   
  pbSEPlay(ITEMGETSE)
  $scene.addSprite(-bitmap.width,200,bitmap)
end


def pbItemBall(item,quantity=1)
  item = GameData::Item.get(item)
                           
   
  return false if !item || quantity<1
  itemname = (quantity>1) ? item.name_plural : item.name
                         
  if $bag.can_add?(item,quantity)   # If item can be picked up
    itemAnim(item,quantity)
    return true
  else   # Can't add the item
    if item == :LEFTOVERS
    pbMessage(_INTL("{1} found some \\c[1]{2}\\c[0]!\\wtnp[30]",$player.name,itemname))
    elsif item.is_machine?   # TM or HM
      pbMessage(_INTL("\\l[2]{1} found \\c[1]{2} {3}\\c[0]!\\wtnp[30]",$player.name,itemname,GameData::Move.get(move).name))
    elsif quantity>1
      pbMessage(_INTL("\\l[2]{1} found {2} \\c[1]{3}\\c[0]!\\wtnp[30]",$player.name,quantity,itemname))
    elsif itemname.starts_with_vowel?
      pbMessage(_INTL("\\l[2]{1} found an \\c[1]{2}\\c[0]!\\wtnp[30]",$player.name,itemname))
    else
      pbMessage(_INTL("\\l[2]{1} found a \\c[1]{2}\\c[0]!\\wtnp[30]",$player.name,itemname))
    end
    pbMessage(_INTL("But your Bag is full..."))
    return false
  end
end

                                   
                             
                                 
 

alias :oldBerry :pbPickBerry
def pbPickBerry(berry,qty=1)
  if !NEWPICKBERRY # Old Animation
    oldBerry(berry,qty)
  else # New Animation
    interp=pbMapInterpreter
    thisEvent=interp.get_character(0)
    berryData=interp.getVariable
    berry=GameData::Item.get(berry)
                               
     
    itemname=(qty>1) ? berry.name_plural : berry.name
    if $bag.can_add?(berry,qty)
      pbMessage(_INTL("Too bad...\nThe bag is full."))
      return
    end
    $bag.add?(berry,qty)
                           
    itemAnim(berry,qty)
    if defined?(NEWBERRYPLANTS) #Compatibility with essentials v18.1
      if NEWBERRYPLANTS
        berryData=[0,nil,0,0,0,0,0,0]
      else
        berryData=[0,nil,false,0,0,0]
      end
    else
      berryData=[0,nil,false,0,0,0]
    end
    interp.setVariable(berryData)
    pbSetSelfSwitch(thisEvent.id,"A",true)
  end
end

I don't remember what I did here, been a while, but it works on 21 for me. Lemme know
 

StarWolff

Cooltrainer
Member
Joined
Aug 23, 2021
Posts
238
Try this

V21:
Expand Collapse Copy
# BOTW-Like Item Gathering by: Kyu
# Updated to v19 by: Vendily
################################################################################
# How to install:
#   Add Object.png to the Graphics/Pictures folder.
#   Add this script over main.
#
# CREDITS MUST BE GIVEN TO EVERYONE LISTED ON THE POST
################################################################################
# CONSTANTS
################################################################################
NEWPICKBERRY = false # if true, berries will be picked directly with the new anim.
ITEMGETSE = "Voltorb Flip point" # ME that will play after obtaining an item.
################################################################################

if defined?(PluginManager)
  PluginManager.register({
    :name => "BOTW-Like Item Gathering",
    :version => "1.0",
    :credits => "Kyu"
  })
end
 
#UI Object with timer, animation and other relevant data
class UISprite < Sprite
  attr_accessor :scroll
  attr_accessor :timer

  def initialize(x, y, bitmap, viewport)
    super(viewport)
    self.bitmap = bitmap
    self.x = x
    self.y = y
    @scroll = false
    @timer = 0
  end

  def update
    return if self.disposed?
    @timer += 1
    case @timer
    when (0..10)
      self.x += self.bitmap.width/10
    when (100..110)
      self.x -= self.bitmap.width/10
    when 111
      self.dispose
    end
  end
end


class Spriteset_Map
  # Handles all UI objects in order to control their positions on screen, timing
  # and disposal. Acts like a Queue.
  class UIHandler
    def initialize
      @viewport = Viewport.new(0,0,Graphics.width,Graphics.height) # Uses its own viewport to make it compatible with both v16 and v17.
      @viewport.z = 9999
      @sprites = []
    end

    def addSprite(x, y, bitmap)
      @sprites.each{|sprite|
        sprite.scroll = true
      }
      index = @sprites.length
      @sprites[index] = UISprite.new(x, y, bitmap, @viewport)
    end

    def update
      removed = []
      @sprites.each_index{|key|
        sprite = @sprites[key]
        if sprite.scroll
          sprite2 = @sprites[key + 1]
          if sprite.x >= sprite2.x && sprite.x <= sprite2.bitmap.width + sprite2.x
            if sprite.y >= sprite2.y && sprite.y <= sprite2.bitmap.height + sprite2.y + 5
              sprite.y += 5
            end
          else
            sprite.scroll = false
          end
        end
        sprite.update
        if sprite.disposed?
          removed.push(sprite)
        end
      }
  
      removed.each{|sprite|
        @sprites.delete(sprite)
      }
    end
    
    def dispose
      @sprites.each{|sprite|
        if !sprite.disposed?
          sprite.dispose
        end
      }
      @viewport.dispose
    end
  end
 
  alias :disposeOld :dispose
  alias :updateOld :update

  def dispose
    @ui.dispose if @ui
    disposeOld
  end

  def update
    @ui = UIHandler.new if !@ui
    @ui.update
    updateOld
  end

  def ui
    return @ui
  end
end


class Scene_Map
  def addSprite(x, y, bitmap)
    self.spriteset.ui.addSprite(x, y, bitmap)
  end
end


def itemAnim(item,qty)
  bitmap = Bitmap.new("Graphics/Pictures/Object")
  pbSetSystemFont(bitmap)
  base = Color.new(248,248,248)
  shadow = Color.new(72,80,88)
 
  if qty > 1
    textpos = [[_INTL("{1} x{2}",item.name_plural,qty),5,15,false,base,shadow]]
  else
    textpos = [[_INTL("{1}",item.name),5,15,false,base,shadow]]
  end
  pbDrawTextPositions(bitmap,textpos)
 
                                                          
  bitmap.blt(274,5,Bitmap.new(GameData::Item.icon_filename(item.id)),Rect.new(0,0,48,48))
  
  pbSEPlay(ITEMGETSE)
  $scene.addSprite(-bitmap.width,200,bitmap)
end


def pbItemBall(item,quantity=1)
  item = GameData::Item.get(item)
                          
  
  return false if !item || quantity<1
  itemname = (quantity>1) ? item.name_plural : item.name
                        
  if $bag.can_add?(item,quantity)   # If item can be picked up
    itemAnim(item,quantity)
    return true
  else   # Can't add the item
    if item == :LEFTOVERS
    pbMessage(_INTL("{1} found some \\c[1]{2}\\c[0]!\\wtnp[30]",$player.name,itemname))
    elsif item.is_machine?   # TM or HM
      pbMessage(_INTL("\\l[2]{1} found \\c[1]{2} {3}\\c[0]!\\wtnp[30]",$player.name,itemname,GameData::Move.get(move).name))
    elsif quantity>1
      pbMessage(_INTL("\\l[2]{1} found {2} \\c[1]{3}\\c[0]!\\wtnp[30]",$player.name,quantity,itemname))
    elsif itemname.starts_with_vowel?
      pbMessage(_INTL("\\l[2]{1} found an \\c[1]{2}\\c[0]!\\wtnp[30]",$player.name,itemname))
    else
      pbMessage(_INTL("\\l[2]{1} found a \\c[1]{2}\\c[0]!\\wtnp[30]",$player.name,itemname))
    end
    pbMessage(_INTL("But your Bag is full..."))
    return false
  end
end

                                  
                            
                                
 

alias :oldBerry :pbPickBerry
def pbPickBerry(berry,qty=1)
  if !NEWPICKBERRY # Old Animation
    oldBerry(berry,qty)
  else # New Animation
    interp=pbMapInterpreter
    thisEvent=interp.get_character(0)
    berryData=interp.getVariable
    berry=GameData::Item.get(berry)
                              
    
    itemname=(qty>1) ? berry.name_plural : berry.name
    if $bag.can_add?(berry,qty)
      pbMessage(_INTL("Too bad...\nThe bag is full."))
      return
    end
    $bag.add?(berry,qty)
                          
    itemAnim(berry,qty)
    if defined?(NEWBERRYPLANTS) #Compatibility with essentials v18.1
      if NEWBERRYPLANTS
        berryData=[0,nil,0,0,0,0,0,0]
      else
        berryData=[0,nil,false,0,0,0]
      end
    else
      berryData=[0,nil,false,0,0,0]
    end
    interp.setVariable(berryData)
    pbSetSelfSwitch(thisEvent.id,"A",true)
  end
end

I don't remember what I did here, been a while, but it works on 21 for me. Lemme know
Only now I've noticed a fatal error in the code, tho the item gather appears on the screen, nothing enters the bag , the player didn't really picked any item
 

AenaonDogsky

Arbiter of Doggos
Member
Joined
Dec 12, 2017
Posts
506
Only now I've noticed a fatal error in the code, tho the item gather appears on the screen, nothing enters the bag , the player didn't really picked any item
I cant look at it atm, but it's likely that you'd only need to replace the function that adds the actual item with the new one from v21, if that's the case.
 

AenaonDogsky

Arbiter of Doggos
Member
Joined
Dec 12, 2017
Posts
506
Only now I've noticed a fatal error in the code, tho the item gather appears on the screen, nothing enters the bag , the player didn't really picked any item
Alright, I am really dumb, here is what you need to do. Still haven't done anything meaningful with the berries though:

replace lines 154 to 179 completely with this


Properly adding the item to bag with the animation:
Expand Collapse Copy
def pbItemBall(item, quantity = 1)
  item = GameData::Item.get(item)
  return false if !item || quantity < 1
  itemname = (quantity > 1) ? item.portion_name_plural : item.portion_name
  pocket = item.pocket
  move = item.move
  itemAnim(item,quantity)
  if $bag.add(item, quantity)   # If item can be picked up
    return true
  # Can't add the item
  else
  pbMessage(_INTL("But your Bag is full..."))
  return false
  end
end
 
Back
Top