The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

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.


Advertise here

Reply
 
Thread Tools
  #1    
Old August 17th, 2012, 12:48 PM
zingzags's Avatar
zingzags
Creator or Pokemon Serenity
 
Join Date: Jan 2009
Location: Boston
Age: 20
Nature: Adamant

Advertise here
Here is another nice add-on brought to you by yours truly.
Code:
# Apricorn system by zingzags
# credits will be nice!

class Apricorn

  def pbStartScene
    @sprites={}
    @posx={}
    @posy={}
    @choose=1
    @text_update=nil
    @exit=nil
    @leave=nil
    @posx[1],@posy[1]=30,0
    @posx[2],@posy[2]=120,30
    @posx[3],@posy[3]=30,65
    @posx[4],@posy[4]=120,90
    @posx[5],@posy[5]=30,130
    @posx[6],@posy[6]=120,155
    @posx[7],@posy[7]=30,190
    @posx[8],@posy[8]=Graphics.width-100,Graphics.height-150
    
    @viewport=Viewport.new(0,0,Graphics.width, Graphics.height)
    @viewport.z=99999
    
    @sprites["bg"]=IconSprite.new(0,0,@viewport)
    @sprites["bg"].setBitmap("Graphics/Pictures/Apricorn/Apricorn")
    @sprites["bg"].z=1
    
    @sprites["up"]=AnimatedSprite.create("Graphics/Pictures/Apricorn/uparrow1",10,3,@viewport)
    @sprites["up"].x=30
    @sprites["up"].y=0
    @sprites["up"].z=3
    @sprites["up"].play
    
    @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
    @sprites["overlay"].z=2
    overlay=@sprites["overlay"].bitmap
    overlay.clear
    base=Color.new(12*8,12*8,12*8)
    base1=Color.new(255,255,240)
    base2=Color.new(128,128,128)
    pbSetSystemFont(overlay)
  textpos=[
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::REDAPRICORN)),107,97,1,base,base2],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::YLWAPRICORN)),203,130,1,base,base2],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::BLUAPRICORN)),107,160,1,base,base2],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::GRNAPRICORN)),203,193,1,base,base2],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::PNKAPRICORN)),108,223,1,base,base2],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::WHTAPRICORN)),203,256,1,base,base2],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::BLKAPRICORN)),108,288,1,base,base2],
  [_ISPRINTF("Apricorn Box"),180,335,1,base1,base2],
  ]
 pbDrawTextPositions(overlay,textpos)
   
  if $PokemonBag.pbQuantity(PBItems::REDAPRICORN)!=0
    @sprites["REDAPRICORN"]=IconSprite.new(30,74,@viewport)
    @sprites["REDAPRICORN"].setBitmap("Graphics/Pictures/REDAPRICORN")
    @sprites["REDAPRICORN"].z=2
  end  
  if $PokemonBag.pbQuantity(PBItems::YLWAPRICORN)!=0
    @sprites["YLWAPRICORN"]=IconSprite.new(125,106,@viewport)
    @sprites["YLWAPRICORN"].setBitmap("Graphics/Pictures/YLWAPRICORN")
    @sprites["YLWAPRICORN"].z=2  
  end 
  if $PokemonBag.pbQuantity(PBItems::BLUAPRICORN)!=0
    @sprites["BLUAPRICORN"]=IconSprite.new(30,138,@viewport)
    @sprites["BLUAPRICORN"].setBitmap("Graphics/Pictures/BLUAPRICORN")
    @sprites["BLUAPRICORN"].z=2  
  end 
  if $PokemonBag.pbQuantity(PBItems::GRNAPRICORN)!=0
    @sprites["GRNAPRICORN"]=IconSprite.new(125,170,@viewport)
    @sprites["GRNAPRICORN"].setBitmap("Graphics/Pictures/GRNAPRICORN")
    @sprites["GRNAPRICORN"].z=2  
  end
  if $PokemonBag.pbQuantity(PBItems::PNKAPRICORN)!=0
    @sprites["PNKAPRICORN"]=IconSprite.new(30,202,@viewport)
    @sprites["PNKAPRICORN"].setBitmap("Graphics/Pictures/PNKAPRICORN")
    @sprites["PNKAPRICORN"].z=2  
  end
  if $PokemonBag.pbQuantity(PBItems::WHTAPRICORN)!=0
    @sprites["WHTAPRICORN"]=IconSprite.new(125,234,@viewport)
    @sprites["WHTAPRICORN"].setBitmap("Graphics/Pictures/WHTAPRICORN")
    @sprites["WHTAPRICORN"].z=2  
  end  
  if $PokemonBag.pbQuantity(PBItems::BLKAPRICORN)!=0
    @sprites["BLKAPRICORN"]=IconSprite.new(30,266,@viewport)
    @sprites["BLKAPRICORN"].setBitmap("Graphics/Pictures/BLKAPRICORN")
    @sprites["BLKAPRICORN"].z=2  
  end  

 end 
 
 
 def pbUpdate
  if @text_update==true  
   @sprites["overlay"].bitmap.clear
   pbSetSystemFont(@sprites["overlay"].bitmap)
   
   
    base=Color.new(12*8,12*8,12*8)
    base1=Color.new(255,255,240)
    base2=Color.new(128,128,128)
  textpos=[
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::REDAPRICORN)),107,97,1,base,base2],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::YLWAPRICORN)),203,130,1,base,base2],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::BLUAPRICORN)),107,160,1,base,base2],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::GRNAPRICORN)),203,193,1,base,base2],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::PNKAPRICORN)),108,223,1,base,base2],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::WHTAPRICORN)),203,256,1,base,base2],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::BLKAPRICORN)),108,288,1,base,base2],
  [_ISPRINTF("Apricorn Box"),180,335,1,base1,base2],
  ]
   pbDrawTextPositions(@sprites["overlay"].bitmap,textpos)
   @text_update=false
   @leave=true if @exit==true
   else
   end
   pbUpdateSpriteHash(@sprites)
  end
 
  def pbEndScene
   pbDisposeSpriteHash(@sprites)
   @viewport.dispose
  end
 
 
 
 
  def pbScene
  loop do
    Graphics.update
    Input.update
    pbUpdate
    
    if @leave==true
      @exit=false
      pbWait(20)
      break @leave=false
    end  
    if Input.trigger?(Input::LEFT)
        @choose-=1
        @choose=8 if @choose<=0
        @sprites["up"].x=@posx[@choose]
        @sprites["up"].y=@posy[@choose]
    elsif Input.trigger?(Input::RIGHT)
        @choose+=1
        @choose=1 if @choose>=9
        @sprites["up"].x=@posx[@choose]
        @sprites["up"].y=@posy[@choose]
    elsif Input.trigger?(Input::DOWN)
        @choose+=2
        @choose=1 if @choose>=9
        @sprites["up"].x=@posx[@choose]
        @sprites["up"].y=@posy[@choose]      
    elsif Input.trigger?(Input::UP)
        @choose-=2
        @choose=8 if @choose<=0
        @sprites["up"].x=@posx[@choose]
        @sprites["up"].y=@posy[@choose]
    elsif @sprites["up"].x==@posx[8] && @sprites["up"].y==@posy[8] && Input.trigger?(Input::C) || Input.trigger?(Input::B)
      break
    end
    
  interp=pbMapInterpreter
  thisEvent=interp.get_character(0)  
    
 if thisEvent.name=="Kurt"

      if @sprites["up"].x==@posx[1] && @sprites["up"].y==@posy[1] && $PokemonBag.pbQuantity(PBItems::REDAPRICORN)>=1 && Input.trigger?(Input::C)
       if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Red Apricorn?"))
     itemqty=$PokemonBag.pbQuantity(PBItems::REDAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::REDAPRICORN,qty)
        $game_variables[ApricornColorNumber]=1
        $game_variables[Apricornqty]=qty
        @sprites["REDAPRICORN"].dispose if $PokemonBag.pbQuantity(PBItems::REDAPRICORN)==0
        #pbMapInterpreter.pbSetSelfSwitch(thisEvent.id,"A",true)
        @text_update=true
        @exit=true
     else
         Kernel.pbMessage(_INTL("Please choose an Apricorn."))
       end
      end
    
       if @sprites["up"].x==@posx[2] && @sprites["up"].y==@posy[2] && $PokemonBag.pbQuantity(PBItems::YLWAPRICORN)>=1 && Input.trigger?(Input::C)
       if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Ylw Apricorn?"))
     itemqty=$PokemonBag.pbQuantity(PBItems::YLWAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::YLWAPRICORN,qty)
        $game_variables[ApricornColorNumber]=2
        $game_variables[Apricornqty]=qty
        @sprites["YLWAPRICORN"].dispose if $PokemonBag.pbQuantity(PBItems::YLWAPRICORN)==0
        #pbMapInterpreter.pbSetSelfSwitch(thisEvent.id,"A",true)
        @text_update=true
        @exit=true
        break
      else
         Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
    end
    
       if @sprites["up"].x==@posx[3] && @sprites["up"].y==@posy[3] && $PokemonBag.pbQuantity(PBItems::BLUAPRICORN)>=1 && Input.trigger?(Input::C)
       if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Blu Apricorn?"))
     itemqty=$PokemonBag.pbQuantity(PBItems::BLUAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::BLUAPRICORN,qty)
        $game_variables[ApricornColorNumber]=3
        $game_variables[Apricornqty]=qty
        @sprites["BLUAPRICORN"].dispose if $PokemonBag.pbQuantity(PBItems::BLUAPRICORN)==0
        #pbMapInterpreter.pbSetSelfSwitch(thisEvent.id,"A",true)
        @text_update=true
        @exit=true
        break
      else
         Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
    end
    
       if @sprites["up"].x==@posx[4] && @sprites["up"].y==@posy[4] && $PokemonBag.pbQuantity(PBItems::GRNAPRICORN)>=1 && Input.trigger?(Input::C)
       if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Grn Apricorn?"))
     itemqty=$PokemonBag.pbQuantity(PBItems::GRNAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::GRNAPRICORN,qty)
        $game_variables[ApricornColorNumber]=4
        $game_variables[Apricornqty]=qty
        @sprites["GRNAPRICORN"].dispose if $PokemonBag.pbQuantity(PBItems::GRNAPRICORN)==0
        #pbMapInterpreter.pbSetSelfSwitch(thisEvent.id,"A",true)
        @text_update=true
        @exit=true
        break
      else
         Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
    end    
    
       if @sprites["up"].x==@posx[5] && @sprites["up"].y==@posy[5] && $PokemonBag.pbQuantity(PBItems::PNKAPRICORN)>=1 && Input.trigger?(Input::C)
       if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Pnk Apricorn?"))
     itemqty=$PokemonBag.pbQuantity(PBItems::PNKAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::PNKAPRICORN,qty)
        $game_variables[ApricornColorNumber]=5
        $game_variables[Apricornqty]=qty
        @sprites["PNKAPRICORN"].dispose if $PokemonBag.pbQuantity(PBItems::PNKAPRICORN)==0
        #pbMapInterpreter.pbSetSelfSwitch(thisEvent.id,"A",true)
        @text_update=true
        @exit=true
        break
      else
         Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
    end    
    
       if @sprites["up"].x==@posx[6] && @sprites["up"].y==@posy[6] && $PokemonBag.pbQuantity(PBItems::WHTAPRICORN)>=1 && Input.trigger?(Input::C)
       if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Wht Apricorn?"))
     itemqty=$PokemonBag.pbQuantity(PBItems::WHTAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::WHTAPRICORN,qty)
        $game_variables[ApricornColorNumber]=6
        $game_variables[Apricornqty]=qty
        @sprites["WHTAPRICORN"].dispose if $PokemonBag.pbQuantity(PBItems::WHTAPRICORN)==0
        #pbMapInterpreter.pbSetSelfSwitch(thisEvent.id,"A",true)
        @text_update=true
        @exit=true
        break
      else
         Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
    end   
    
       if @sprites["up"].x==@posx[7] && @sprites["up"].y==@posy[7] && $PokemonBag.pbQuantity(PBItems::WHTAPRICORN)>=1 && Input.trigger?(Input::C)
       if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Blk Apricorn?"))
     itemqty=$PokemonBag.pbQuantity(PBItems::BLKAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::BLKAPRICORN,qty)
        $game_variables[ApricornColorNumber]=7
        $game_variables[Apricornqty]=qty
        @sprites["BLKAPRICORN"].dispose if $PokemonBag.pbQuantity(PBItems::BLKAPRICORN)==0
        #pbMapInterpreter.pbSetSelfSwitch(thisEvent.id,"A",true)
        @text_update=true
        @exit=true
        break
      else
         Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
    end  
    
    
    
    
    
    
    
    end
 

    
    
    
    end    
  end
