Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old August 5th, 2013 (8:23 AM).
TACHAN TACHAN is offline
     
    Join Date: Jan 2010
    Gender: Female
    Posts: 198
    I have thought to put this in the script "PokemonItemEffects":

    ItemHandlers::UseFromBag.add(:AZUREFLUTE,proc{|item|
    Kernel.pbMessage(_INTL("{1} TEXT {2}.",$Trainer.name,PBItems.getName(item)))
    Kernel.pbMessage(_INTL("{1} TEXT."))
    next 1
    })

    I want to go to one map determined on having used the flute. Then I want to use the flute again to return to the map in which I was before.

    I don't know how to do it.
    Reply With Quote

    Relevant Advertising!

      #2    
    Old August 5th, 2013 (9:27 AM).
    Maruno's Avatar
    Maruno Maruno is offline
    Lead Dev of Pokémon Essentials
       
      Join Date: Jan 2008
      Location: England
      Posts: 5,180
      You don't know how to copy the Escape Rope?

      The only difference between the two is where the destination coordinates come from. Presumably your Azure Flute will transport the player from anywhere in the game to a particular map, and then using it again will return them to the spot they used it before.

      Make a new variable in $PokemonGlobal similar to $PokemonGlobal.escapePoint (identical to, actually, but with a different name). This will be where the return coordinates are stored. The destination coordinates can be hardcoded in Settings.

      When using the flute, check whether your variable is nil or []. If so, store the player's current coordinates in that variable and then go to your hardcoded coordinates. If there are already coordinates in that variable, go to them and then erase your variable. Simple.

      Any features beyond that are easy to derive.
      __________________
      Go to the Pokémon Essentials Wiki

      | Downloads | Tutorials | Fangames |
      | All Animations Project |

      Follow me on Twitter: @maruno42


      Reply With Quote
        #3    
      Old August 5th, 2013 (10:50 AM).
      Pia Carrot's Avatar
      Pia Carrot Pia Carrot is offline
      There is no brighter jewel...
      • Silver Tier
       
      Join Date: Aug 2010
      Age: 22
      Gender: Male
      Nature: Adamant
      Posts: 732
      I did something similar with an item that can only be used when a switch is on, I'll post it later when I edit this post.
      __________________


      Reply With Quote
        #4    
      Old August 7th, 2013 (8:31 AM).
      TACHAN TACHAN is offline
         
        Join Date: Jan 2010
        Gender: Female
        Posts: 198
        I have been testing with the script, but I cannot do that I work.

        I have gone to the section "PokemonField" and I took this Escaperope's part:

        Spoiler:
        def pbSetEscapePoint
        $PokemonGlobal.escapePoint=[] if !$PokemonGlobal.escapePoint
        xco=$game_player.x
        yco=$game_player.y
        case $game_player.direction
        when 2 # Down
        yco-=1; dir=8
        when 4 # Left
        xco+=1; dir=6
        when 6 # Right
        xco-=1; dir=4
        when 8 # Up
        yco+=1; dir=2
        end
        $PokemonGlobal.escapePoint=[$game_map.map_id,xco,yco,dir]
        end

        def pbEraseEscapePoint
        $PokemonGlobal.escapePoint=[]
        end


        Below of this, I also have added this:

        Spoiler:
        def pbSetAzureFlute
        $PokemonGlobal.AzureFlute=[] if !$PokemonGlobal.AzureFlute
        xco=$game_player.x
        yco=$game_player.y
        case $game_player.direction
        when 2 # Down
        yco-=1; dir=8
        when 4 # Left
        xco+=1; dir=6
        when 6 # Right
        xco-=1; dir=4
        when 8 # Up
        yco+=1; dir=2
        end
        $PokemonGlobal.AzureFlute=[$game_map.map_id,xco,yco,dir]
        end

        def pbEraseAzureFlute
        $PokemonGlobal.AzureFlute=[]
        end


        Then I went to the section "PokemonItemEffects" and I took this Escaperope's part:

        Spoiler:

        ItemHandlers::UseFromBag.add(:ESCAPEROPE,proc{|item|
        if $game_player.pbHasDependentEvents?
        Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
        next 0
        end
        if ($PokemonGlobal.escapePoint rescue false) && $PokemonGlobal.escapePoint.length>0
        next 4 # End screen and consume item
        else
        Kernel.pbMessage(_INTL("Can't use that here."))
        next 0
        end
        })


        Below of this, I also have added this:

        Spoiler:

        ItemHandlers::UseFromBag.add(:AZUREFLUTE,proc{|item|
        if $game_player.pbHasDependentEvents?
        Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
        next 0
        end
        if ($PokemonGlobal.AzureFlute rescue false) && $PokemonGlobal.AzureFlute.length>0
        next 4 # End screen and consume item
        else
        Kernel.pbMessage(_INTL("Can't use that here."))
        next 0
        end
        })


        Then I did the same thing with another Escaperope's part of the same section:

        Spoiler:
        ItemHandlers::UseInField.add(:ESCAPEROPE,proc{|item|
        escape=($PokemonGlobal.escapePoint rescue nil)
        if !escape || escape==[]
        Kernel.pbMessage(_INTL("Can't use that here."))
        next
        end
        if $game_player.pbHasDependentEvents?
        Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
        next
        end
        Kernel.pbMessage(_INTL("{1} used the Escape Rope.",$Trainer.name))
        pbFadeOutIn(99999){
        Kernel.pbCancelVehicles
        $game_temp.player_new_map_id=escape[0]
        $game_temp.player_new_x=escape[1]
        $game_temp.player_new_y=escape[2]
        $game_temp.player_new_direction=escape[3]
        $scene.transfer_player
        $game_map.autoplay
        $game_map.refresh
        }
        pbEraseEscapePoint
        })


        Below of this, I also have added this:

        Spoiler:
        ItemHandlers::UseInField.add(:AZUREFLUTE,proc{|item|
        escape=($PokemonGlobal.AzureFlute rescue nil)
        if !escape || escape==[]
        Kernel.pbMessage(_INTL("Can't use that here."))
        next
        end
        if $game_player.pbHasDependentEvents?
        Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
        next
        end
        Kernel.pbMessage(_INTL("{1} used the Azure Flute.",$Trainer.name))
        pbFadeOutIn(99999){
        Kernel.pbCancelVehicles
        $game_temp.player_new_map_id=escape[0]
        $game_temp.player_new_x=escape[1]
        $game_temp.player_new_y=escape[2]
        $game_temp.player_new_direction=escape[3]
        $scene.transfer_player
        $game_map.autoplay
        $game_map.refresh
        }
        pbEraseAzureFlute
        })


        I don't know that I must modify to put the ID Map.

        Quote:
        Originally Posted by Evil Arms View Post
        I did something similar with an item that can only be used when a switch is on, I'll post it later when I edit this post.
        Yes, please!!
        Reply With Quote
          #5    
        Old August 7th, 2013 (2:39 PM).
        dexter1o6 dexter1o6 is offline
           
          Join Date: Jul 2013
          Age: 29
          Gender: Male
          Posts: 64
          If you have copied the escape rope, it should work like the escape rope:

          In an event of a door or something (usually a cave entrance) put script: pbSetAzureFlute. (check for an escape rope event for an example and the exact usage)

          Then, IMPORTANT IN PROGRAMMING: test if it works so far. Test whether the Azure now indeed works exactly like an escape rope.

          Whe you are done, and everything works fine, make sure the item does what you want: put in the script where you use the item 1) a thing that transfers the player and 2) 'pbSetAzureFlute'. Then, when on the new locating, you should be able to use the flute as if it were an escape rope. (make sure the flute is not deleted upon usage, if that's what you want)

          I personally think you don't even need to copy the part of the escaperope, you could just use it instead. Where you call the function 'pbSetAzureFlute', just call the function 'pbSetEscapeRope'. This means that you can also use the escape rope to go back to the original location, but personally, I don't see that as a problem.

          Lastly, thank you for bringing up this question! I gave me many ideas for my own game: a temporary transfer to Mars, Venus or just the moon would be awesome... when the three main regions are finished that is, and I'm just halfway with the first...
          Reply With Quote
            #6    
          Old August 8th, 2013 (7:57 AM).
          Pia Carrot's Avatar
          Pia Carrot Pia Carrot is offline
          There is no brighter jewel...
          • Silver Tier
           
          Join Date: Aug 2010
          Age: 22
          Gender: Male
          Nature: Adamant
          Posts: 732
          Sorry, I've been out the last couple of days '

          Spoiler:
          Code:
          #===============================================================================
          # This script implements items included by default in Pokemon Essentials.
          #===============================================================================
          
          #===============================================================================
          # UseFromBag handlers
          #===============================================================================
          
          def pbRepel(item,steps)
            if $PokemonGlobal.repel>0
              Kernel.pbMessage(_INTL("But the effects of a Repel lingered from earlier."))
              return 0
            else
              Kernel.pbMessage(_INTL("{1} used the {2}.",$Trainer.name,PBItems.getName(item)))
              $PokemonGlobal.repel=steps
              return 3
            end
          end
          
          ItemHandlers::UseFromBag.add(:REPEL,proc{|item|  pbRepel(item,100)  })
          
          ItemHandlers::UseFromBag.add(:SUPERREPEL,proc{|item|  pbRepel(item,200)  })
          
          ItemHandlers::UseFromBag.add(:MAXREPEL,proc{|item|  pbRepel(item,250)  })
          
          Events.onStepTaken+=proc {
             if $PokemonGlobal.repel>0
               $PokemonGlobal.repel-=1
               if $PokemonGlobal.repel<=0
                 Kernel.pbMessage(_INTL("Repel's effect wore off..."))
                 ret=pbChooseItemFromList(_INTL("Do you want to use another Repel?"),1,
                    :REPEL,:SUPERREPEL,:MAXREPEL)
                 pbUseItem($PokemonBag,ret) if ret>0
               end
             end
          }
          
          ItemHandlers::UseFromBag.add(:BLACKFLUTE,proc{|item|
             Kernel.pbMessage(_INTL("{1} used the {2}.",$Trainer.name,PBItems.getName(item)))
             Kernel.pbMessage(_INTL("Wild Pokémon will be repelled."))
             $PokemonMap.blackFluteUsed=true
             $PokemonMap.whiteFluteUsed=false
             next 1
          })
          
          ItemHandlers::UseFromBag.add(:WHITEFLUTE,proc{|item|
             Kernel.pbMessage(_INTL("{1} used the {2}.",$Trainer.name,PBItems.getName(item)))
             Kernel.pbMessage(_INTL("Wild Pokémon will be lured."))
             $PokemonMap.blackFluteUsed=false
             $PokemonMap.whiteFluteUsed=true
             next 1
          })
          
          ItemHandlers::UseFromBag.add(:HONEY,proc{|item|  next 4  })
          
          ItemHandlers::UseFromBag.add(:ESCAPEROPE,proc{|item|
             if $game_player.pbHasDependentEvents?
               Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
               next 0
             end
             if ($PokemonGlobal.escapePoint rescue false) && $PokemonGlobal.escapePoint.length>0
               $game_switches[61]=false
               $game_switches[60]=false
               next 4 # End screen and consume item
             else
               Kernel.pbMessage(_INTL("Can't use that here."))
               next 0
             end
          })
          
          ItemHandlers::UseFromBag.add(:FEATHER,proc{|item|
             if $game_switches[61]=false
               Kernel.pbMessage(_INTL("It can't be used outside of the Ice Plateau."))
               next 0
             end
             if $game_player.pbHasDependentEvents?
               Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
               next 0
             end
             if ($PokemonGlobal.escapePoint rescue false) && $PokemonGlobal.escapePoint.length>0
               $game_switches[61]=false
               $game_switches[60]=false
               next 2 # End screen and consume item
             else
               Kernel.pbMessage(_INTL("It can't be used outside of the Ice Plateau."))
               next 0
             end
          })
          
          ItemHandlers::UseFromBag.add(:SACREDASH,proc{|item|
             revived=0
             if $Trainer.pokemonCount==0
               Kernel.pbMessage(_INTL("There is no Pokémon."))
               next 0
             end
             pbFadeOutIn(99999){
                scene=PokemonScreen_Scene.new
                screen=PokemonScreen.new(scene,$Trainer.party)
                screen.pbStartScene(_INTL("Using item..."),false)
                for i in $Trainer.party
                 if i.hp<=0 && !i.egg?
                   revived+=1
                   i.heal
                   screen.pbDisplay(_INTL("{1}'s HP was restored.",i.name))
                 end
               end
               if revived==0
                 screen.pbDisplay(_INTL("It won't have any effect."))
               end
               screen.pbEndScene
             }
             next (revived==0) ? 0 : 3
          })
          
          ItemHandlers::UseFromBag.add(:BICYCLE,proc{|item|
             next pbBikeCheck ? 2 : 0
          })
          
          ItemHandlers::UseFromBag.copy(:BICYCLE,:MACHBIKE,:ACROBIKE)
          
          ItemHandlers::UseFromBag.add(:OLDROD,proc{|item|
             terrain=Kernel.pbFacingTerrainTag
             notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
             if (pbIsWaterTag?(terrain) && !$PokemonGlobal.surfing && notCliff) ||
                (pbIsWaterTag?(terrain) && $PokemonGlobal.surfing)
               next 2
             else
               Kernel.pbMessage(_INTL("Can't use that here."))
               next 0
             end
          })
          
          ItemHandlers::UseFromBag.copy(:OLDROD,:GOODROD,:SUPERROD)
          
          
          ItemHandlers::UseFromBag.add(:ITEMFINDER,proc{|item| next 2 })
          
          ItemHandlers::UseFromBag.copy(:ITEMFINDER,:DOWSINGMCHN)
          
          ItemHandlers::UseFromBag.add(:TOWNMAP,proc{|item|
             pbShowMap(-1,false)
             next 1 # Continue
          })
          
          ItemHandlers::UseFromBag.add(:COINCASE,proc{|item|
             Kernel.pbMessage(_INTL("Coins: {1}",$PokemonGlobal.coins))
             next 1 # Continue
          })
          
          ItemHandlers::UseFromBag.add(:POKEBLOCKCASE,proc{|item| next 2 })
          
          #===============================================================================
          # UseOnPokemon handlers
          #===============================================================================
          
          ItemHandlers::UseOnPokemon.add(:FIRESTONE,proc{|item,pokemon,scene|
             if (pokemon.isShadow? rescue false)
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             end
             newspecies=pbCheckEvolution(pokemon,item)
             if newspecies<=0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pbFadeOutInWithMusic(99999){
                  evo=PokemonEvolutionScene.new
                  evo.pbStartScreen(pokemon,newspecies)
                  evo.pbEvolution(false)
                  evo.pbEndScreen
                  scene.pbRefreshAnnotations(proc{|p| pbCheckEvolution(p,item)>0 })
                  scene.pbRefresh
               }
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.copy(:FIRESTONE,
             :THUNDERSTONE,:WATERSTONE,:LEAFSTONE,:MOONSTONE,
             :SUNSTONE,:DUSKSTONE,:DAWNSTONE,:SHINYSTONE)
          
          ItemHandlers::UseOnPokemon.add(:POTION,proc{|item,pokemon,scene|
             next pbHPItem(pokemon,20,scene)
          })
          
          ItemHandlers::UseOnPokemon.add(:SUPERPOTION,proc{|item,pokemon,scene|
             next pbHPItem(pokemon,50,scene)
          })
          
          ItemHandlers::UseOnPokemon.add(:HYPERPOTION,proc{|item,pokemon,scene|
             next pbHPItem(pokemon,200,scene)
          })
          
          ItemHandlers::UseOnPokemon.add(:MAXPOTION,proc{|item,pokemon,scene|
             next pbHPItem(pokemon,pokemon.totalhp-pokemon.hp,scene)
          })
          
          ItemHandlers::UseOnPokemon.add(:BERRYJUICE,proc{|item,pokemon,scene|
             next pbHPItem(pokemon,20,scene)
          })
          
          ItemHandlers::UseOnPokemon.add(:RAGECANDYBAR,proc{|item,pokemon,scene|
             next pbHPItem(pokemon,20,scene)
          })
          
          ItemHandlers::UseOnPokemon.add(:SWEETHEART,proc{|item,pokemon,scene|
             next pbHPItem(pokemon,20,scene)
          })
          
          ItemHandlers::UseOnPokemon.add(:FRESHWATER,proc{|item,pokemon,scene|
             next pbHPItem(pokemon,50,scene)
          })
          
          ItemHandlers::UseOnPokemon.add(:SODAPOP,proc{|item,pokemon,scene|
             next pbHPItem(pokemon,60,scene)
          })
          
          ItemHandlers::UseOnPokemon.add(:LEMONADE,proc{|item,pokemon,scene|
             next pbHPItem(pokemon,80,scene)
          })
          
          ItemHandlers::UseOnPokemon.add(:MOOMOOMILK,proc{|item,pokemon,scene|
             next pbHPItem(pokemon,100,scene)
          })
          
          ItemHandlers::UseOnPokemon.add(:ORANBERRY,proc{|item,pokemon,scene|
             next pbHPItem(pokemon,10,scene)
          })
          
          ItemHandlers::UseOnPokemon.add(:SITRUSBERRY,proc{|item,pokemon,scene|
             next pbHPItem(pokemon,(pokemon.totalhp/4).floor,scene)
          })
          
          ItemHandlers::UseOnPokemon.add(:AWAKENING,proc{|item,pokemon,scene|
             if pokemon.hp<=0 || pokemon.status!=PBStatuses::SLEEP
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.statusCount=0
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} woke up.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.copy(:AWAKENING,:CHESTOBERRY,:BLUEFLUTE,:POKEFLUTE)
          
          ItemHandlers::UseOnPokemon.add(:ANTIDOTE,proc{|item,pokemon,scene|
             if pokemon.hp<=0 || pokemon.status!=PBStatuses::POISON
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.statusCount=0
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} was cured of its poisoning.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.copy(:ANTIDOTE,:PECHABERRY)
          
          ItemHandlers::UseOnPokemon.add(:BURNHEAL,proc{|item,pokemon,scene|
             if pokemon.hp<=0 || pokemon.status!=PBStatuses::BURN
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1}'s burn was healed.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.copy(:BURNHEAL,:RAWSTBERRY)
          
          ItemHandlers::UseOnPokemon.add(:PARLYZHEAL,proc{|item,pokemon,scene|
             if pokemon.hp<=0 || pokemon.status!=PBStatuses::PARALYSIS
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.statusCount=0
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} was cured of paralysis.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.copy(:PARLYZHEAL,:CHERIBERRY)
          
          ItemHandlers::UseOnPokemon.add(:ICEHEAL,proc{|item,pokemon,scene|
             if pokemon.hp<=0 || pokemon.status!=PBStatuses::FROZEN
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} was thawed out.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.copy(:ICEHEAL,:ASPEARBERRY)
          
          ItemHandlers::UseOnPokemon.add(:FULLHEAL,proc{|item,pokemon,scene|
             if pokemon.hp<=0 || pokemon.status==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.statusCount=0
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} became healthy.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.copy(:FULLHEAL,
             :LAVACOOKIE,:OLDGATEAU,:CASTELIACONE,:LUMBERRY)
          
          ItemHandlers::UseOnPokemon.add(:FULLRESTORE,proc{|item,pokemon,scene|
             if pokemon.hp<=0 || (pokemon.status==0 && pokemon.hp==pokemon.totalhp)
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               hpgain=pbItemRestoreHP(pokemon,pokemon.totalhp-pokemon.hp)
               pokemon.status=0
               pokemon.statusCount=0
               scene.pbRefresh
               if hpgain>0
                 scene.pbDisplay(_INTL("{1}'s HP was restored by {2} points.",pokemon.name,hpgain))
               else
                 scene.pbDisplay(_INTL("{1} became healthy.",pokemon.name))
               end
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:REVIVE,proc{|item,pokemon,scene|
             if pokemon.hp>0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.hp=(pokemon.totalhp/2).floor
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1}'s HP was restored.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:MAXREVIVE,proc{|item,pokemon,scene|
             if pokemon.hp>0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.hp=pokemon.totalhp
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1}'s HP was restored.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:ENERGYPOWDER,proc{|item,pokemon,scene|
             if pbHPItem(pokemon,50,scene)
               pokemon.changeHappiness("powder")
               next true
             end
             next false
          })
          
          ItemHandlers::UseOnPokemon.add(:ENERGYROOT,proc{|item,pokemon,scene|
             if pbHPItem(pokemon,200,scene)
               pokemon.changeHappiness("Energy Root")
               next true
             end
             next false
          })
          
          ItemHandlers::UseOnPokemon.add(:HEALPOWDER,proc{|item,pokemon,scene|
             if pokemon.hp<=0 || pokemon.status==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.statusCount=0
               pokemon.changeHappiness("powder")
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} became healthy.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:REVIVALHERB,proc{|item,pokemon,scene|
             if pokemon.hp>0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.hp=pokemon.totalhp
               pokemon.changeHappiness("Revival Herb")
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1}'s HP was restored.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:ETHER,proc{|item,pokemon,scene|
             move=scene.pbChooseMove(pokemon,_INTL("Restore which move?"))
             if move>=0
               if pbRestorePP(pokemon,move,10)==0
                 scene.pbDisplay(_INTL("It won't have any effect."))
                 next false
               else
                scene.pbDisplay(_INTL("PP was restored."))
                next true
              end
            end
            next false
          })
          
          ItemHandlers::UseOnPokemon.copy(:ETHER,:LEPPABERRY)
          
          ItemHandlers::UseOnPokemon.add(:MAXETHER,proc{|item,pokemon,scene|
             move=scene.pbChooseMove(pokemon,_INTL("Restore which move?"))
             if move>=0
               if pbRestorePP(pokemon,move,pokemon.moves[move].totalpp-pokemon.moves[move].pp)==0
                 scene.pbDisplay(_INTL("It won't have any effect."))
                 next false
               else
                 scene.pbDisplay(_INTL("PP was restored."))
                 next true
               end
             end
             next false
          })
          
          ItemHandlers::UseOnPokemon.add(:ELIXIR,proc{|item,pokemon,scene|
             pprestored=0
             for i in 0...pokemon.moves.length
               pprestored+=pbRestorePP(pokemon,i,10)
             end
             if pprestored==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbDisplay(_INTL("PP was restored."))
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:MAXELIXIR,proc{|item,pokemon,scene|
             pprestored=0
             for i in 0...pokemon.moves.length
               pprestored+=pbRestorePP(pokemon,i,pokemon.moves[i].totalpp-pokemon.moves[i].pp)
             end
             if pprestored==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbDisplay(_INTL("PP was restored."))
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:PPUP,proc{|item,pokemon,scene|
             move=scene.pbChooseMove(pokemon,_INTL("Boost PP of which move?"))
             if move>=0
               if pokemon.moves[move].totalpp==0 || pokemon.moves[move].ppup>=3
                 scene.pbDisplay(_INTL("It won't have any effect."))
                 next false
               else
                 pokemon.moves[move].ppup+=1
                 movename=PBMoves.getName(pokemon.moves[move].id)
                 scene.pbDisplay(_INTL("{1}'s PP increased.",movename))
                 next true
               end
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:PPMAX,proc{|item,pokemon,scene|
             move=scene.pbChooseMove(pokemon,_INTL("Boost PP of which move?"))
             if move>=0
               if pokemon.moves[move].totalpp==0 || pokemon.moves[move].ppup>=3
                 scene.pbDisplay(_INTL("It won't have any effect."))
                 next false
               else
                 pokemon.moves[move].ppup=3
                 movename=PBMoves.getName(pokemon.moves[move].id)
                 scene.pbDisplay(_INTL("{1}'s PP increased.",movename))
                 next true
               end
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:HPUP,proc{|item,pokemon,scene|
             if pbRaiseEffortValues(pokemon,0)==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1}'s HP increased.",pokemon.name))
               pokemon.changeHappiness("vitamin")
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:PROTEIN,proc{|item,pokemon,scene|
             if pbRaiseEffortValues(pokemon,1)==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbDisplay(_INTL("{1}'s Attack increased.",pokemon.name))
               pokemon.changeHappiness("vitamin")
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:IRON,proc{|item,pokemon,scene|
             if pbRaiseEffortValues(pokemon,2)==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbDisplay(_INTL("{1}'s Defense increased.",pokemon.name))
               pokemon.changeHappiness("vitamin")
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:CALCIUM,proc{|item,pokemon,scene|
             if pbRaiseEffortValues(pokemon,4)==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbDisplay(_INTL("{1}'s Special Attack increased.",pokemon.name))
               pokemon.changeHappiness("vitamin")
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:ZINC,proc{|item,pokemon,scene|
             if pbRaiseEffortValues(pokemon,5)==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbDisplay(_INTL("{1}'s Special Defense increased.",pokemon.name))
               pokemon.changeHappiness("vitamin")
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:CARBOS,proc{|item,pokemon,scene|
             if pbRaiseEffortValues(pokemon,3)==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbDisplay(_INTL("{1}'s Speed increased.",pokemon.name))
               pokemon.changeHappiness("vitamin")
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:HEALTHWING,proc{|item,pokemon,scene|
             if pbRaiseEffortValues(pokemon,0,1,false)==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1}'s HP increased.",pokemon.name))
               pokemon.changeHappiness("vitamin")
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:MUSCLEWING,proc{|item,pokemon,scene|
             if pbRaiseEffortValues(pokemon,1,1,false)==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbDisplay(_INTL("{1}'s Attack increased.",pokemon.name))
               pokemon.changeHappiness("vitamin")
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:RESISTWING,proc{|item,pokemon,scene|
             if pbRaiseEffortValues(pokemon,2,1,false)==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbDisplay(_INTL("{1}'s Defense increased.",pokemon.name))
               pokemon.changeHappiness("vitamin")
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:GENIUSWING,proc{|item,pokemon,scene|
             if pbRaiseEffortValues(pokemon,4,1,false)==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbDisplay(_INTL("{1}'s Special Attack increased.",pokemon.name))
               pokemon.changeHappiness("vitamin")
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:CLEVERWING,proc{|item,pokemon,scene|
             if pbRaiseEffortValues(pokemon,5,1,false)==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbDisplay(_INTL("{1}'s Special Defense increased.",pokemon.name))
               pokemon.changeHappiness("vitamin")
               next true
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:SWIFTWING,proc{|item,pokemon,scene|
             if pbRaiseEffortValues(pokemon,3,1,false)==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbDisplay(_INTL("{1}'s Speed increased.",pokemon.name))
               pokemon.changeHappiness("vitamin")
               next true
             end
          })
          
          def pbChangeLevel(pokemon,newlevel,scene)
            newlevel=1 if newlevel<1
            newlevel=PBExperience::MAXLEVEL if newlevel>PBExperience::MAXLEVEL
            if pokemon.level>newlevel
              pokemon.level=newlevel
              attackdiff=pokemon.attack
              defensediff=pokemon.defense
              speeddiff=pokemon.speed
              spatkdiff=pokemon.spatk
              spdefdiff=pokemon.spdef
              totalhpdiff=pokemon.totalhp
              pokemon.calcStats
              scene.pbRefresh
              Kernel.pbMessage(_INTL("{1} was downgraded to Level {2}!",pokemon.name,pokemon.level))
              attackdiff=pokemon.attack-attackdiff
              defensediff=pokemon.defense-defensediff
              speeddiff=pokemon.speed-speeddiff
              spatkdiff=pokemon.spatk-spatkdiff
              spdefdiff=pokemon.spdef-spdefdiff
              totalhpdiff=pokemon.totalhp-totalhpdiff
              pbTopRightWindow(_INTL("Max. HP{1}\r\nAttack{2}\r\nDefense{3}\r\nSp. Atk{4}\r\nSp. Def{5}\r\nSpeed{6}",
                 totalhpdiff,attackdiff,defensediff,spatkdiff,spdefdiff,speeddiff))
              pbTopRightWindow(_INTL("Max. HP{1}\r\nAttack{2}\r\nDefense{3}\r\nSp. Atk{4}\r\nSp. Def{5}\r\nSpeed{6}",
                 pokemon.totalhp,pokemon.attack,pokemon.defense,pokemon.spatk,pokemon.spdef,pokemon.speed))
            elsif pokemon.level==newlevel
              Kernel.pbMessage(_INTL("{1}'s level remained unchanged.",pokemon.name))
            else
              oldlevel=pokemon.level
              pokemon.level=newlevel
              attackdiff=pokemon.attack
              defensediff=pokemon.defense
              speeddiff=pokemon.speed
              spatkdiff=pokemon.spatk
              spdefdiff=pokemon.spdef
              totalhpdiff=pokemon.totalhp
              pokemon.changeHappiness("level up")
              pokemon.calcStats
              scene.pbRefresh
              Kernel.pbMessage(_INTL("{1} was elevated to Level {2}!",pokemon.name,pokemon.level))
              attackdiff=pokemon.attack-attackdiff
              defensediff=pokemon.defense-defensediff
              speeddiff=pokemon.speed-speeddiff
              spatkdiff=pokemon.spatk-spatkdiff
              spdefdiff=pokemon.spdef-spdefdiff
              totalhpdiff=pokemon.totalhp-totalhpdiff
              pbTopRightWindow(_INTL("Max. HP+{1}\r\nAttack+{2}\r\nDefense+{3}\r\nSp. Atk+{4}\r\nSp. Def+{5}\r\nSpeed+{6}",
                 totalhpdiff,attackdiff,defensediff,spatkdiff,spdefdiff,speeddiff))
              pbTopRightWindow(_INTL("Max. HP{1}\r\nAttack{2}\r\nDefense{3}\r\nSp. Atk{4}\r\nSp. Def{5}\r\nSpeed{6}",
                 pokemon.totalhp,pokemon.attack,pokemon.defense,pokemon.spatk,pokemon.spdef,pokemon.speed))
              movelist=pokemon.getMoveList
              for i in movelist
                if i[0]==pokemon.level          # Learned a new move
                  pbLearnMove(pokemon,i[1],true)
                end
              end
              newspecies=pbCheckEvolution(pokemon)
              if newspecies>0
                pbFadeOutInWithMusic(99999){
                   evo=PokemonEvolutionScene.new
                   evo.pbStartScreen(pokemon,newspecies)
                   evo.pbEvolution
                   evo.pbEndScreen
                }
              end
            end
          end
          
          ItemHandlers::UseOnPokemon.add(:RARECANDY,proc{|item,pokemon,scene|
             if pokemon.level>=PBExperience::MAXLEVEL || (pokemon.isShadow? rescue false)
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pbChangeLevel(pokemon,pokemon.level+1,scene)
               scene.pbHardRefresh
               next true
             end
          })
          
          def pbRaiseHappinessAndLowerEV(pokemon,scene,ev,messages)
            if pokemon.happiness==255 && pokemon.ev[ev]==0
              scene.pbDisplay(_INTL("It won't have any effect."))
              return false
            elsif pokemon.happiness==255
              pokemon.ev[ev]-=10
              pokemon.ev[ev]=0 if pokemon.ev[ev]<0
              pokemon.calcStats
              scene.pbRefresh
              scene.pbDisplay(messages[0])
              return true
            elsif pokemon.ev[ev]==0
              pokemon.changeHappiness("EV berry")
              scene.pbRefresh
              scene.pbDisplay(messages[1])
              return true
            else
              pokemon.changeHappiness("EV berry")
              pokemon.ev[ev]-=10
              pokemon.ev[ev]=0 if pokemon.ev[ev]<0
              pokemon.calcStats
              scene.pbRefresh
              scene.pbDisplay(messages[2])
              return true
            end
          end
          
          ItemHandlers::UseOnPokemon.add(:POMEGBERRY,proc{|item,pokemon,scene|
             next pbRaiseHappinessAndLowerEV(pokemon,scene,0,[
                _INTL("{1} adores you!\nThe base HP fell!",pokemon.name),
                _INTL("{1} turned friendly.\nThe base HP can't fall!",pokemon.name),
                _INTL("{1} turned friendly.\nThe base HP fell!",pokemon.name)
             ])
          })
          
          ItemHandlers::UseOnPokemon.add(:KELPSYBERRY,proc{|item,pokemon,scene|
             next pbRaiseHappinessAndLowerEV(pokemon,scene,1,[
                _INTL("{1} adores you!\nThe base Attack fell!",pokemon.name),
                _INTL("{1} turned friendly.\nThe base Attack can't fall!",pokemon.name),
                _INTL("{1} turned friendly.\nThe base Attack fell!",pokemon.name)
             ])
          })
          
          ItemHandlers::UseOnPokemon.add(:QUALOTBERRY,proc{|item,pokemon,scene|
             next pbRaiseHappinessAndLowerEV(pokemon,scene,2,[
                _INTL("{1} adores you!\nThe base Defense fell!",pokemon.name),
                _INTL("{1} turned friendly.\nThe base Defense can't fall!",pokemon.name),
                _INTL("{1} turned friendly.\nThe base Defense fell!",pokemon.name)
             ])
          })
          
          ItemHandlers::UseOnPokemon.add(:HONDEWBERRY,proc{|item,pokemon,scene|
             next pbRaiseHappinessAndLowerEV(pokemon,scene,4,[
                _INTL("{1} adores you!\nThe base Special Attack fell!",pokemon.name),
                _INTL("{1} turned friendly.\nThe base Special Attack can't fall!",pokemon.name),
                _INTL("{1} turned friendly.\nThe base Special Attack fell!",pokemon.name)
             ])
          })
          
          ItemHandlers::UseOnPokemon.add(:GREPABERRY,proc{|item,pokemon,scene|
             next pbRaiseHappinessAndLowerEV(pokemon,scene,5,[
                _INTL("{1} adores you!\nThe base Special Defense fell!",pokemon.name),
                _INTL("{1} turned friendly.\nThe base Special Defense can't fall!",pokemon.name),
                _INTL("{1} turned friendly.\nThe base Special Defense fell!",pokemon.name)
             ])
          })
          
          ItemHandlers::UseOnPokemon.add(:TAMATOBERRY,proc{|item,pokemon,scene|
             next pbRaiseHappinessAndLowerEV(pokemon,scene,3,[
                _INTL("{1} adores you!\nThe base Speed fell!",pokemon.name),
                _INTL("{1} turned friendly.\nThe base Speed can't fall!",pokemon.name),
                _INTL("{1} turned friendly.\nThe base Speed fell!",pokemon.name)
             ])
          })
          
          ItemHandlers::UseOnPokemon.add(:GRACIDEA,proc{|item,pokemon,scene|
             if isConst?(pokemon.species,PBSpecies,:SHAYMIN) && pokemon.form==0 &&
                pokemon.hp>=0 && pokemon.status!=PBStatuses::FROZEN &&
                !PBDayNight.isNight?(pbGetTimeNow)
               pokemon.form=1
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} changed Forme!",pokemon.name))
               next true
             else
               scene.pbDisplay(_INTL("It had no effect."))
               next false
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:REVEALGLASS,proc{|item,pokemon,scene|
             if (isConst?(pokemon.species,PBSpecies,:TORNADUS) ||
                isConst?(pokemon.species,PBSpecies,:THUNDURUS) ||
                isConst?(pokemon.species,PBSpecies,:LANDORUS)) && pokemon.hp>=0
               pokemon.form=(pokemon.form==0) ? 1 : 0
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} changed Forme!",pokemon.name))
               next true
             else
               scene.pbDisplay(_INTL("It had no effect."))
               next false
             end
          })
          
          ItemHandlers::UseOnPokemon.add(:DNASPLICERS,proc{|item,pokemon,scene|
             if isConst?(pokemon.species,PBSpecies,:KYUREM) && pokemon.hp>=0
               if pokemon.fused!=nil
                 if $Trainer.party.length>=6
                   scene.pbDisplay(_INTL("Your party is full! You can't unfuse {1}.",pokemon.name))
                   next false
                 else
                   $Trainer.party[$Trainer.party.length]=pokemon.fused
                   pokemon.fused=nil
                   pokemon.form=0
                   scene.pbHardRefresh
                   scene.pbDisplay(_INTL("{1} changed Forme!",pokemon.name))
                   next true
                 end
               else
                 chosen=scene.pbChoosePokemon(_INTL("Fuse with which Pokémon?"))
                 if chosen>=0
                   poke2=$Trainer.party[chosen]
                   if (isConst?(poke2.species,PBSpecies,:RESHIRAM) ||
                      isConst?(poke2.species,PBSpecies,:ZEKROM)) && poke2.hp>=0
                     pokemon.form=1 if isConst?(poke2.species,PBSpecies,:RESHIRAM)
                     pokemon.form=2 if isConst?(poke2.species,PBSpecies,:ZEKROM)
                     pokemon.fused=poke2
                     pbRemovePokemonAt(chosen)
                     scene.pbHardRefresh
                     scene.pbDisplay(_INTL("{1} changed Forme!",pokemon.name))
                     next true
                   elsif pokemon==poke2
                     scene.pbDisplay(_INTL("{1} can't be fused with itself!",pokemon.name))
                   else
                     scene.pbDisplay(_INTL("{1} can't be fused with {2}.",poke2.name,pokemon.name))
                   end
                 else
                   next false
                 end
               end
             else
               scene.pbDisplay(_INTL("It had no effect."))
               next false
             end
          })
          
          #===============================================================================
          # UseInField handlers
          #===============================================================================
          
          ItemHandlers::UseInField.add(:HONEY,proc{|item|  
             Kernel.pbMessage(_INTL("{1} used the {2}!",$Trainer.name,PBItems.getName(item)))
             pbSweetScent
          })
          
          ItemHandlers::UseInField.add(:ESCAPEROPE,proc{|item|
             escape=($PokemonGlobal.escapePoint rescue nil)
             if !escape || escape==[]
               Kernel.pbMessage(_INTL("Can't use that here."))
               next
             end
             if $game_player.pbHasDependentEvents?
               Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
               next
             end
             Kernel.pbMessage(_INTL("{1} used the Escape Rope.",$Trainer.name))
             pbFadeOutIn(99999){
                Kernel.pbCancelVehicles
                $game_temp.player_new_map_id=escape[0]
                $game_temp.player_new_x=escape[1]
                $game_temp.player_new_y=escape[2]
                $game_temp.player_new_direction=escape[3]
                $scene.transfer_player
                $game_map.autoplay
                $game_map.refresh
             }
             pbEraseEscapePoint
          })
          
          ItemHandlers::UseInField.add(:FEATHER,proc{|item|
             escape=($PokemonGlobal.escapePoint rescue nil)
             if !escape || escape==[]
               Kernel.pbMessage(_INTL("Can't use that here."))
               next
             end
             if $game_player.pbHasDependentEvents?
               Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
               next
             end
             Kernel.pbMessage(_INTL("{1} used the ICY FEATHER.",$Trainer.name))
             pbFadeOutIn(99999){
                Kernel.pbCancelVehicles
                $game_temp.player_new_map_id=escape[0]
                $game_temp.player_new_x=escape[1]
                $game_temp.player_new_y=escape[2]
                $game_temp.player_new_direction=escape[3]
                $scene.transfer_player
                $game_map.autoplay
                $game_map.refresh
             }
             pbEraseEscapePoint
          })
          
          ItemHandlers::UseInField.add(:BICYCLE,proc{|item|
             if pbBikeCheck
               if $PokemonGlobal.bicycle
                 Kernel.pbDismountBike
               else
                 Kernel.pbMountBike 
               end
             end
          })
          
          ItemHandlers::UseInField.copy(:BICYCLE,:MACHBIKE,:ACROBIKE)
          
          ItemHandlers::UseInField.add(:OLDROD,proc{|item|
             terrain=Kernel.pbFacingTerrainTag
             notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
             if !pbIsWaterTag?(terrain) || (!notCliff && !$PokemonGlobal.surfing)
               Kernel.pbMessage(_INTL("Can't use that here."))
               next
             end
             encounter=$PokemonEncounters.hasEncounter?(EncounterTypes::OldRod)
             if pbFishing(encounter)
               pbEncounter(EncounterTypes::OldRod)
             end
          })
          
          ItemHandlers::UseInField.add(:GOODROD,proc{|item|
             terrain=Kernel.pbFacingTerrainTag
             notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
             if !pbIsWaterTag?(terrain) || (!notCliff && !$PokemonGlobal.surfing)
               Kernel.pbMessage(_INTL("Can't use that here."))
               next
             end
             encounter=$PokemonEncounters.hasEncounter?(EncounterTypes::GoodRod)
             if pbFishing(encounter)
               pbEncounter(EncounterTypes::GoodRod)
             end
          })
          
          ItemHandlers::UseInField.add(:SUPERROD,proc{|item|
             terrain=Kernel.pbFacingTerrainTag
             notCliff=$game_map.passable?($game_player.x,$game_player.y,$game_player.direction)
             if !pbIsWaterTag?(terrain) || (!notCliff && !$PokemonGlobal.surfing)
               Kernel.pbMessage(_INTL("Can't use that here."))
               next
             end
             encounter=$PokemonEncounters.hasEncounter?(EncounterTypes::SuperRod)
             if pbFishing(encounter)
               pbEncounter(EncounterTypes::SuperRod)
             end
          })
          
          ItemHandlers::UseInField.add(:ITEMFINDER,proc{|item|
             event=pbClosestHiddenItem
             if !event
               Kernel.pbMessage(_INTL("... ... ...Nope!\r\nThere's no response."))
             else
               offsetX=event.x-$game_player.x
               offsetY=event.y-$game_player.y
               if offsetX==0 && offsetY==0
                 for i in 0...32
                   Graphics.update
                   Input.update
                   $game_player.turn_right_90 if (i&7)==0
                   pbUpdateSceneMap
                 end
                 Kernel.pbMessage(_INTL("Oh!\nThe {1}'s shaking wildly!\1",PBItems.getName(item)))
                 Kernel.pbMessage(_INTL("There's an item buried underfoot!"))
               else
                 direction=$game_player.direction
                 if offsetX.abs>offsetY.abs
                   direction=(offsetX<0) ? 4 : 6         
                 else
                   direction=(offsetY<0) ? 8 : 2
                 end
                 for i in 0...8
                   Graphics.update
                   Input.update
                   if i==0
                     $game_player.turn_down if direction==2
                     $game_player.turn_left if direction==4
                     $game_player.turn_right if direction==6
                     $game_player.turn_up if direction==8
                   end
                   pbUpdateSceneMap
                 end
                 Kernel.pbMessage(_INTL("Oh!\nThe {1}'s responding!\1",PBItems.getName(item)))
                 Kernel.pbMessage(_INTL("There's an item buried around here!"))
               end
             end
          })
          
          ItemHandlers::UseInField.copy(:ITEMFINDER,:DOWSINGMCHN)
          
          ItemHandlers::UseInField.add(:TOWNMAP,proc{|item|
             pbShowMap(-1,false)
          })
          
          ItemHandlers::UseInField.add(:COINCASE,proc{|item|
             Kernel.pbMessage(_INTL("Coins: {1}",$PokemonGlobal.coins))
             next 1 # Continue
          })
          
          ItemHandlers::UseInField.add(:POKEBLOCKCASE,proc{|item|
             Kernel.pbMessage(_INTL("Can't use that here."))   
          })
          
          #===============================================================================
          # BattleUseOnPokemon handlers
          #===============================================================================
          
          ItemHandlers::BattleUseOnPokemon.add(:POTION,proc{|item,pokemon,battler,scene|
             next pbBattleHPItem(pokemon,battler,20,scene)
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:SUPERPOTION,proc{|item,pokemon,battler,scene|
             next pbBattleHPItem(pokemon,battler,50,scene)
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:HYPERPOTION,proc{|item,pokemon,battler,scene|
             next pbBattleHPItem(pokemon,battler,200,scene)
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:MAXPOTION,proc{|item,pokemon,battler,scene|
             next pbBattleHPItem(pokemon,battler,pokemon.totalhp-pokemon.hp,scene)
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:BERRYJUICE,proc{|item,pokemon,battler,scene|
             next pbBattleHPItem(pokemon,battler,20,scene)
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:RAGECANDYBAR,proc{|item,pokemon,battler,scene|
             next pbBattleHPItem(pokemon,battler,20,scene)
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:SWEETHEART,proc{|item,pokemon,battler,scene|
             next pbBattleHPItem(pokemon,battler,20,scene)
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:FRESHWATER,proc{|item,pokemon,battler,scene|
             next pbBattleHPItem(pokemon,battler,50,scene)
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:SODAPOP,proc{|item,pokemon,battler,scene|
             next pbBattleHPItem(pokemon,battler,60,scene)
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:LEMONADE,proc{|item,pokemon,battler,scene|
             next pbBattleHPItem(pokemon,battler,80,scene)
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:MOOMOOMILK,proc{|item,pokemon,battler,scene|
             next pbBattleHPItem(pokemon,battler,100,scene)
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:ORANBERRY,proc{|item,pokemon,battler,scene|
             next pbBattleHPItem(pokemon,battler,10,scene)
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:SITRUSBERRY,proc{|item,pokemon,battler,scene|
             next pbBattleHPItem(pokemon,battler,(pokemon.totalhp/4).floor,scene)
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:AWAKENING,proc{|item,pokemon,battler,scene|
             if pokemon.hp<=0 || pokemon.status!=PBStatuses::SLEEP
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.statusCount=0
               battler.status=0 if battler
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} woke up.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.copy(:AWAKENING,:CHESTOBERRY,:BLUEFLUTE,:POKEFLUTE)
          
          ItemHandlers::BattleUseOnPokemon.add(:ANTIDOTE,proc{|item,pokemon,battler,scene|
             if pokemon.hp<=0 || pokemon.status!=PBStatuses::POISON
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.statusCount=0
               battler.status=0 if battler
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} was cured of its poisoning.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.copy(:ANTIDOTE,:PECHABERRY)
          
          ItemHandlers::BattleUseOnPokemon.add(:BURNHEAL,proc{|item,pokemon,battler,scene|
             if pokemon.hp<=0 || pokemon.status!=PBStatuses::BURN
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               battler.status=0 if battler
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1}'s burn was healed.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.copy(:BURNHEAL,:RAWSTBERRY)
          
          ItemHandlers::BattleUseOnPokemon.add(:PARLYZHEAL,proc{|item,pokemon,battler,scene|
             if pokemon.hp<=0 || pokemon.status!=PBStatuses::PARALYSIS
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               battler.status=0 if battler
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} was cured of paralysis.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.copy(:PARLYZHEAL,:CHERIBERRY)
          
          ItemHandlers::BattleUseOnPokemon.add(:ICEHEAL,proc{|item,pokemon,battler,scene|
             if pokemon.hp<=0 || pokemon.status!=PBStatuses::FROZEN
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               battler.status=0 if battler
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} was thawed out.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.copy(:ICEHEAL,:ASPEARBERRY)
          
          ItemHandlers::BattleUseOnPokemon.add(:FULLHEAL,proc{|item,pokemon,battler,scene|
             if pokemon.hp<=0 || (pokemon.status==0 && (!battler || battler.effects[PBEffects::Confusion]==0))
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.statusCount=0
               battler.status=0 if battler
               battler.effects[PBEffects::Confusion]=0 if battler
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} became healthy.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.copy(:FULLHEAL,
             :LAVACOOKIE,:OLDGATEAU,:CASTELIACONE,:LUMBERRY)
          
          ItemHandlers::BattleUseOnPokemon.add(:FULLRESTORE,proc{|item,pokemon,battler,scene|
             if pokemon.hp<=0 || (pokemon.status==0 && pokemon.hp==pokemon.totalhp &&
                (!battler || battler.effects[PBEffects::Confusion]==0))
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               hpgain=pbItemRestoreHP(pokemon,pokemon.totalhp-pokemon.hp)
               battler.hp=pokemon.hp if battler
               pokemon.status=0
               pokemon.statusCount=0
               battler.status=0 if battler
               battler.effects[PBEffects::Confusion]=0 if battler
               scene.pbRefresh
               if hpgain>0
                 scene.pbDisplay(_INTL("{1}'s HP was restored by {2} points.",pokemon.name,hpgain))
               else
                 scene.pbDisplay(_INTL("{1} became healthy.",pokemon.name))
               end
               next true
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:REVIVE,proc{|item,pokemon,battler,scene|
             if pokemon.hp>0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.hp=(pokemon.totalhp/2).floor
               for i in 0...$Trainer.party.length
                 if $Trainer.party[i]==pokemon
                   battler.pbInitialize(pokemon,i,false) if battler
                   break
                 end
               end
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1}'s HP was restored.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:MAXREVIVE,proc{|item,pokemon,battler,scene|
             if pokemon.hp>0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.hp=pokemon.totalhp
               for i in 0...$Trainer.party.length
                 if $Trainer.party[i]==pokemon
                   battler.pbInitialize(pokemon,i,false) if battler
                   break
                 end
               end
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1}'s HP was restored.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:ENERGYPOWDER,proc{|item,pokemon,battler,scene|
             if pbBattleHPItem(pokemon,battler,50,scene)
               pokemon.changeHappiness("powder")
               next true
             end
             next false
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:ENERGYROOT,proc{|item,pokemon,battler,scene|
             if pbBattleHPItem(pokemon,battler,200,scene)
               pokemon.changeHappiness("Energy Root")
               next true
             end
             next false
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:HEALPOWDER,proc{|item,pokemon,battler,scene|
             if pokemon.hp<=0 || (pokemon.status==0 && (!battler || battler.effects[PBEffects::Confusion]==0))
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.statusCount=0
               battler.status=0 if battler
               battler.effects[PBEffects::Confusion]=0 if battler
               pokemon.changeHappiness("powder")
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1} became healthy.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:REVIVALHERB,proc{|item,pokemon,battler,scene|
             if pokemon.hp>0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               pokemon.status=0
               pokemon.hp=pokemon.totalhp
               for i in 0...$Trainer.party.length
                 if $Trainer.party[i]==pokemon
                   battler.pbInitialize(pokemon,i,false) if battler
                   break
                 end
               end
               pokemon.changeHappiness("Revival Herb")
               scene.pbRefresh
               scene.pbDisplay(_INTL("{1}'s HP was restored.",pokemon.name))
               next true
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:ETHER,proc{|item,pokemon,battler,scene|
             move=scene.pbChooseMove(pokemon,_INTL("Restore which move?"))
             if move>=0
               if pbBattleRestorePP(pokemon,battler,move,10)==0
                 scene.pbDisplay(_INTL("It won't have any effect."))
                 next false
               else
                 scene.pbDisplay(_INTL("PP was restored."))
                 next true
               end
             end
             next false
          })
          
          ItemHandlers::BattleUseOnPokemon.copy(:ETHER,:LEPPABERRY)
          
          ItemHandlers::BattleUseOnPokemon.add(:MAXETHER,proc{|item,pokemon,battler,scene|
             move=scene.pbChooseMove(pokemon,_INTL("Restore which move?"))
             if move>=0
               if pbBattleRestorePP(pokemon,battler,move,pokemon.moves[move].totalpp-pokemon.moves[move].pp)==0
                 scene.pbDisplay(_INTL("It won't have any effect."))
                 next false
               else
                 scene.pbDisplay(_INTL("PP was restored."))
                 next true
               end
             end
             next false
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:ELIXIR,proc{|item,pokemon,battler,scene|
             pprestored=0
             for i in 0...pokemon.moves.length
               pprestored+=pbBattleRestorePP(pokemon,battler,i,10)
             end
             if pprestored==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbDisplay(_INTL("PP was restored."))
               next true
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:MAXELIXIR,proc{|item,pokemon,battler,scene|
             pprestored=0
             for i in 0...pokemon.moves.length
               pprestored+=pbBattleRestorePP(pokemon,battler,i,pokemon.moves[i].totalpp-pokemon.moves[i].pp)
             end
             if pprestored==0
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             else
               scene.pbDisplay(_INTL("PP was restored."))
               next true
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:REDFLUTE,proc{|item,pokemon,battler,scene|
             if battler && battler.effects[PBEffects::Attract]>=0
               battler.effects[PBEffects::Attract]=-1
               scene.pbDisplay(_INTL("{1} got over its infatuation.",pokemon.name))
               next true # :consumed:
             else
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.add(:YELLOWFLUTE,proc{|item,pokemon,battler,scene|
             if battler && battler.effects[PBEffects::Confusion]>0
               battler.effects[PBEffects::Confusion]=0
               scene.pbDisplay(_INTL("{1} snapped out of confusion.",pokemon.name))
               next true # :consumed:
             else
               scene.pbDisplay(_INTL("It won't have any effect."))
               next false
             end
          })
          
          ItemHandlers::BattleUseOnPokemon.copy(:YELLOWFLUTE,:PERSIMBERRY)
          
          #===============================================================================
          # BattleUseOnBattler handlers
          #===============================================================================
          
          ItemHandlers::BattleUseOnBattler.add(:XATTACK,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::ATTACK)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::ATTACK,1)
               scene.pbDisplay(_INTL("{1}'s Attack rose!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XATTACK2,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::ATTACK)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::ATTACK,2)
               scene.pbDisplay(_INTL("{1}'s Attack rose sharply!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XATTACK3,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::ATTACK)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::ATTACK,3)
               scene.pbDisplay(_INTL("{1}'s Attack rose drastically!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XATTACK6,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::ATTACK)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::ATTACK,6)
               scene.pbDisplay(_INTL("{1}'s Attack went way up!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XDEFEND,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::DEFENSE)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::DEFENSE,1)
               scene.pbDisplay(_INTL("{1}'s Defense rose!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XDEFEND2,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::DEFENSE)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::DEFENSE,2)
               scene.pbDisplay(_INTL("{1}'s Defense rose sharply!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XDEFEND3,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::DEFENSE)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::DEFENSE,3)
               scene.pbDisplay(_INTL("{1}'s Defense rose drastically!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XDEFEND6,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::DEFENSE)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::DEFENSE,6)
               scene.pbDisplay(_INTL("{1}'s Defense went way up!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XSPECIAL,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::SPATK)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::SPATK,1)
               scene.pbDisplay(_INTL("{1}'s Special Attack rose!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XSPECIAL2,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::SPATK)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::SPATK,2)
               scene.pbDisplay(_INTL("{1}'s Special Attack rose sharply!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XSPECIAL3,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::SPATK)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::SPATK,3)
               scene.pbDisplay(_INTL("{1}'s Special Attack rose drastically!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XSPECIAL6,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::SPATK)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::SPATK,6)
               scene.pbDisplay(_INTL("{1}'s Special Attack went way up!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XSPDEF,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::SPDEF)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::SPDEF,1)
               scene.pbDisplay(_INTL("{1}'s Special Defense rose!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XSPDEF2,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::SPDEF)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::SPDEF,2)
               scene.pbDisplay(_INTL("{1}'s Special Defense rose sharply!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XSPDEF3,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::SPDEF)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::SPDEF,3)
               scene.pbDisplay(_INTL("{1}'s Special Defense rose drastically!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XSPDEF6,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::SPDEF)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::SPDEF,6)
               scene.pbDisplay(_INTL("{1}'s Special Defense went way up!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XSPEED,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::SPEED)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::SPEED,1)
               scene.pbDisplay(_INTL("{1}'s Speed rose!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XSPEED2,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::SPEED)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::SPEED,2)
               scene.pbDisplay(_INTL("{1}'s Speed rose sharply!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XSPEED3,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::SPEED)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::SPEED,3)
               scene.pbDisplay(_INTL("{1}'s Speed rose drastically!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XSPEED6,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::SPEED)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::SPEED,6)
               scene.pbDisplay(_INTL("{1}'s Speed went way up!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XACCURACY,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::ACCURACY)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::ACCURACY,1)
               scene.pbDisplay(_INTL("{1}'s accuracy rose!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XACCURACY2,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::ACCURACY)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::ACCURACY,2)
               scene.pbDisplay(_INTL("{1}'s accuracy rose sharply!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XACCURACY3,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::ACCURACY)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::ACCURACY,3)
               scene.pbDisplay(_INTL("{1}'s accuracy rose drastically!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:XACCURACY6,proc{|item,battler,scene|
             if battler.pbTooHigh?(PBStats::ACCURACY)
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false  
             else
               battler.pbIncreaseStatBasic(PBStats::ACCURACY,6)
               scene.pbDisplay(_INTL("{1}'s accuracy went way up!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:DIREHIT,proc{|item,battler,scene|
             if battler.effects[PBEffects::FocusEnergy]>=1
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false
             else
               battler.effects[PBEffects::FocusEnergy]=1
               scene.pbDisplay(_INTL("{1} is getting pumped!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:DIREHIT2,proc{|item,battler,scene|
             if battler.effects[PBEffects::FocusEnergy]>=2
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false
             else
               battler.effects[PBEffects::FocusEnergy]=2
               scene.pbDisplay(_INTL("{1} is getting pumped!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:DIREHIT3,proc{|item,battler,scene|
             if battler.effects[PBEffects::FocusEnergy]>=3
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false
             else
               battler.effects[PBEffects::FocusEnergy]=3
               scene.pbDisplay(_INTL("{1} is getting pumped!",battler.pbThis))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:GUARDSPEC,proc{|item,battler,scene|
             if battler.pbOwnSide.effects[PBEffects::Mist]>0
               scene.pbDisplay(_INTL("It won't have any effect."))
               return false
             else
               battler.pbOwnSide.effects[PBEffects::Mist]=5
               if !scene.pbIsOpposing?(attacker.index)
                 scene.pbDisplay(_INTL("Your team became shrouded in mist!"))
               else
                 scene.pbDisplay(_INTL("The foe's team became shrouded in mist!"))
               end
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.add(:POKEDOLL,proc{|item,battler,scene|
             battle=battler.battle
             if battle.opponent
               scene.pbDisplay(_INTL("Can't use that here."))
               return false
             else
               playername=battle.pbPlayer.name
               itemname=PBItems.getName(item)
               scene.pbDisplay(_INTL("{1} used the {2}.",playername,itemname))
               return true
             end
          })
          
          ItemHandlers::BattleUseOnBattler.copy(:POKEDOLL,:FLUFFYTAIL,:POKETOY)
          
          ItemHandlers::BattleUseOnBattler.addIf(proc{|item|
                          pbIsPokeBall?(item)},proc{|item,battler,scene|  # Any Poké Ball
             battle=battler.battle
             if battler.pbOpposing1.hp>0 && battler.pbOpposing2.hp>0
               if !pbIsSnagBall?(item)
                 scene.pbDisplay(_INTL("It's no good!  It's impossible to aim when there are two Pokémon!"))
                 return false
               end
             end
             if battle.pbPlayer.party.length>=6 && $PokemonStorage.full?
               scene.pbDisplay(_INTL("There is no room left in the PC!"))
               return false
             end
             return true
          })
          
          #===============================================================================
          # UseInBattle handlers
          #===============================================================================
          
          ItemHandlers::UseInBattle.add(:POKEDOLL,proc{|item,battler,battle|
             battle.decision=3
             battle.pbDisplayPaused(_INTL("Got away safely!"))
          })
          
          ItemHandlers::UseInBattle.copy(:POKEDOLL,:FLUFFYTAIL,:POKETOY)
          
          ItemHandlers::UseInBattle.addIf(proc{|item|
             pbIsPokeBall?(item)},proc{|item,battler,battle|  # Any Poké Ball 
                battle.pbThrowPokeBall(battler.index,item)
          })


          This is my PokemonItemEffects
          Icy Feather is the item, so you can use this for reference.
          __________________


          Reply With Quote
            #7    
          Old August 11th, 2013 (6:18 AM).
          TACHAN TACHAN is offline
             
            Join Date: Jan 2010
            Gender: Female
            Posts: 198
            Quote:
            Originally Posted by Evil Arms View Post
            Sorry, I've been out the last couple of days '
            This is my PokemonItemEffects
            Icy Feather is the item, so you can use this for reference.
            Thanks you!
            But I do not understand the switches that you have put, and even I continue without knowing since I do for script that the player goes to the map Spear Pillar.
            Reply With Quote
              #8    
            Old August 11th, 2013 (7:06 AM). Edited August 11th, 2013 by Nickalooose.
            Nickalooose Nickalooose is offline
            --------------------
               
              Join Date: Mar 2008
              Gender: Female
              Posts: 1,309
              That item won't work properly... Just saying.

              The switch is obviously game specific TACHAN.

              I'd use $game_map.map_id!=xx, where xx is the map id of your Ice Plateau, not whether a switch is true, this way, the switch doesn't have to be set upon entering and exiting that map.

              EDIT:
              Code:
              ItemHandlers::UseInField.add(:FEATHER,proc{|item|
                 escape=($PokemonGlobal.escapePoint rescue nil)
                 if !escape || escape==[]
                   Kernel.pbMessage(_INTL("Can't use that here."))
                   next
                 end
                 if $game_player.pbHasDependentEvents?
                   Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
                   next
                 end
                 Kernel.pbMessage(_INTL("{1} used the ICY FEATHER.",$Trainer.name))
                 pbFadeOutIn(99999){
                    Kernel.pbCancelVehicles
                    $game_temp.player_new_map_id=escape[0]
                    $game_temp.player_new_x=escape[1]
                    $game_temp.player_new_y=escape[2]
                    $game_temp.player_new_direction=escape[3]
                    $scene.transfer_player
                    $game_map.autoplay
                    $game_map.refresh
                 }
                 pbEraseEscapePoint
              })
              First thing, this is Escape Rope with a new name... You'll want to completely change this pretty much.
              Code:
                    $game_temp.player_new_map_id=escape[0]
                    $game_temp.player_new_x=escape[1]
                    $game_temp.player_new_y=escape[2]
                    $game_temp.player_new_direction=escape[3]
              These are probably what you'll want to manually change... Pretty self explanatory.
              Map ID to where you want to "teleport".
              X Position.
              Y Position.
              Direction you want the player to face.
              Otherwise it will read an escape point from metadata and send you to there... I'm pretty sure you don't want that, and if you do, set manually so you have control over it anyway (I would)

              Now this:
              Code:
              ItemHandlers::UseFromBag.add(:FEATHER,proc{|item|
                 if $game_switches[61]=false
                   Kernel.pbMessage(_INTL("It can't be used outside of the Ice Plateau."))
                   next 0
                 end
                 if $game_player.pbHasDependentEvents?
                   Kernel.pbMessage(_INTL("It can't be used when you have someone with you."))
                   next 0
                 end
                 if ($PokemonGlobal.escapePoint rescue false) && $PokemonGlobal.escapePoint.length>0
                   $game_switches[61]=false
                   $game_switches[60]=false
                   next 2 # End screen and consume item
                 else
                   Kernel.pbMessage(_INTL("It can't be used outside of the Ice Plateau."))
                   next 0
                 end
              })
              $game_switches[61]=false: will SET the switch to false.
              $game_switches[61]==false: will CHECK whether the switch is false.
              $game_switches[61]!=false: will check whether the switch is NOT false.
              So using if $game_switches[61]=false; will return that switch false, whether you turn it on or not... Thus the item, will not function properly.
              Reply With Quote
              Reply

              Quick Reply

              Join the conversation!

              Create an account to post a reply in this thread, participate in other discussions, and more!

              Create a PokéCommunity Account

              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 GMT -8. The time now is 10:12 PM.