• 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.

Item Crafter Scene

119
Posts
10
Years
  • Hi, I would just like to share an item crafter scene i made based on a comment on here http://reliccastle.com/forums/showthread.php?tid=77

    I know that the code can probably be optimised as i am still learning ruby. The script itself is plug and play. Just put the script above main.
    note : this script uses $game_variables[496] you can just change this
    All of the instructions are at the top of the script
    For copying go to Thread Tools - Show Printable version
    Code:
    #===============================================================================
    #                              *Item Crafter
    # *Item Crafter scene created by TheKrazyGamer/kcgcrazy/TheKraazyGamer
    # *Please Give Credit if used
    #
    # *In order to unlock an item recipe use $canCraft[x]=true  where x is the 
    #  element of the @item array
    #
    # *to add an item of your own just add it to the @items array
    #   Then add its required materials to the @materials array
    #   under *case @item* add another *when x* where x is the next number
    #   Here is an example
    #        when 0
    #          if $canCraft[@item]
    #            @sprites["unknown"].opacity=0
    #            @sprites["Item_icon"].opacity=255
    #            @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[0]))
    #            @sprites["Item_1_icon"].opacity=255
    #            @sprites["Item_2_icon"].opacity=0
    #            @mat1=0
    #            @mat2=-1
    #            @cost1=2
    #            @cost2=0
    #            @amount=3
    #          else
    #            @sprites["unknown"].opacity=255
    #            @sprites["Item_icon"].opacity=0
    #            @sprites["Item_1_icon"].opacity=0
    #            @sprites["Item_2_icon"].opacity=0
    #          end
    #          self.text
    #   *@materials[3]* is whatever element your material is - duh
    #   if there is only one required material -
    #   make *@sprites["Item_2_icon"].setBitmap("")*
    #   and make *@mat2=-1*
    #   
    #   *To change the amount of materials required change @cost1 and @cost2 to the 
    #    Desired cost. To change the amount made change @amount
    #
    #   Change *if Input.trigger?(Input::RIGHT)  && @item <17* to
    #   *if Input.trigger?(Input::RIGHT)  && @item <XX* where XX is the amount of 
    #   elements in the @items array - currently (0-17) total of 18 items
    #
    # *To call put ItemCrafterScene.new in an event
    #   or create an item like this
    #
    #   #Item Crafter
    #   ItemHandlers::UseFromBag.add(:ITEMCRAFTER,proc{|item|
    #       Kernel.pbMessage(_INTL("{1} used the {2}.",$Trainer.name,PBItems.getName(item)))
    #         ItemCrafterScene.new
    #       next 1
    #    })
    #   and add this to the Items.txt : 634,ITEMCRAFTER,Item Crafter,8,0,"Lets you craft items.",2,0,6,
    #
    # *I know that this can probably be tidied up so please dont hate on me for that
    #===============================================================================
    
    $exit = 0  
    
    $canCraft = [false,
                 false,
                 false,
                 false,
                 false,
                 false,
                 false,
                 false,
                 false,
                 false,
                 false,
                 false,
                 false,
                 false,
                 false,
                 false,
                 false,
                 false] 
                     
    
    
    class ItemCrafterScene
    
    
      
      def initialize
        @close = $exit
        @select=1
        @item=0
        @mat1=0# the amount for the first item made - when 0
        @mat2=-1# the amount for the first item made - when 0
        @cost1=2# the amount for the first item made - when 0
        @cost2=0# the amount for the first item made - when 0
        @amount=3 # the amount for the first item made - when 0
        @items = [PBItems::POKEBALL,
                  PBItems::GREATBALL,
                  PBItems::ULTRABALL,
                  PBItems::DIVEBALL,
                  PBItems::DUSKBALL,
                  PBItems::FASTBALL,
                  PBItems::FRIENDBALL,
                  PBItems::HEALBALL,
                  PBItems::HEAVYBALL,
                  PBItems::LEVELBALL,
                  PBItems::LOVEBALL,
                  PBItems::LUXURYBALL,
                  PBItems::MOONBALL,
                  PBItems::NESTBALL,
                  PBItems::NETBALL,
                  PBItems::PREMIERBALL,
                  PBItems::REPEATBALL,
                  PBItems::TIMERBALL]
                  
        @materials = [PBItems::REDAPRICORN,
                      PBItems::YELLOWAPRICORN,
                      PBItems::BLUEAPRICORN,
                      PBItems::GREENAPRICORN,
                      PBItems::PINKAPRICORN,
                      PBItems::WHITEAPRICORN,
                      PBItems::BLACKAPRICORN]
        
                    
                      
        @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
        @viewport.z=99999
        @sprites={}
    
        @sprites["bg"]=IconSprite.new(0,0,@viewport)    
        @sprites["bg"].setBitmap("Graphics/Pictures/ItemCrafter/BG")
        
        @sprites["Item"]=IconSprite.new(0,0,@viewport)    
        @sprites["Item"].setBitmap("Graphics/Pictures/ItemCrafter/Item_BG")
        @sprites["Item"].x=210+10
        @sprites["Item"].y=30
         
        @sprites["Item_Hov"]=IconSprite.new(0,0,@viewport)    
        @sprites["Item_Hov"].setBitmap("Graphics/Pictures/ItemCrafter/ItemHov_BG")
        @sprites["Item_Hov"].x=210+10
        @sprites["Item_Hov"].y=30
        @sprites["Item_Hov"].opacity=0
        
        @sprites["Item_icon"]=IconSprite.new(0,0,@viewport)   
        @sprites["Item_icon"].setBitmap(pbItemIconFile(@items[@item]))
        @sprites["Item_icon"].x=220+10
        @sprites["Item_icon"].y=40
        @sprites["Item_icon"].opacity=0
        
        @sprites["unknown"]=IconSprite.new(0,0,@viewport)    
        @sprites["unknown"].setBitmap("Graphics/Pictures/ItemCrafter/unknown")
        @sprites["unknown"].x=220
        @sprites["unknown"].y=30
        
        @sprites["Item_1"]=IconSprite.new(0,0,@viewport)    
        @sprites["Item_1"].setBitmap("Graphics/Pictures/ItemCrafter/ItemR_BG")
        @sprites["Item_1"].x=65
        @sprites["Item_1"].y=100
        
        @sprites["Item_1_icon"]=IconSprite.new(0,0,@viewport)    
        @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[0]))
        @sprites["Item_1_icon"].x=65+10
        @sprites["Item_1_icon"].y=100+10
        @sprites["Item_1_icon"].opacity=0
        
        @sprites["Item_1_name"]=IconSprite.new(0,0,@viewport)    
        @sprites["Item_1_name"].setBitmap("Graphics/Pictures/ItemCrafter/Item_Name")
        @sprites["Item_1_name"].x=140
        @sprites["Item_1_name"].y=110
        
        @sprites["Item_2"]=IconSprite.new(0,0,@viewport)    
        @sprites["Item_2"].setBitmap("Graphics/Pictures/ItemCrafter/ItemR_BG")
        @sprites["Item_2"].x=65
        @sprites["Item_2"].y=185
        
        @sprites["Item_2_icon"]=IconSprite.new(0,0,@viewport)    
        @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[0]))
        @sprites["Item_2_icon"].x=65+10
        @sprites["Item_2_icon"].y=185+10
        @sprites["Item_2_icon"].opacity=0
        
        @sprites["Item_2_name"]=IconSprite.new(0,0,@viewport)    
        @sprites["Item_2_name"].setBitmap("Graphics/Pictures/ItemCrafter/Item_Name")
        @sprites["Item_2_name"].x=140
        @sprites["Item_2_name"].y=198
        
        @sprites["Confirm"]=IconSprite.new(0,0,@viewport)    
        @sprites["Confirm"].setBitmap("Graphics/Pictures/ItemCrafter/Selection")
        @sprites["Confirm"].x=115
        @sprites["Confirm"].y=280
        
        @sprites["Confirm_Hov"]=IconSprite.new(0,0,@viewport)    
        @sprites["Confirm_Hov"].setBitmap("Graphics/Pictures/ItemCrafter/Selection_1")
        @sprites["Confirm_Hov"].x=115
        @sprites["Confirm_Hov"].y=280
        @sprites["Confirm_Hov"].opacity=0
        
        @sprites["Cancel"]=IconSprite.new(0,0,@viewport)    
        @sprites["Cancel"].setBitmap("Graphics/Pictures/ItemCrafter/Selection")
        @sprites["Cancel"].x=115
        @sprites["Cancel"].y=330
        
        @sprites["Cancel_Hov"]=IconSprite.new(0,0,@viewport)    
        @sprites["Cancel_Hov"].setBitmap("Graphics/Pictures/ItemCrafter/Selection_1")
        @sprites["Cancel_Hov"].x=115
        @sprites["Cancel_Hov"].y=330
    
        @sprites["overlay"]=BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
        
        self.openItemCrafterscene
      end
      
      def openItemCrafterscene
        self.CheckAbleToCraft
        pbFadeInAndShow(@sprites) {self.text}
        self.input
        self.action
      end
      
      def closeItemCrafterscene
        pbFadeOutAndHide(@sprites)  
      end
        
        def input
          case @select
          when 1
            @sprites["Confirm"].opacity=255
            @sprites["Confirm_Hov"].opacity=0
            @sprites["Cancel"].opacity=0
            @sprites["Cancel_Hov"].opacity=255
            @sprites["Item"].opacity=255
            @sprites["Item_Hov"].opacity=0
          when 2
            @sprites["Confirm"].opacity=0
            @sprites["Confirm_Hov"].opacity=255
            @sprites["Cancel"].opacity=255
            @sprites["Cancel_Hov"].opacity=0
            @sprites["Item"].opacity=255
            @sprites["Item_Hov"].opacity=0
          when 3
            @sprites["Confirm"].opacity=255
            @sprites["Confirm_Hov"].opacity=0
            @sprites["Cancel"].opacity=255
            @sprites["Cancel_Hov"].opacity=0
            @sprites["Item"].opacity=0
            @sprites["Item_Hov"].opacity=255
            @sprites["Item_icon"].setBitmap(pbItemIconFile(@items[@item]))
            case @item
            when 0
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[0]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=0
                @mat1=0
                @mat2=-1
                @cost1=2
                @cost2=0
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 1
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[0]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[2]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=0
                @mat2=2
                @cost1=2
                @cost2=2
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 2
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[6]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[1]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=6
                @mat2=1
                @cost1=2
                @cost2=2
                @amount=3
               else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 3
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[4]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[2]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=4
                @mat2=2
                @cost1=2
                @cost2=2
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 4
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[6]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[3]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=6
                @mat2=3
                @cost1=2
                @cost2=2
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 5
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[0]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[1]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=0
                @mat2=1
                @cost1=2
                @cost2=2
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 6
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[3]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[1]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=3
                @mat2=1
                @cost1=2
                @cost2=2
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 7
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[4]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[5]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=4
                @mat2=5
                @cost1=2
                @cost2=2
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 8
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[2]))
                @sprites["Item_2_icon"].setBitmap("")
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=2
                @mat2=-1
                @cost1=2
                @cost2=0
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 9
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[6]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[0]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=6
                @mat2=0
                @cost1=2
                @cost2=2
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 10
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[5]))
                @sprites["Item_2_icon"].setBitmap("")
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=5
                @mat2=-1
                @cost1=2
                @cost2=0
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 11
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[0]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[5]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=0
                @mat2=5
                @cost1=2
                @cost2=2
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 12
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[6]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[2]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=6
                @mat2=2
                @cost1=2
                @cost2=2
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 13
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[3]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[1]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=3
                @mat2=1
                @cost1=2
                @cost2=2
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 14
               if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[6]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[2]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=6
                @mat2=2
                @cost1=2
                @cost2=2
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 15
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[0]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[5]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=0
                @mat2=5
                @cost1=2
                @cost2=2
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 16
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[0]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[6]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=0
                @mat2=6
                @cost1=2
                @cost2=2
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            when 17
              if $canCraft[@item]
                @sprites["unknown"].opacity=0
                @sprites["Item_icon"].opacity=255
                @sprites["Item_1_icon"].setBitmap(pbItemIconFile(@materials[5]))
                @sprites["Item_2_icon"].setBitmap(pbItemIconFile(@materials[6]))
                @sprites["Item_1_icon"].opacity=255
                @sprites["Item_2_icon"].opacity=255
                @mat1=5
                @mat2=6
                @cost1=2
                @cost2=2
                @amount=3
              else
                @sprites["unknown"].opacity=255
                @sprites["Item_icon"].opacity=0
                @sprites["Item_1_icon"].opacity=0
                @sprites["Item_2_icon"].opacity=0
              end
              self.text
            end
            if Input.trigger?(Input::RIGHT)  && @item <17
              @item+=1
            end
            if Input.trigger?(Input::LEFT) && @item >0
              @item-=1
            end
          end    
          
          if Input.trigger?(Input::UP)  && @select <3
            @select+=1
          end
          if Input.trigger?(Input::DOWN) && @select >1
            @select-=1
          end
          
          if Input.trigger?(Input::C) 
            case @select
            when 2 
              if $canCraft[@item]
                if $PokemonBag.pbQuantity(@materials[@mat2])<@cost1 || $PokemonBag.pbQuantity(@materials[@mat1]) <@cost2
                  Kernel.pbMessage(_INTL("Unable to craft item, you do not meet the required materials"))
                else
                  $PokemonBag.pbStoreItem(@items[@item],@amount)
                  $PokemonBag.pbDeleteItem(@materials[@mat1],@cost1)
                  if @mat2!=-1
                    $PokemonBag.pbDeleteItem(@materials[@mat2],@cost2)
                  end
                  self.text
                  Kernel.pbMessage(_INTL("{1} {2}'s were crafted", @amount, PBItems.getName(@items[@item])))
                end
              else
                Kernel.pbMessage(_INTL("You do not know this items recipe"))
              end
            when 1
              @close=@select
              self.closeItemCrafterscene
            end       
          end
          
          if Input.trigger?(Input::B)
            @close=@select
            self.closeItemCrafterscene  
          end
          
        end
        
      def action
        while @close==0
          Graphics.update
          Input.update
          self.input
        end
      end
      
      def text
        overlay= @sprites["overlay"].bitmap
        overlay.clear
        baseColor=Color.new(255, 255, 255)
        shadowColor=Color.new(0,0,0)
        pbSetSystemFont(@sprites["overlay"].bitmap)
        textos=[]
        if $canCraft[@item]
          @text1=_INTL("{1}/{2} {3}", $PokemonBag.pbQuantity(@materials[@mat1]),@cost1, PBItems.getName(@materials[@mat1]))
          if @mat2 < 0
            @text2=_INTL("")
          else
            @text2=_INTL("{1}/{2} ,  {3}", $PokemonBag.pbQuantity(@materials[@mat2]),@cost2 , PBItems.getName(@materials[@mat2]))
          end
        else
          @text1=_INTL("UNKOWN")
          @text2=_INTL("UNKOWN")
        end
        @text3=_INTL("{1} / {2}", @item + 1, @items.size)
        textos.push([@text1,175,115,false,baseColor,shadowColor])
        textos.push([@text2,175,198+5,false,baseColor,shadowColor])
        textos.push([@text3,75,30,false,baseColor,shadowColor])
        textos.push(["Craft",230,280+5,false,baseColor,shadowColor])
        textos.push(["Cancel",230,330+5,false,baseColor,shadowColor])
        pbDrawTextPositions(overlay,textos)
      end
      
      def CheckAbleToCraft
        if $canCraft[0]
          @sprites["Item_icon"].opacity=255
          @sprites["Item_1_icon"].opacity=255
          @sprites["unknown"].opacity=0
        else
          @sprites["Item_icon"].opacity=0
          @sprites["Item_1_icon"].opacity=0
          @sprites["unknown"].opacity=255
        end
      end
        
    end
    https://www.dropbox.com/sh/dcltf6bi5lj5rgh/AACiQqmFNNcFcekUyJaTKpDPa?dl=0
    you will need to put this folder in graphics/pictures/ItemCrafter

    Here are some screenshots
    Spoiler:
     
    Last edited:
    95
    Posts
    9
    Years
  • hey seems nice!

    instead of the whole opacity block you could maybe make use of pbFadeInAndShow(@sprites) and pbFadeOutAndHide(@sprites).
     
    119
    Posts
    10
    Years
  • I just realized by looking at my screenshots that i did not fade in the graphics enough so you could still kind of see the bag graphics. I have updated the OP to include the changes. A thanks to shiney570 for telling me about the pbFadeInAndShow and pbFadeOutAndHide methods
     
    119
    Posts
    10
    Years
  • Updated the script to allow for custom amount of each item required as well as the desired amount crafted
     
    119
    Posts
    10
    Years
  • i get this error :S , you know how to fixed?
    fGx3tbC.jpg

    im guessing that when trying to turn it into an item? if so try placing it under
    Code:
    ItemHandlers::UseFromBag.add(:BLACKFLUTE,proc{|item|
       Kernel.pbMessage(_INTL("{1} used the {2}.",$Trainer.name,PBItems.getName(item)))
       Kernel.pbMessage(_INTL("Wild Pokémon will be repelled."))
       $PokemonMap.blackFluteUsed=true
       $PokemonMap.whiteFluteUsed=false
       next 1
    })

    so it should look something like this, the red i the added script
    Spoiler:


    tell me if that fixes the error.
     
    68
    Posts
    11
    Years
    • Seen Jan 17, 2017
    nothing :S T_T when i select "craft" i get this error :S
    Ws8fHFK.jpg


    like this ?

    Spoiler:


    T_T it does not work
     
    Last edited:
    119
    Posts
    10
    Years
  • nothing :S T_T when i select "craft" i get this error :S
    Ws8fHFK.jpg


    like this ?

    Spoiler:


    T_T it does not work

    Ah sorry my bad, i misread the error. I re uploaded the script. there was just a spelling error in the script. it should work fine now
     
    119
    Posts
    10
    Years
  • Just thought id let everyone know ive updated the script to now make each craftable item unlockable. each item by default is locked and will say to the player the recipe is unknown. all the details are in the script. if you have questions or any issued just let me know
     
    423
    Posts
    13
    Years
    • Seen Aug 31, 2023
    so this only allows crafting of 2 different items to make one item is that correct?
     
    119
    Posts
    10
    Years
  • so this only allows crafting of 2 different items to make one item is that correct?

    either 1 or 2 items to make an item, and each can have a set amount, so like it can take 2 of the first item and 1 of the second item to make 5 of the craftable item. or whatever you want. if that makes sense
     
    40
    Posts
    8
    Years
    • She/Her
    • Seen Apr 11, 2024
    I'm having a slight problem with this. I created it as an item, gave myself it and used it but the backgrounds don't load and the only button that works is the B button (X).

    It won't let me upload any images or links
    Basically, the bag and item shows behind new text relating to the crafter menu. Nothing else.
     
    119
    Posts
    10
    Years
  • I'm having a slight problem with this. I created it as an item, gave myself it and used it but the backgrounds don't load and the only button that works is the B button (X).

    It won't let me upload any images or links
    Basically, the bag and item shows behind new text relating to the crafter menu. Nothing else.

    it works fine for me. Did you make sure to copy the images and place them in the path : graphics/pictures/ItemCrafter
     
    40
    Posts
    8
    Years
    • She/Her
    • Seen Apr 11, 2024
    No I hadn't. I'd assumed they just went into the pictures folder like most other addons.
    Don't I feel stupid. ¬_¬
     
    Back
    Top