end

    class ApricornScreen
         def initialize(scene)
                @scene = scene
         end
              
         def pbStartScreen
                @scene.pbStartScene
                @scene.pbScene
                @scene.pbEndScene
         end
    end

def pbPokeballTime
  if(1<=$game_variables[ApricornColorNumber] && $game_variables[ApricornColorNumber]<=7)
    apricornBall=[PBItems::LEVELBALL,PBItems::MOONBALL,PBItems::LUREBALL,PBItems::FRIENDBALL,
    PBItems::LOVEBALL,PBItems::FASTBALL,PBItems::HEAVYBALL][$game_variables[ApricornColorNumber]-1]
    Kernel.pbReceiveItem(apricornBall,$game_variables[Apricornqty])
    $game_variables[Apricornqty]=0
  end
end

    def pbApricorn
          scene=Apricorn.new
          screen=ApricornScreen.new(scene)
          pbFadeOutIn(99999) { 
          screen.pbStartScreen
          }
    end
And this goes into your settings page
Code:
#===============================================================================
# * These are custom settings for the Apricorn Box.
# * "ApricornColorNumber" defines which Apricorn color represents which number
#      set it to what ever variable you want.
# * "Apricornqty" defines the quantity of the Apricorn which you want to make
#      again set it to what ever variable you want.
# * The "Choose" switch is to define if the player can only view what is inside
#      the Apricorn box, or choose an item inside. 
#===============================================================================
ApricornColorNumber=50
Apricornqty=51
Mini tut
Code:
Okay, so here is how you use it.
pbPokeballTime
 must be used with a time sensitive event, because it is not like he can craft a pokeball in a blink of an eye like magic.

