FANDOM


Easily choose an item from the Bag
This tutorial is deprecated. It is no longer relevant to the latest version of Pokémon Essentials.

This tutorial was written by -FL-. Please give credit.

Click here for more tutorials!


This tutorial explains how to choose items like pbChoosePokemon, but obviously, with items instead Pokémon. You can choose an item from the Bag, and this function returns the internal number of that item (or 0 if this is cancelled).

It is very useful for things like events where you need to choose special items, like the fossil reviver ones if you put several fossils in your game and you don't want to show them all to the player in one conditional branch.

Insert a new script section above Main containing the following:

#Call NeoCI.ChooseItem
#Return the item internal number or 0 if canceled
module NeoCI
 def self.ChooseItem()
  pbToneChangeAll(Tone.new(-255,-255,-255),8)
  pbWait(16)
  itemscene=PokemonBag_Scene.new
  itemscene.pbStartScene($PokemonBag)
  item=itemscene.pbChooseItem
  itemscene.pbEndScene
  pbToneChangeAll(Tone.new(-255,-255,-255),0)
  pbToneChangeAll(Tone.new(0,0,0),6)
  return item
 end
end

Usage

You can do more usage styles or mix this with events, this is only one example.

#ZZZ=some variable number, YYY=item internal name 
$game_variables[ZZZ]=NeoCI.ChooseItem
if pbGet(<VARIABLE NUMBER>)==PBItems::YYY
 #Do things here like
 #trade itens (add one item and remove the item in variable ZZZ)
 #You can put more if/elsif to handle with more items types
end

Simple fossil resurrection example

Here is a example of a simple fossil resurrection script that uses the two Hoenn fossils. Put it on the first code in this page, before the last end:

#Call NeoCI.FossilRessurectionExample()
def self.FossilRessurectionExample()
  Kernel.pbMessage(_INTL("If you have, give me a fossil for ressurection."))
  itemchosen=NeoCI.ChooseItem
  pokemon=0
  if itemchosen==PBItems::ROOTFOSSIL
    pokemon=PBSpecies::LILEEP
  elsif itemchosen==PBItems::CLAWFOSSIL
    pokemon=PBSpecies::ANORITH
  #elsif itemchosen==PBItems::<ITEM INTERNAL NAME>
  #  pokemon=PBSpecies::<POKEMON INTERNAL NAME>
  elsif itemchosen==0
    pokemon=-1
  end
  if pokemon>0
    Kernel.pbMessage(_INTL("Thanks!"))
    Kernel.pbMessage(_INTL("Give the fossil."))
    Kernel.pbMessage(_INTL("Reviving..."))
    $PokemonBag.pbDeleteItem(itemchosen)
    pbAddPokemon(PokeBattle_Pokemon.new(pokemon,5,$Trainer))
  elsif pokemon==0 # Isn't a fossil
    Kernel.pbMessage(_INTL("This isn't a fossil!"))
  else # Is cancelled
    Kernel.pbMessage(_INTL("If you see one, bring it to me."))
  end
 end

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.