Mass Berry Picker Script (v19/v18)

Mass Berry Picker Script (v19/v18)

Pokémon Essentials Version
v19 ✅
Hey there!
This is a simple script which allows the player to pick all the berries in a map at the same time, so they don't have to go around picking each one, one berry tree at a time.
You can see this script in action in @Turner's fangame, Pokémon Champions, which is what I originally made this for.

All you need to do is put the script in a new section above main, and call it in an event using pbMassBerryPicker(num1,num2,map) where num1 is the lowest ID of all the berry tree events, num2 is the highest ID of all the berry tree events, and map is the ID of the map where the berries are (if map is left blank, it will use the ID of the map where the player currently is).

Script:
################################################################################
# Mass Berry Picker Script by:
# - PurpleZaffre
# Please give credits when using this.
################################################################################

if defined?(PluginManager)
  PluginManager.register({
    :name => "Mass Berry Picker Script",
    :version => "1.0",
    :credits => "PurpleZaffre",
  })
end

# num1 : lowest ID of all the berry tree events
# num2 : highest ID of all the berry tree events
# map  : ID of the map where the berries are (if left blank, the ID of the map
# where the player currently is will be used)
def pbMassBerryPicker(num1,num2,map=nil)
  map = $game_map.map_id if map == nil
  harvestedBerries = false
  for i in num1..num2
    berryData = $PokemonGlobal.eventvars[[map,i]]
    if berryData
      berryToReceive=berryData[1]
      if berryData[0] == 5
        berryvalues=pbGetBerryPlantData(berryData[1])
        berrycount=1
        if berryData.length>6
          berrycount=[berryvalues[3]-berryData[6],berryvalues[2]].max
        else
          if berryData[4]>0
            randomno=rand(1+berryvalues[3]-berryvalues[2])
            berrycount=(((berryvalues[3]-berryvalues[2])*(berryData[4]-1)+randomno)/4).floor+berryvalues[2]
          else
            berrycount=berryvalues[2]
          end
        end
        $PokemonBag.pbStoreItem(berryToReceive,berrycount)
        harvestedBerries = true
        $PokemonGlobal.eventvars[[map,i]][0]=0
        $game_map.refresh
        pbWait(1)
        $PokemonGlobal.eventvars[[map,i]]=nil
        $game_map.refresh
        pbWait(1)
        if NEW_BERRY_PLANTS
          berryData=[0,0,0,0,0,0,0,0]
        else
          berryData=[0,0,false,0,0,0]
        end
      end
    end
  end
# Change these messages to whatever you want
  if harvestedBerries == true
    pbMessage(_INTL("\\me[Item get]\\PN got some berries!\\wtnp[30]"))
  else
    pbMessage(_INTL("There are no berries to pick right now."))
  end
end

This script was originally made for v18, but I tested it briefly in v19 too and it seemed to work normally.

Please do not redistribute this anywhere else.
Credits
PurpleZaffre
Author
PurpleZaffre
Views
284
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from PurpleZaffre

Top