To call upon the screen you must use
pbApricorn
To make the Apricorn box into an item:
Code:
ItemHandlers::UseFromBag.add(:APRICORNBOX,proc{|item|
   pbApricorn
   next 1 # Continue
})
^ put that in PokemonItemEffects
under
Code:
ItemHandlers::UseFromBag.add(:TOWNMAP,proc{|item|
   pbShowMap
   next 1 # Continue
})
Also put this:
Code:
ItemHandlers::UseInField.add(:APRICORNBOX,proc{|item|
   pbApricorn
})
under:
Code:
ItemHandlers::UseInField.add(:OLDROD,proc{|item|
   terrain=Kernel.pbFacingTerrainTag
   if !pbIsWaterTag?(terrain)
     Kernel.pbMessage(_INTL("Can't use that here."))
     next
   end
   encounter=$PokemonEncounters.hasEncounter?(4)
   if pbFishing(encounter)
     pbEncounter(4)
   end
})
Put the attachment inside your Pictures folder(so it will be Pictures/Apricorn).
Attached Files
File Type: rar Apricorn.rar‎ (47.5 KB, 69 views) (Save to Dropbox)
__________________
Pokemon Serenity is my fangame name.
name decided 12/15/09
Currently helping:
Pokemon ebony
and
Xenotime:

Last edited by zingzags; August 22nd, 2012 at 01:59 PM. Reason: Forgot to add mini-tut
Reply With Quote
  #2    
