Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Reload this Page [Essentials tutorial] Gen II Berries

Notices
For all updates, view the main page.

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.



Reply
 
Thread Tools
  #1    
Old June 29th, 2013 (05:54 PM). Edited June 29th, 2013 by Pia Carrot.
Pia Carrot's Avatar
Pia Carrot Pia Carrot is offline
Gen II Hacker | PHO Enthusiast
 
Join Date: Aug 2010
Age: 19
Gender: Male
Nature: Adamant
Posts: 559
Quick Edit: I am not sure if editing how the Mystery Berry heals PP will affect Ether. It may need to be defined separately. Sorry if it messes with it, I didn't think about it. If you want to make it 10 again, go to PokeBattle_Battler and find "pokemove.pp=5" change the 5 to 10.

Hello again PC, I'm just feeling nice today so I've decided to release my Generation II berries. This will simply replace a few berries in your items.txt and I have also included the PBS files for Pokemon that have these berries in the wild. If a trainer has a berry that Essentials does not recognize, it WILL let you know, do just open up Trainers.txt and replace any berries (by default there's a trainer with Sitrus Berry, replace it with Gold Berry). It's a lot of script editing due to the item name changes, but it's good practice for those who want to do something similar. Without further ado, here we go:

First off, go into your items.txt go to line 389. Now, replace lines 389 through 398 with this:
Code:
389,PRZCUREBERRY,PrzCureBerry,5,20,A self-cure for paralysis. (HOLD),1,1,1,
390,MINTBERRY,Mint Berry,5,20,A self-awakening for sleep. (HOLD),1,1,1,
391,PSNCUREBERRY,PsnCureBerry,5,20,A self-cure for poison. (HOLD),1,1,1,
392,ICEBERRY,Ice Berry,5,20,A self-heal for a burn. (HOLD),1,1,1,
393,BURNTBERRY,Burnt Berry,5,20,A self-cure for freezing. (HOLD),1,1,1,
394,MYSTERYBERRY,MysteryBerry,5,20,A self-restore for PP. (HOLD),1,1,1,
395,BERRY,Berry,5,20,"A self-restore item. (10HP, HOLD)",1,1,1,
396,BITTERBERRY,Bitter Berry,5,20,A self-cure for confusion. (HOLD),0,1,1,
397,MIRACLEBERRY,MiracleBerry,5,20,Eliminates all status problems.,1,1,1,
398,GOLDBERRY,Gold Berry,5,20,"A self-restore item. (30HP, HOLD)",1,1,1,
Now, replace your Pokemon.txt with this: https://www.dropbox.com/s/hvenh8cog0hxzzo/pokemon.txt
If you have a custom Pokedex, you'll have to replace them manually. I suggest Notepad++

Now to make them work ingame.
First, go to the script PokeBattle_Battler, line 1044.

Replace 1044-1141 with this:
Code:
        if isConst?(self.item,PBItems,:BERRY) && self.hp<=(self.totalhp/2).floor
          self.pbRecoverHP(10,true)
          @battle.pbDisplay(_INTL("{1}'s {2} restored health!",pbThis,itemname))   
          @pokemon.itemRecycle=self.item
          @pokemon.itemInitial=0 if @pokemon.itemInitial==self.item
          self.item=0
        end
        if isConst?(self.item,PBItems,:GOLDBERRY) && self.hp<=(self.totalhp/2).floor
          self.pbRecoverHP((self.totalhp/4).floor,true)
          @battle.pbDisplay(_INTL("{1}'s {2} restored health!",pbThis,itemname))   
          @pokemon.itemRecycle=self.item
          @pokemon.itemInitial=0 if @pokemon.itemInitial==self.item
          self.item=0
        end
      end
      if isConst?(self.item,PBItems,:PRZCUREBERRY) && self.status==PBStatuses::PARALYSIS
        self.status=0
        @battle.pbDisplay(_INTL("{1}'s {2} cured its paralysis problem!",pbThis,itemname))
        @pokemon.itemRecycle=self.item
        @pokemon.itemInitial=0 if @pokemon.itemInitial==self.item
        self.item=0
      end
      if isConst?(self.item,PBItems,:MINTBERRY) && self.status==PBStatuses::SLEEP
        self.status=0
        @battle.pbDisplay(_INTL("{1}'s {2} cured its sleep problem!",pbThis,itemname))
        @pokemon.itemRecycle=self.item
        @pokemon.itemInitial=0 if @pokemon.itemInitial==self.item
        self.item=0
      end
      if isConst?(self.item,PBItems,:PSNCUREBERRY) && self.status==PBStatuses::POISON
        self.status=0
        @battle.pbDisplay(_INTL("{1}'s {2} cured its poison problem!",pbThis,itemname))
        @pokemon.itemRecycle=self.item
        @pokemon.itemInitial=0 if @pokemon.itemInitial==self.item
        self.item=0
      end
      if isConst?(self.item,PBItems,:ICEBERRY) && self.status==PBStatuses::BURN
        self.status=0
        @battle.pbDisplay(_INTL("{1}'s {2} cured its burn problem!",pbThis,itemname))
        @pokemon.itemRecycle=self.item
        @pokemon.itemInitial=0 if @pokemon.itemInitial==self.item
        self.item=0
      end
      if isConst?(self.item,PBItems,:BURNTBERRY) && self.status==PBStatuses::FROZEN
        self.status=0
        @battle.pbDisplay(_INTL("{1}'s {2} cured its ice problem!",pbThis,itemname))
        @pokemon.itemRecycle=self.item
        @pokemon.itemInitial=0 if @pokemon.itemInitial==self.item
        self.item=0
      end
      if hpcure && isConst?(self.item,PBItems,:MYSTERYBERRY)
        for i in 0...@pokemon.moves.length
          pokemove=@pokemon.moves[i]
          battlermove=self.moves[i]
          if pokemove.pp==0 && pokemove.id!=0
            movename=PBMoves.getName(pokemove.id)
            pokemove.pp=5
            pokemove.pp=pokemove.totalpp if pokemove.pp>pokemove.totalpp 
            battlermove.pp=pokemove.pp
            @battle.pbDisplay(_INTL("{1}'s {2} restored {3}'s PP!",pbThis,itemname,movename)) 
            @pokemon.itemRecycle=self.item
            @pokemon.itemInitial=0 if @pokemon.itemInitial==self.item
            self.item=0
            break
          end
        end
      end
      if isConst?(self.item,PBItems,:BITTERBERRY) && @effects[PBEffects::Confusion]>0
        @effects[PBEffects::Confusion]=0
        @battle.pbDisplay(_INTL("{1}'s {2} cured its confusion problem!",pbThis,itemname))
        @pokemon.itemRecycle=self.item
        @pokemon.itemInitial=0 if @pokemon.itemInitial==self.item
        self.item=0
      end
      if isConst?(self.item,PBItems,:MIRACLEBERRY) && (self.status>0 || @effects[PBEffects::Confusion]>0)
        st=self.status; conf=@effects[PBEffects::Confusion]
        self.status=0
        @effects[PBEffects::Confusion]=0
        if conf
          @battle.pbDisplay(_INTL("{1}'s {2} cured its confusion problem!",pbThis,itemname))
        else
          case st
            when PBStatuses::PARALYSIS
              @battle.pbDisplay(_INTL("{1}'s {2} cured its paralysis problem!",pbThis,itemname))
            when PBStatuses::SLEEP
              @battle.pbDisplay(_INTL("{1}'s {2} cured its sleep problem!",pbThis,itemname))
            when PBStatuses::POISON
             @battle.pbDisplay(_INTL("{1}'s {2} cured its poison problem!",pbThis,itemname))
            when PBStatuses::BURN
              @battle.pbDisplay(_INTL("{1}'s {2} cured its burn problem!",pbThis,itemname))
            when PBStatuses::FROZEN
              @battle.pbDisplay(_INTL("{1}'s {2} cured its frozen problem!",pbThis,itemname))
          end
        end
        @pokemon.itemRecycle=self.item
        @pokemon.itemInitial=0 if @pokemon.itemInitial==self.item
        self.item=0
      end
This will make it so that berries will work correctly, and Mystery Berries will heal 5 PP.


Now we go to PokeBattle_MoveEffects at line 3532. We will replace this:
Spoiler:
Code:
  def pbBaseDamage(basedmg,attacker,opponent)
    damagearray={
       60 => [:CHERIBERRY,:CHESTOBERRY,:PECHABERRY,:RAWSTBERRY,:ASPEARBERRY,
              :LEPPABERRY,:ORANBERRY,:PERSIMBERRY,:LUMBERRY,:SITRUSBERRY,
              :FIGYBERRY,:WIKIBERRY,:MAGOBERRY,:AGUAVBERRY,:IAPAPABERRY,
              :RAZZBERRY,:OCCABERRY,:PASSHOBERRY,:WACANBERRY,:RINDOBERRY,
              :YACHEBERRY,:CHOPLEBERRY,:KEBIABERRY,:SHUCABERRY,:COBABERRY,
              :PAYAPABERRY,:TANGABERRY,:CHARTIBERRY,:KASIBBERRY,:HABANBERRY,
              :COLBURBERRY,:BABIRIBERRY,:CHILANBERRY],
       70 => [:BLUKBERRY,:NANABBERRY,:WEPEARBERRY,:PINAPBERRY,:POMEGBERRY,
              :KELPSYBERRY,:QUALOTBERRY,:HONDEWBERRY,:GREPABERRY,:TAMATOBERRY,
              :CORNNBERRY,:MAGOSTBERRY,:RABUTABERRY,:NOMELBERRY,:SPELONBERRY,
              :PAMTREBERRY],
       80 => [:WATMELBERRY,:DURINBERRY,:BELUEBERRY,:LIECHIBERRY,:GANLONBERRY,
              :SALACBERRY,:PETAYABERRY,:APICOTBERRY,:LANSATBERRY,:STARFBERRY,
              :ENIGMABERRY,:MICLEBERRY,:CUSTAPBERRY,:JACOBABERRY,:ROWAPBERRY]
    }


With this:

Code:
  def pbBaseDamage(basedmg,attacker,opponent)
    damagearray={
       60 => [:PSNCUREBERRY,:MINTBERRY,:PRZCUREBERRY,:ICEBERRY,:BURNTBERRY,
              :MYSTERYBERRY,:BERRY,:BITTERBERRY,:MIRACLEBERRY,:GOLDBERRY,
              :FIGYBERRY,:WIKIBERRY,:MAGOBERRY,:AGUAVBERRY,:IAPAPABERRY,
              :RAZZBERRY,:OCCABERRY,:PASSHOBERRY,:WACANBERRY,:RINDOBERRY,
              :YACHEBERRY,:CHOPLEBERRY,:KEBIABERRY,:SHUCABERRY,:COBABERRY,
              :PAYAPABERRY,:TANGABERRY,:CHARTIBERRY,:KASIBBERRY,:HABANBERRY,
              :COLBURBERRY,:BABIRIBERRY,:CHILANBERRY],
       70 => [:BLUKBERRY,:NANABBERRY,:WEPEARBERRY,:PINAPBERRY,:POMEGBERRY,
              :KELPSYBERRY,:QUALOTBERRY,:HONDEWBERRY,:GREPABERRY,:TAMATOBERRY,
              :CORNNBERRY,:MAGOSTBERRY,:RABUTABERRY,:NOMELBERRY,:SPELONBERRY,
              :PAMTREBERRY],
       80 => [:WATMELBERRY,:DURINBERRY,:BELUEBERRY,:LIECHIBERRY,:GANLONBERRY,
              :SALACBERRY,:PETAYABERRY,:APICOTBERRY,:LANSATBERRY,:STARFBERRY,
              :ENIGMABERRY,:MICLEBERRY,:CUSTAPBERRY,:JACOBABERRY,:ROWAPBERRY]
    }
Just a little under that at line 3560-3579, replace with this:
Spoiler:
Code:
  def pbType(type,attacker,opponent)
    typearray={
       :NORMAL   => [:CHILANBERRY],
       :FIRE     => [:PRZCUREBERRY,:BLUKBERRY,:WATMELBERRY,:OCCABERRY],
       :WATER    => [:MINTBERRY,:NANABBERRY,:DURINBERRY,:PASSHOBERRY],
       :ELECTRIC => [:PSNCUREBERRY,:WEPEARBERRY,:BELUEBERRY,:WACANBERRY],
       :GRASS    => [:ICEBERRY,:PINAPBERRY,:RINDOBERRY,:LIECHIBERRY],
       :ICE      => [:BURNTBERRY,:POMEGBERRY,:YACHEBERRY,:GANLONBERRY],
       :FIGHTING => [:MYSTERYBERRY,:KELPSYBERRY,:CHOPLEBERRY,:SALACBERRY],
       :POISON   => [:BERRY,:QUALOTBERRY,:KEBIABERRY,:PETAYABERRY],
       :GROUND   => [:BITTERBERRY,:HONDEWBERRY,:SHUCABERRY,:APICOTBERRY],
       :FLYING   => [:MIRACLEBERRY,:GREPABERRY,:COBABERRY,:LANSATBERRY],
       :PSYCHIC  => [:GOLDBERRY,:TAMATOBERRY,:PAYAPABERRY,:STARFBERRY],
       :BUG      => [:FIGYBERRY,:CORNNBERRY,:TANGABERRY,:ENIGMABERRY],
       :ROCK     => [:WIKIBERRY,:MAGOSTBERRY,:CHARTIBERRY,:MICLEBERRY],
       :GHOST    => [:MAGOBERRY,:RABUTABERRY,:KASIBBERRY,:CUSTAPBERRY],
       :DRAGON   => [:AGUAVBERRY,:NOMELBERRY,:HABANBERRY,:JACOBABERRY],
       :DARK     => [:IAPAPABERRY,:SPELONBERRY,:COLBURBERRY,:ROWAPBERRY],
       :STEEL    => [:RAZZBERRY,:PAMTREBERRY,:BABIRIBERRY]
    }


Now, we need to fix berry plants.

In the script PokemonBerryPlants, on line 14 you will be replacing everything from class to the last berry array (right before "Replants=9")

Spoiler:
Code:
class BerryPlantSprite
  # Berry, hours per stage, min yield, max yield, plural
  BERRYVALUES=[[:PRZCUREBERRY,3,2,5,_INTL("PrzCureBerries")],
               [:MINTBERRY,3,2,5,_INTL("Mint Berries")],
               [:PSNCUREBERRY,3,2,5,_INTL("PsnCureBerries")],
               [:ICEBERRY,3,2,5,_INTL("Ice Berries")],
               [:BURNTBERRY,3,2,5,_INTL("Burnt Berries")],
               [:MYSTERYBERRY,4,2,5,_INTL("MysteryBerries")],
               [:BERRY,4,2,5,_INTL("Berries")],
               [:BITTERBERRY,4,2,5,_INTL("Bitter Berries")],
               [:MIRACLEBERRY,12,2,5,_INTL("MiracleBerries")],
               [:GOLDBERRY,8,2,5,_INTL("Gold Berries")],
               [:FIGYBERRY,5,1,5,_INTL("Figy Berries")],
               [:WIKIBERRY,5,1,5,_INTL("Wiki Berries")],
               [:MAGOBERRY,5,1,5,_INTL("Mago Berries")],
               [:AGUAVBERRY,5,1,5,_INTL("Aguav Berries")],
               [:IAPAPABERRY,5,1,5,_INTL("Iapapa Berries")],
               [:RAZZBERRY,2,2,10,_INTL("Razz Berries")],
               [:BLUKBERRY,2,2,10,_INTL("Bluk Berries")],
               [:NANABBERRY,2,2,10,_INTL("Nanab Berries")],
               [:WEPEARBERRY,2,2,10,_INTL("Wepear Berries")],
               [:PINAPBERRY,2,2,10,_INTL("Pinap Berries")],
               [:POMEGBERRY,8,1,5,_INTL("Pomeg Berries")],
               [:KELPSYBERRY,8,1,5,_INTL("Kelpsy Berries")],
               [:QUALOTBERRY,8,1,5,_INTL("Qualot Berries")],
               [:HONDEWBERRY,8,1,5,_INTL("Hondew Berries")],
               [:GREPABERRY,8,1,5,_INTL("Grepa Berries")],
               [:TAMATOBERRY,8,1,5,_INTL("Tamato Berries")],
               [:CORNNBERRY,8,2,10,_INTL("Cornn Berries")],
               [:MAGOSTBERRY,6,2,10,_INTL("Magost Berries")],
               [:RABUTABERRY,6,2,10,_INTL("Rabuta Berries")],
               [:NOMELBERRY,6,2,10,_INTL("Nomel Berries")],
               [:SPELONBERRY,15,2,15,_INTL("Spelon Berries")],
               [:PAMTREBERRY,15,3,15,_INTL("Pamtre Berries")],
               [:WATMELBERRY,15,2,15,_INTL("Watmel Berries")],
               [:DURINBERRY,15,3,15,_INTL("Durin Berries")],
               [:BELUEBERRY,15,2,15,_INTL("Belue Berries")],
               [:OCCABERRY,18,1,5,_INTL("Occa Berries")],
               [:PASSHOBERRY,18,1,5,_INTL("Passho Berries")],
               [:WACANBERRY,18,1,5,_INTL("Wacan Berries")],
               [:RINDOBERRY,18,1,5,_INTL("Rindo Berries")],
               [:YACHEBERRY,18,1,5,_INTL("Yache Berries")],
               [:CHOPLEBERRY,18,1,5,_INTL("Chople Berries")],
               [:KEBIABERRY,18,1,5,_INTL("Kebia Berries")],
               [:SHUCABERRY,18,1,5,_INTL("Shuca Berries")],
               [:COBABERRY,18,1,5,_INTL("Coba Berries")],
               [:PAYAPABERRY,18,1,5,_INTL("Payapa Berries")],
               [:TANGABERRY,18,1,5,_INTL("Tanga Berries")],
               [:CHARTIBERRY,18,1,5,_INTL("Charti Berries")],
               [:KASIBBERRY,18,1,5,_INTL("Kasib Berries")],
               [:HABANBERRY,18,1,5,_INTL("Haban Berries")],
               [:COLBURBERRY,18,1,5,_INTL("Colbur Berries")],
               [:BABIRIBERRY,18,1,5,_INTL("Babiri Berries")],
               [:CHILANBERRY,18,1,5,_INTL("Chilan  Berries")],
               [:LIECHIBERRY,24,1,5,_INTL("Liechi Berries")],
               [:GANLONBERRY,24,1,5,_INTL("Ganlon Berries")],
               [:SALACBERRY,24,1,5,_INTL("Salac Berries")],
               [:PETAYABERRY,24,1,5,_INTL("Petaya Berries")],
               [:APICOTBERRY,24,1,5,_INTL("Apicot Berries")],
               [:LANSATBERRY,24,1,5,_INTL("Lansat Berries")],
               [:STARFBERRY,24,1,5,_INTL("Starf Berries")],
               [:ENIGMABERRY,24,1,5,_INTL("Enigma Berries")],
               [:MICLEBERRY,24,1,5,_INTL("Micle Berries")],
               [:CUSTAPBERRY,24,1,5,_INTL("Custap Berries")],
               [:JACOBABERRY,24,1,5,_INTL("Jacoba Berries")],
               [:ROWAPBERRY,24,1,5,_INTL("Rowap Berries")]]


Now, we go to PokemonItemEffects. This one is sprawled out so I'll let you do the editing, but I'll tell you where to go and what to do.

Line 204. Replace ORANBERRY and SITRUSBERRY with BERRY and GOLDBERRY, respectively.
Line 225, replace CHESTOBERRY with MINTBERRY.
Line 240, PECHABERRY to PSNCUREBERRY.
Line 254, RAWSTBERRY to ICEBERRY.
Line 269, CHERIBERRY to PRZCUREBERRY.
Line 283, ASPEARBERRY to BURNTBERRY.
Line 299, LUMBERRY to MIRACLEBERRY.
Line 403, LEPPABERRY to MYSTERYBERRY.
Line 1021, Replace ORANBERRY and SITRUSBERRY with BERRY and GOLDBERRY, respectively.
Line 1043, replace CHESTOBERRY with MINTBERRY.
Line 1059, PECHABERRY to PSNCUREBERRY.
Line 1074, RAWSTBERRY to ICEBERRY.
Line 1089, CHERIBERRY to PRZCUREBERRY.
Line 1104, ASPEARBERRY to BURNTBERRY.
Line 1122, LUMBERRY to MIRACLEBERRY.
Line 1250, LEPPABERRY to MYSTERYBERRY.

(Again, programs like Notepad++ help a ton!)

One script left to edit.
PokemonOrgBattleGenerator

Replace the array at line 385 with this:
Code:
    itemlist=[
       :BERRY,:GOLDBERRY,:ADAMANTORB,:BABIRIBERRY,
       :BLACKSLUDGE,:BRIGHTPOWDER,:CHESTOBERRY,:CHOICEBAND,
       :CHOICESCARF,:CHOICESPECS,:CHOPLEBERRY,:DAMPROCK,
       :DEEPSEATOOTH,:EXPERTBELT,:FLAMEORB,:FOCUSSASH,
       :FOCUSBAND,:HEATROCK,:LEFTOVERS,:LIFEORB,:LIGHTBALL,
       :LIGHTCLAY,:MYSTERYBERRY,:OCCABERRY,:PETAYABERRY,:SALACBERRY,
       :SCOPELENS,:SHEDSHELL,:SHELLBELL,:SHUCABERRY,:LIECHIBERRY,
       :SILKSCARF,:THICKCLUB,:TOXICORB,:WIDELENS,:YACHEBERRY,
       :HABANBERRY,:SOULDEW,:PASSHOBERRY,:QUICKCLAW,:WHITEHERB
    ]
Line 476, Replace ORANBERRY and SITRUSBERRY with BERRY and GOLDBERRY, respectively.
Do the same at line 480.
Line 598, replace LUMBERRY and CHESTOBERRY with MIRACLEBERRY and MINTBERRY, respectively.

And you should be done! I may have missed a line of code, but it's working just fine for me. Let me know if a bug occurs. The reason why I did this myself is because I was tired of calling for Oran Berries when it was called a Berry ingame.

In any new release of Essentials always check for berries when using this. Maruno may sneak something in there :I

Enjoy, and feedback is appreciated.
__________________




Coming soon to a forum near you...
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are UTC -8. The time now is 02:06 AM.