• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Apricorn System for Essentials

zingzags

PokemonGDX creator
536
Posts
15
Years
  • 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.
    [B]pbPokeballTime[/B]
     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
    [B]pbApricorn[/B]

    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).
     
    Last edited:

    venom12

    Pokemon Crystal Rain Relased
    476
    Posts
    17
    Years
    • Age 33
    • Seen Dec 28, 2023
    Cool Script man, i will use it of course, thanks.
     

    D. Lawride

    Audi Famam Illius, Scriptor!
    577
    Posts
    14
    Years
  • 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
     

    zingzags

    PokemonGDX creator
    536
    Posts
    15
    Years
  • Cool Script man, i will use it of course, thanks.
    No problem, the next thing I want to try to make is the blender.
    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.
     

    Rayd12smitty

    Shadow Maker
    645
    Posts
    12
    Years
    • Seen Feb 21, 2016
    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
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    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 [B]"Choose"[/B] to [B]"ON"[/B] 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
     

    zingzags

    PokemonGDX creator
    536
    Posts
    15
    Years
  • 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 [B]"Choose"[/B] to [B]"ON"[/B] 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.!
     

    zingzags

    PokemonGDX creator
    536
    Posts
    15
    Years
  • 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.
     

    zingzags

    PokemonGDX creator
    536
    Posts
    15
    Years
  • 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.
     

    zingzags

    PokemonGDX creator
    536
    Posts
    15
    Years
  • The apricorn pictures goes into the Pictures folder, and the rest goes into Pictures/Apricorn
     

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • Excuse me, sorry to necropost.

    But someone have that 'Apricorn.rar'?
     

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • Well, so are you looking for Apricorn icons?
    Because I am not sure what are you looking for.

    Apricorns and box here
    https://files.fm/u/8p3qxxcj

    Well, really thanks but have some folder in the script. See:

    Code:
        @sprites["bg"]=IconSprite.new(0,0,@viewport)
        @sprites["bg"].setBitmap("[B]Graphics/Pictures/Apricorn/Apricorn[/B]_menu")
        @sprites["bg"].z=1
        @sprites["up"]=AnimatedSprite.create("[B]Graphics/Pictures/Apricorn/uparrow1[/B]",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

    Did you have this folder 'Apricorn'?
     
    178
    Posts
    10
    Years
  • Back
    Top