Old August 17th, 2012, 12:59 PM
venom12's Avatar
venom12
Pokemon Crystal Rain Relased
 
Join Date: Sep 2006
Age: 23
Gender: Male
Nature: Adamant
Send a message via Windows Live Messenger to venom12
Cool Script man, i will use it of course, thanks.
__________________



Reply With Quote
  #3    
Old August 17th, 2012, 01:08 PM
D. Lawride's Avatar
D. Lawride
Audi Famam Illius, Scriptor!
 
Join Date: Jul 2009
Location: Lusolandia - I kid, Portugal
Gender: Male
Nature: Relaxed
Curiously enough, I had to create something along these lines for my project in the Game Creation Event. I did it through Common Event tho xD
__________________
Reply With Quote
  #4    
Old August 17th, 2012, 01:12 PM
zingzags's Avatar
zingzags
Creator or Pokemon Serenity
 
Join Date: Jan 2009
Location: Boston
Age: 20
Nature: Adamant
Quote:
Originally Posted by venom12 View Post
Cool Script man, i will use it of course, thanks.
No problem, the next thing I want to try to make is the blender.
Quote:
Originally Posted by D. Lawride View Post
Curiously enough, I had to create something along these lines for my project in the Game Creation Event. I did it through Common Event tho xD
Lol ;p, it can be done trough a common event but I wanted to make it HG-SS style, oh forgot I need to make a mini tut.
__________________
Pokemon Serenity is my fangame name.
name decided 12/15/09
Currently helping:
Pokemon ebony
and
Xenotime:
Reply With Quote
  #5    
Old August 18th, 2012, 09:15 AM
Rayd12smitty's Avatar
Rayd12smitty
Shadow Maker
 
Join Date: Dec 2011
Gender: Male
wow Zing-Zangs you really are a great scripter. You just keep coming out with great new stuff. I will definitely use this, and most of your other scripts in my game, and any I make in the future. Great job
__________________
Reply With Quote
  #6    
Old August 19th, 2012, 05:21 AM
FL's Avatar
FL
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Interesting, but you can put all in one code, it is easier for people install, Quick example:

Code:
# Apricorn system by zingzags
# credits will be nice!

# Okay, so here is how you use it.
# pbPokeballTime
# must be used with a time sensitive event, because it is not like he can craft a pokeball in a blink of an eye like magic.

# To call upon the screen you must use
# pbApricorn
# Also you must set what ever switch you defined "Choose" to "ON" so that you can craft a pokeball in the same event.

#===============================================================================
# * These are custom settings for the Apricorn Box.
# * "ApricornColorNumber" defines which Apricorn color represents which number
#      set it to what ever variable you want.
# * "Apricornqty" defines the quantity of the Apricorn which you want to make
#      again set it to what ever variable you want.
# * The "Choose" switch is to define if the player can only view what is inside
#      the Apricorn box, or choose an item inside. 
#===============================================================================
ApricornColorNumber=50
Apricornqty=51
Choose=50

class Apricorn
  
  def pbUpdate
   pbUpdateSpriteHash(@sprites)
  end
 
  def pbEndScene
   pbDisposeSpriteHash(@sprites)
   @viewport.dispose
  end

class TrainerBgPlane < AnimatedPlane
 
end
  def pbStartScene
    @sprites={}
    @posx={}
    @posy={}
    @choose=1
    @posx[1],@posy[1]=30,0
    @posx[2],@posy[2]=120,30
    @posx[3],@posy[3]=30,65
    @posx[4],@posy[4]=120,90
    @posx[5],@posy[5]=30,130
    @posx[6],@posy[6]=120,155
    @posx[7],@posy[7]=30,190
    
    @viewport=Viewport.new(0,0,Graphics.width, Graphics.height)
    @viewport.z=99999
    
    @sprites["bg"]=IconSprite.new(0,0,@viewport)
    @sprites["bg"].setBitmap("Graphics/Pictures/Apricorn/Apricorn_menu")
    @sprites["bg"].z=1
    @sprites["up"]=AnimatedSprite.create("Graphics/Pictures/Apricorn/uparrow1",10,3,@viewport)
    @sprites["up"].x=30
    @sprites["up"].y=0
    @sprites["up"].z=3
    @sprites["up"].play
    @sprites["abg"]=TrainerBgPlane.new(@viewport)
    @sprites["abg"].setBitmap("Graphics/Pictures/Apricorn/ApricornBG")
    @sprites["abg"].z=0
    
    @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
    @sprites["overlay"].z=2
    overlay=@sprites["overlay"].bitmap
    overlay.clear
    base=Color.new(12*8,12*8,12*8)
    base1=Color.new(255,255,240)
    shadow=Color.new(12*8,12*8,12*8)
    pbSetSystemFont(overlay)
    textpos=[
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::REDAPRICORN)),102,94,1,base,shadow],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::YLWAPRICORN)),198,127,1,base,shadow],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::BLUAPRICORN)),102,160,1,base,shadow],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::GRNAPRICORN)),198,190,1,base,shadow],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::PNKAPRICORN)),102,223,1,base,shadow],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::WHTAPRICORN)),198,253,1,base,shadow],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::BLKAPRICORN)),102,287,1,base,shadow],
  [_ISPRINTF("Apricorn Box"),180,333,1,base1,shadow],
  ]
 pbDrawTextPositions(overlay,textpos)
 end 
  
  def pbScene
  loop do
    Graphics.update
    Input.update
    pbUpdate
    @sprites["abg"].update
    
    if Input.trigger?(Input::LEFT)
            @choose-=1
            @choose=7 if @choose<=0
            @sprites["up"].x=@posx[@choose]
            @sprites["up"].y=@posy[@choose]
    end


    if Input.trigger?(Input::RIGHT)
        @choose+=1
        @choose=1 if @choose>=8
        @sprites["up"].x=@posx[@choose]
        @sprites["up"].y=@posy[@choose]
    end

    if Input.trigger?(Input::B)
        break
    end


