#Not Important
All hail the wishmaker
- 910
- Posts
- 5
- Years
- He/Him
- Hoenn
- Seen Jul 22, 2023
So, I am creating a script for a Berry Tree From Galar
It is this (It doesn't work yet) :
And it gives this error:
If I remove the 'berry' part of giving the items it gives this error:
Which is:
Pls help
It is this (It doesn't work yet) :
Code:
################################################################################
# #
# Berry Tree From Galar Script #
# By #Not Imortant #
# For Essentials v17.2 #
# v 1.0.0 #
# #
################################################################################
=begin
USAGE:
Call with pbBerry tree
Remember to credit me!
=end
#Cherubi is added by default
#Change this to "true" give encounters for:
#Skwovet and Greedent
#Set to "false" if you don't have the Gen 8 PBS files
GEN8ENCOUNTERS = true
#In turn, switch this to the opposite of that
NOGEN8ENCOUNTERS = false
=begin
Set this to true to add:
Bellsprout
Pidgey
Spearow
Applin (But only with Gen 8)
Burmy (But no Gen 8 only)
To the encounters available from tree-shaking
=end
REMADEENCOUNTERS = false
#Same here as before
REGULARENCOUNTERS = true
#If you don't want new encounters or Gen 8, you'll be left with Cherubi ...
#DONT TOUCH
DONTTOUCH = true
################################################################################
# Here I define the Script #
################################################################################
def pbshake
if DONTTOUCH
if DONTTOUCH
result=rand(10)
if result = 1
Kernel.pbReceiveItem(berry,PBItems,:ORANBERRY) #Gives oran berry
Kernel.pbMessage("There are berries on the ground, keep shaking?")
loop do
command=Kernel.pbShowCommands(nil,[
_INTL("Yes"),
_INTL("No")
],command)
case command
when 0
when 1
break
end
end
if result = 2
Kernel.pbReceiveItem(berry,PBItems,:ORANBERRY,2) #Gives two oran berries
Kernel.pbMessage("There are berries on the ground, keep shaking?")
loop do
command=Kernel.pbShowCommands(nil,[
_INTL("Yes"),
_INTL("No")
],command)
case command
when 0
when 1
break
end
end
end
if result = 3
Kernel.pbReceiveItem(berry,PBItems,:ORANBERRY,3) #You get it now
Kernel.pbMessage("There are berries on the ground, keep shaking?")
loop do
command=Kernel.pbShowCommands(nil,[
_INTL("Yes"),
_INTL("No")
],command)
case command
when 0
when 1
break
end
end
end
if result = 4
Kernel.pbReceiveItem(berry,PBItems,:PECHABERRY) #Same but with pecha berries
Kernel.pbMessage("There are berries on the ground, keep shaking?")
loop do
command=Kernel.pbShowCommands(nil,[
_INTL("Yes"),
_INTL("No")
],command)
case command
when 0
when 1
break
end
end
end
if result = 5
Kernel.pbReceiveItem(berry,PBItems,:PECHABERRY,2) #...
Kernel.pbMessage("There are berries on the ground, keep shaking?")
loop do
command=Kernel.pbShowCommands(nil,[
_INTL("Yes"),
_INTL("No")
],command)
case command
when 0
when 1
break
end
end
end
if result = 6
Kernel.pbReceiveItem(berry,PBItems,:PECHABERRY,3)
Kernel.pbMessage("There are berries on the ground, keep shaking?")
loop do
command=Kernel.pbShowCommands(nil,[
_INTL("Yes"),
_INTL("No")
],command)
case command
when 0
when 1
break
end
end
end
if result = 7
Kernel.pbReceiveItem(berry,PBItems,:CHERIBERRY)
Kernel.pbMessage("There are berries on the ground, keep shaking?")
loop do
command=Kernel.pbShowCommands(nil,[
_INTL("Yes"),
_INTL("No")
],command)
case command
when 0
when 1
break
end
end
end
if result = 8
Kernel.pbReceiveItem(berry,PBItems,:CHERIBERRY,2)
Kernel.pbMessage("There are berries on the ground, keep shaking?")
loop do
command=Kernel.pbShowCommands(nil,[
_INTL("Yes"),
_INTL("No")
],command)
case command
when 0
when 1
break
end
end
end
if result = 9
Kernel.pbReceiveItem(berry,PBItems,:CHERIBERRY,3)
Kernel.pbMessage("There are berries on the ground, keep shaking?")
loop do
command=Kernel.pbShowCommands(nil,[
_INTL("Yes"),
_INTL("No")
],command)
case command
when 0
when 1
break
end
end
end
if result = 10 #Encounters 1/10 of the time
if GEN8ENCOUNTERS #Gives encounters if remade & gen 8 are on
if REMADEENCOUNTERS
encounter=rand(7) #I mean you could also randomize the levels
if encounter = 1 #But I think it could lag the game
pbWildBattle(CHERUBI,7,1)
end
if encounter = 2
pbWildBattle(SKWOVET,7,1)
end
if encounter = 3
pbWildBattle(GREEDUNT,7,1)
end
if encounter = 4
pbWildBattle(BELLSPROUT,7,1)
end
if encounter = 5
pbWildBattle(PIDGEY,7,1)
end
if encounter = 6
pbWildBattle(SPEAROW,7,1)
end
if encounter = 7
pbWildBattle(APPLIN,7,1)
end
end
end
if GEN8ENCOUNTERS && REGULARENCOUNTERS #Gives the regular encounters for Galar
encounter=rand(3)
if encounter = 1 #I created my username because what you put a
pbWildBattle(CHERUBI,7,1)#hashtag in front of is
end #Not Important in Ruby
if encounter = 2
pbWildBattle(SKWOVET,7,1)
end
if encounter = 3
pbWildBattle(GREEDUNT,7,1)
end
end
if NOGEN8ENCOUNTERS && REMADEENCOUNTERS
encounter=rand(5)
if encounter = 1
pbWildBattle(CHERUBI,7,1)
end
if encounter = 2
pbWildBattle(BELLSPROUT,7,1)
end
if encounter = 3
pbWildBattle(PIDGEY,7,1)
end
if encounter = 4
pbWildBattle(SPEAROW,7,1)
end
if encounter = 5
pbWildBattle(BURMY,7,1)
end
end
else
pbWildBattle(CHERUBI,7,1)
end
Kernel.pbMessage("Other pokemon took the berries left on the tree away...")
end
end
end
end
def pbTreeOfBerries
for i in 0...16
if i = 1
pbshake
end
if i = 2
pbshake
end
if i = 3
pbshake
end
if i = 4
pbshake
end
if i = 5
pbshake
end
if i = 6
pbshake
end
if i = 7
pbshake
end
if i = 8
pbshake
end
if i = 9
pbshake
end
if i = 10
pbshake
end
if i = 11
pbshake
end
if i = 12
pbshake
end
if i = 13
pbshake
end
if i = 14
pbshake
end
if i = 15
pbshake
end
end
end
Code:
---------------------------
Pokemon Meteor
---------------------------
Script 'Berrytree' line 46: NameError occurred.
undefined local variable or method `berry' for nil:NilClass
---------------------------
OK
---------------------------
Code:
---------------------------
Pokemon Metal Might
---------------------------
Script 'PField_Field' line 1406: TypeError occurred.
compared with non class/module
---------------------------
OK
---------------------------
Code:
return false if !item || item<=0 || quantity<1
itemname = (quantity>1) ? PBItems.getNamePlural(item) : PBItems.getName(item)
pocket = pbGetPocket(item)
if isConst?(item,PBItems,:LEFTOVERS)
Kernel.pbMessage(_INTL("\\me[Item get]You obtained some \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
elsif pbIsMachine?(item) # TM or HM
Kernel.pbMessage(_INTL("\\me[Item get]You obtained \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,PBMoves.getName(pbGetMachine(item))))
elsif quantity>1
Kernel.pbMessage(_INTL("\\me[Item get]You obtained {1} \\c[1]{2}\\c[0]!\\wtnp[30]",quantity,itemname))
elsif ['a','e','i','o','u'].include?(itemname[0,1].downcase)
Kernel.pbMessage(_INTL("\\me[Item get]You obtained an \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
else
Kernel.pbMessage(_INTL("\\me[Item get]You obtained a \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
end
if $PokemonBag.pbStoreItem(item,quantity) # If item can be added
Kernel.pbMessage(_INTL("You put the {1} away\\nin the <icon=bagPocket{2}>\\c[1]{3} Pocket\\c[0].",
itemname,pocket,PokemonBag.pocketNames()[pocket]))
return true
end
return false # Can't add the item
end