if $game_switches[Choose]==true  
    if @sprites["up"].x==@posx[1] && @sprites["up"].y==@posy[1] && $PokemonBag.pbQuantity(PBItems::REDAPRICORN)>=1
      if Input.trigger?(Input::C)
       if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Red Apricorn?"))
     itemqty=$PokemonBag.pbQuantity(PBItems::REDAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::REDAPRICORN,qty)
        $game_variables[ApricornColorNumber]=1
        $game_variables[Apricornqty]=qty
        $game_switches[Choose]=false
        pbWait(30)
        break
      else
         Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
    end
  end
  
    
    if @sprites["up"].x==@posx[2] && @sprites["up"].y==@posy[2] && $PokemonBag.pbQuantity(PBItems::YLWAPRICORN)>=1
      if Input.trigger?(Input::C)
         if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Yellow Apricorn?"))
      itemqty=$PokemonBag.pbQuantity(PBItems::YLWAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::YLWAPRICORN,qty)
        $game_variables[ApricornColorNumber]=2
        $game_variables[Apricornqty]=qty
        $game_switches[Choose]=false
        pbWait(30)
        break
      else
        Kernel.pbMessage(_INTL("Please choose an Apricorn."))
       end
      end
     end
    
    if @sprites["up"].x==@posx[3] && @sprites["up"].y==@posy[3] && $PokemonBag.pbQuantity(PBItems::BLUAPRICORN)>=1
      if Input.trigger?(Input::C)
        if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Blue Apricorn?"))
      itemqty=$PokemonBag.pbQuantity(PBItems::BLUAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::BLUAPRICORN,qty)
        $game_variables[ApricornColorNumber]=3
        $game_variables[Apricornqty]=qty  
        $game_switches[Choose]=false
         pbWait(30)
        break
      else
        Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
      
      end
    end

    if @sprites["up"].x==@posx[4] && @sprites["up"].y==@posy[4] && $PokemonBag.pbQuantity(PBItems::GRNAPRICORN)>=1
      if Input.trigger?(Input::C)
        if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Green Apricorn?"))
      itemqty=$PokemonBag.pbQuantity(PBItems::GRNAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::GRNAPRICORN,qty)
        $game_variables[ApricornColorNumber]=4
        $game_variables[Apricornqty]=qty
        $game_switches[Choose]=false
        pbWait(30)
        break
      else
        Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
      
      end
    end

    if @sprites["up"].x==@posx[5] && @sprites["up"].y==@posy[5] && $PokemonBag.pbQuantity(PBItems::PNKAPRICORN)>=1
      if Input.trigger?(Input::C)
        if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Pink Apricorn?"))
      itemqty=$PokemonBag.pbQuantity(PBItems::PNKAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::PNKAPRICORN,qty)
        $game_variables[ApricornColorNumber]=5
        $game_variables[Apricornqty]=qty
        $game_switches[Choose]=false
        pbWait(30)
        break
      else
        Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
      
      end
    end

    if @sprites["up"].x==@posx[6] && @sprites["up"].y==@posy[6] && $PokemonBag.pbQuantity(PBItems::WHTAPRICORN)>=1
      if Input.trigger?(Input::C)
        if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a White Apricorn?"))
      itemqty=$PokemonBag.pbQuantity(PBItems::WHTAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::WHTAPRICORN,qty)
        $game_variables[ApricornColorNumber]=6
        $game_variables[Apricornqty]=qty
        $game_switches[Choose]=false
        pbWait(30)
        break
      else
        Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
      
      end
    end

    if @sprites["up"].x==@posx[7] && @sprites["up"].y==@posy[7] && $PokemonBag.pbQuantity(PBItems::BLKAPRICORN)>=1
      if Input.trigger?(Input::C)
        if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Black Apricorn?"))
      itemqty=$PokemonBag.pbQuantity(PBItems::BLKAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::BLKAPRICORN,qty)
        $game_variables[ApricornColorNumber]=7
        $game_variables[Apricornqty]=qty
        $game_switches[Choose]=false
        pbWait(30)
        break
      else
        Kernel.pbMessage(_INTL("Please choose an Apricorn."))
        end
      end
     end
    end
      
     
    end
  end
  
end

    class ApricornScreen
         def initialize(scene)
                @scene = scene
         end
              
         def pbStartScreen
                @scene.pbStartScene
                @scene.pbScene
                @scene.pbEndScene
         end

    end

  def pbPokeballTime
     if $game_variables[ApricornColorNumber]==1
         Kernel.pbReceiveItem(PBItems::LEVELBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==2    
         Kernel.pbReceiveItem(PBItems::MOONBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==3    
         Kernel.pbReceiveItem(PBItems::LUREBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==4    
         Kernel.pbReceiveItem(PBItems::FRIENDBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==5    
         Kernel.pbReceiveItem(PBItems::LOVEBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==6    
         Kernel.pbReceiveItem(PBItems::FASTBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==7    
         Kernel.pbReceiveItem(PBItems::HEAVYBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
       end
       $game_variables[ApricornColorNumber]=0
       $game_variables[Apricornqty]=0
  end

    def pbApricorn
          scene=Apricorn.new
          screen=ApricornScreen.new(scene)
          pbFadeOutIn(99999) { 
          screen.pbStartScreen
          }
    end

ItemHandlers::UseFromBag.add(:APRICORNBOX,proc{|item|
   pbApricorn
   next 1 # Continue
})


ItemHandlers::UseInField.add(:APRICORNBOX,proc{|item|
   pbApricorn
})
And, besides this, the code can be improved, like changing

Code:
def pbPokeballTime
     if $game_variables[ApricornColorNumber]==1
         Kernel.pbReceiveItem(PBItems::LEVELBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==2    
         Kernel.pbReceiveItem(PBItems::MOONBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==3    
         Kernel.pbReceiveItem(PBItems::LUREBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==4    
         Kernel.pbReceiveItem(PBItems::FRIENDBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==5    
         Kernel.pbReceiveItem(PBItems::LOVEBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==6    
         Kernel.pbReceiveItem(PBItems::FASTBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==7    
         Kernel.pbReceiveItem(PBItems::HEAVYBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
       end
       $game_variables[ApricornColorNumber]=0
       $game_variables[Apricornqty]=0
  end
to
Code:
def pbPokeballTime
  if(1<=$game_variables[ApricornColorNumber] && $game_variables[ApricornColorNumber]<=7)
    apricornBall=[PBItems::LEVELBALL,PBItems::MOONBALL,PBItems::LUREBALL,PBItems::FRIENDBALL,
        PBItems::LOVEBALL,PBItems::FASTBALL,PBItems::HEAVYBALL][$game_variables[ApricornColorNumber]-1]
    Kernel.pbReceiveItem(apricornBall,$game_variables[Apricornqty])
    $game_variables[Apricornqty]=0
  end
end
__________________
Reply With Quote
  #7    
Old August 19th, 2012, 06:34 AM
zingzags's Avatar
zingzags
Creator or Pokemon Serenity
 
Join Date: Jan 2009
Location: Boston
Age: 20
Nature: Adamant
Quote:
Originally Posted by FL . View Post
Interesting, but you can put all in one code, it is easier for people install, Quick example:

Code:
# Apricorn system by zingzags
# credits will be nice!

# Okay, so here is how you use it.
# pbPokeballTime
# must be used with a time sensitive event, because it is not like he can craft a pokeball in a blink of an eye like magic.

# To call upon the screen you must use
# pbApricorn
# Also you must set what ever switch you defined "Choose" to "ON" so that you can craft a pokeball in the same event.

#===============================================================================
# * These are custom settings for the Apricorn Box.
# * "ApricornColorNumber" defines which Apricorn color represents which number
#      set it to what ever variable you want.
# * "Apricornqty" defines the quantity of the Apricorn which you want to make
#      again set it to what ever variable you want.
# * The "Choose" switch is to define if the player can only view what is inside
#      the Apricorn box, or choose an item inside. 
#===============================================================================
ApricornColorNumber=50
Apricornqty=51
Choose=50

class Apricorn
  
  def pbUpdate
   pbUpdateSpriteHash(@sprites)
  end
 
  def pbEndScene
   pbDisposeSpriteHash(@sprites)
   @viewport.dispose
  end

class TrainerBgPlane < AnimatedPlane
 
end
  def pbStartScene
    @sprites={}
    @posx={}
    @posy={}
    @choose=1
    @posx[1],@posy[1]=30,0
    @posx[2],@posy[2]=120,30
    @posx[3],@posy[3]=30,65
    @posx[4],@posy[4]=120,90
    @posx[5],@posy[5]=30,130
    @posx[6],@posy[6]=120,155
    @posx[7],@posy[7]=30,190
    
    @viewport=Viewport.new(0,0,Graphics.width, Graphics.height)
    @viewport.z=99999
    
    @sprites["bg"]=IconSprite.new(0,0,@viewport)
    @sprites["bg"].setBitmap("Graphics/Pictures/Apricorn/Apricorn_menu")
    @sprites["bg"].z=1
    @sprites["up"]=AnimatedSprite.create("Graphics/Pictures/Apricorn/uparrow1",10,3,@viewport)
    @sprites["up"].x=30
    @sprites["up"].y=0
    @sprites["up"].z=3
    @sprites["up"].play
    @sprites["abg"]=TrainerBgPlane.new(@viewport)
    @sprites["abg"].setBitmap("Graphics/Pictures/Apricorn/ApricornBG")
    @sprites["abg"].z=0
    
    @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
    @sprites["overlay"].z=2
    overlay=@sprites["overlay"].bitmap
    overlay.clear
    base=Color.new(12*8,12*8,12*8)
    base1=Color.new(255,255,240)
    shadow=Color.new(12*8,12*8,12*8)
    pbSetSystemFont(overlay)
    textpos=[
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::REDAPRICORN)),102,94,1,base,shadow],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::YLWAPRICORN)),198,127,1,base,shadow],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::BLUAPRICORN)),102,160,1,base,shadow],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::GRNAPRICORN)),198,190,1,base,shadow],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::PNKAPRICORN)),102,223,1,base,shadow],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::WHTAPRICORN)),198,253,1,base,shadow],
  [_ISPRINTF("{1:3d}",$PokemonBag.pbQuantity(PBItems::BLKAPRICORN)),102,287,1,base,shadow],
  [_ISPRINTF("Apricorn Box"),180,333,1,base1,shadow],
  ]
 pbDrawTextPositions(overlay,textpos)
 end 
  
  def pbScene
  loop do
    Graphics.update
    Input.update
    pbUpdate
    @sprites["abg"].update
    
    if Input.trigger?(Input::LEFT)
            @choose-=1
            @choose=7 if @choose<=0
            @sprites["up"].x=@posx[@choose]
            @sprites["up"].y=@posy[@choose]
    end


    if Input.trigger?(Input::RIGHT)
        @choose+=1
        @choose=1 if @choose>=8
        @sprites["up"].x=@posx[@choose]
        @sprites["up"].y=@posy[@choose]
    end

    if Input.trigger?(Input::B)
        break
    end


if $game_switches[Choose]==true  
    if @sprites["up"].x==@posx[1] && @sprites["up"].y==@posy[1] && $PokemonBag.pbQuantity(PBItems::REDAPRICORN)>=1
      if Input.trigger?(Input::C)
       if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Red Apricorn?"))
     itemqty=$PokemonBag.pbQuantity(PBItems::REDAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::REDAPRICORN,qty)
        $game_variables[ApricornColorNumber]=1
        $game_variables[Apricornqty]=qty
        $game_switches[Choose]=false
        pbWait(30)
        break
      else
         Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
    end
  end
  
    
    if @sprites["up"].x==@posx[2] && @sprites["up"].y==@posy[2] && $PokemonBag.pbQuantity(PBItems::YLWAPRICORN)>=1
      if Input.trigger?(Input::C)
         if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Yellow Apricorn?"))
      itemqty=$PokemonBag.pbQuantity(PBItems::YLWAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::YLWAPRICORN,qty)
        $game_variables[ApricornColorNumber]=2
        $game_variables[Apricornqty]=qty
        $game_switches[Choose]=false
        pbWait(30)
        break
      else
        Kernel.pbMessage(_INTL("Please choose an Apricorn."))
       end
      end
     end
    
    if @sprites["up"].x==@posx[3] && @sprites["up"].y==@posy[3] && $PokemonBag.pbQuantity(PBItems::BLUAPRICORN)>=1
      if Input.trigger?(Input::C)
        if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Blue Apricorn?"))
      itemqty=$PokemonBag.pbQuantity(PBItems::BLUAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::BLUAPRICORN,qty)
        $game_variables[ApricornColorNumber]=3
        $game_variables[Apricornqty]=qty  
        $game_switches[Choose]=false
         pbWait(30)
        break
      else
        Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
      
      end
    end

    if @sprites["up"].x==@posx[4] && @sprites["up"].y==@posy[4] && $PokemonBag.pbQuantity(PBItems::GRNAPRICORN)>=1
      if Input.trigger?(Input::C)
        if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Green Apricorn?"))
      itemqty=$PokemonBag.pbQuantity(PBItems::GRNAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::GRNAPRICORN,qty)
        $game_variables[ApricornColorNumber]=4
        $game_variables[Apricornqty]=qty
        $game_switches[Choose]=false
        pbWait(30)
        break
      else
        Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
      
      end
    end

    if @sprites["up"].x==@posx[5] && @sprites["up"].y==@posy[5] && $PokemonBag.pbQuantity(PBItems::PNKAPRICORN)>=1
      if Input.trigger?(Input::C)
        if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Pink Apricorn?"))
      itemqty=$PokemonBag.pbQuantity(PBItems::PNKAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::PNKAPRICORN,qty)
        $game_variables[ApricornColorNumber]=5
        $game_variables[Apricornqty]=qty
        $game_switches[Choose]=false
        pbWait(30)
        break
      else
        Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
      
      end
    end

    if @sprites["up"].x==@posx[6] && @sprites["up"].y==@posy[6] && $PokemonBag.pbQuantity(PBItems::WHTAPRICORN)>=1
      if Input.trigger?(Input::C)
        if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a White Apricorn?"))
      itemqty=$PokemonBag.pbQuantity(PBItems::WHTAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::WHTAPRICORN,qty)
        $game_variables[ApricornColorNumber]=6
        $game_variables[Apricornqty]=qty
        $game_switches[Choose]=false
        pbWait(30)
        break
      else
        Kernel.pbMessage(_INTL("Please choose an Apricorn."))
      end
      
      end
    end

    if @sprites["up"].x==@posx[7] && @sprites["up"].y==@posy[7] && $PokemonBag.pbQuantity(PBItems::BLKAPRICORN)>=1
      if Input.trigger?(Input::C)
        if Kernel.pbConfirmMessage(_INTL("Are you sure you want me to use a Black Apricorn?"))
      itemqty=$PokemonBag.pbQuantity(PBItems::BLKAPRICORN)
      params=ChooseNumberParams.new
      params.setRange(1,itemqty)
      params.setInitialValue(itemqty)
      params.setCancelValue(0)
      qty=Kernel.pbMessageChooseNumber(
         _INTL("How much do you want to give?"),params
      )
        $PokemonBag.pbDeleteItem(PBItems::BLKAPRICORN,qty)
        $game_variables[ApricornColorNumber]=7
        $game_variables[Apricornqty]=qty
        $game_switches[Choose]=false
        pbWait(30)
        break
      else
        Kernel.pbMessage(_INTL("Please choose an Apricorn."))
        end
      end
     end
    end
      
     
    end
  end
  
end

    class ApricornScreen
         def initialize(scene)
                @scene = scene
         end
              
         def pbStartScreen
                @scene.pbStartScene
                @scene.pbScene
                @scene.pbEndScene
         end

    end

  def pbPokeballTime
     if $game_variables[ApricornColorNumber]==1
         Kernel.pbReceiveItem(PBItems::LEVELBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==2    
         Kernel.pbReceiveItem(PBItems::MOONBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==3    
         Kernel.pbReceiveItem(PBItems::LUREBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==4    
         Kernel.pbReceiveItem(PBItems::FRIENDBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==5    
         Kernel.pbReceiveItem(PBItems::LOVEBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==6    
         Kernel.pbReceiveItem(PBItems::FASTBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==7    
         Kernel.pbReceiveItem(PBItems::HEAVYBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
       end
       $game_variables[ApricornColorNumber]=0
       $game_variables[Apricornqty]=0
  end

    def pbApricorn
          scene=Apricorn.new
          screen=ApricornScreen.new(scene)
          pbFadeOutIn(99999) { 
          screen.pbStartScreen
          }
    end

ItemHandlers::UseFromBag.add(:APRICORNBOX,proc{|item|
   pbApricorn
   next 1 # Continue
})


ItemHandlers::UseInField.add(:APRICORNBOX,proc{|item|
   pbApricorn
})
And, besides this, the code can be improved, like changing

Code:
def pbPokeballTime
     if $game_variables[ApricornColorNumber]==1
         Kernel.pbReceiveItem(PBItems::LEVELBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==2    
         Kernel.pbReceiveItem(PBItems::MOONBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==3    
         Kernel.pbReceiveItem(PBItems::LUREBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==4    
         Kernel.pbReceiveItem(PBItems::FRIENDBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==5    
         Kernel.pbReceiveItem(PBItems::LOVEBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==6    
         Kernel.pbReceiveItem(PBItems::FASTBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
     elsif $game_variables[ApricornColorNumber]==7    
         Kernel.pbReceiveItem(PBItems::HEAVYBALL,$game_variables[Apricornqty])
         $game_variables[Apricornqty]=0
       end
       $game_variables[ApricornColorNumber]=0
       $game_variables[Apricornqty]=0
  end
to
Code:
def pbPokeballTime
  if(1<=$game_variables[ApricornColorNumber] && $game_variables[ApricornColorNumber]<=7)
    apricornBall=[PBItems::LEVELBALL,PBItems::MOONBALL,PBItems::LUREBALL,PBItems::FRIENDBALL,
        PBItems::LOVEBALL,PBItems::FASTBALL,PBItems::HEAVYBALL][$game_variables[ApricornColorNumber]-1]
    Kernel.pbReceiveItem(apricornBall,$game_variables[Apricornqty])
    $game_variables[Apricornqty]=0
  end
end
I know it could have been improved a lot. It was something old I found laying around. Thanks FL.!
__________________
Pokemon Serenity is my fangame name.
name decided 12/15/09
Currently helping:
Pokemon ebony
and
Xenotime:
Reply With Quote
  #8    
Old August 21st, 2012, 08:13 PM
zingzags's Avatar
zingzags
Creator or Pokemon Serenity
 
Join Date: Jan 2009
Location: Boston
Age: 20
Nature: Adamant
I am currently updating the script, I am trying to make it more easier to use, and to actually work like HG/SS with time sensitive trees.
__________________
Pokemon Serenity is my fangame name.
name decided 12/15/09
Currently helping:
Pokemon ebony
and
Xenotime:
Reply With Quote
  #9    
Old August 22nd, 2012, 01:58 PM
zingzags's Avatar
zingzags
Creator or Pokemon Serenity
 
Join Date: Jan 2009
Location: Boston
Age: 20
Nature: Adamant
Update:
All you need to do now is call the event Kurt, no more switches, you still have to use the variables.
Next to work on:
Kurt's number
Apricorn Trees
Make Kurt Time sensitive.
__________________
Pokemon Serenity is my fangame name.
name decided 12/15/09
Currently helping:
Pokemon ebony
and
Xenotime:
Reply With Quote
  #10    
Old August 22nd, 2012, 02:02 PM
zingzags's Avatar
zingzags
Creator or Pokemon Serenity
 
Join Date: Jan 2009
Location: Boston
Age: 20
Nature: Adamant
The apricorn pictures goes into the Pictures folder, and the rest goes into Pictures/Apricorn
Attached Files
File Type: rar Apricorn.rar‎ (66.6 KB, 11 views) (Save to Dropbox)
__________________
Pokemon Serenity is my fangame name.
name decided 12/15/09
Currently helping:
Pokemon ebony
and
Xenotime:
Reply With Quote
Reply
Quick Reply

Sponsored Links


Advertise here
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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 04:56 AM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.