The PokéCommunity Forums Fan Games Game Development Scripts & Tutorials
Essentials Script Item Crafter Scene

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.

Reply
 
Thread Tools
  #1    
Old March 31st, 2015 (9:42 AM). Edited August 7th, 2015 by kcgcrazy.
kcgcrazy kcgcrazy is offline
     
    Join Date: Nov 2013
    Location: Canada
    Gender: Male
    Posts: 119
    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
              @[email protected]
              self.closeItemCrafterscene
            end       
          end
          
          if Input.trigger?(Input::B)
            @[email protected]
            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:




    Reply With Quote
      #2    
    Old March 31st, 2015 (11:32 AM).
    Radical Raptr's Avatar
    Radical Raptr Radical Raptr is offline
    #BAMFPokemonNerd
       
      Join Date: Mar 2011
      Location: everywhere
      Age: 23
      Gender: Male
      Nature: Sassy
      Posts: 1,118
      Very cool! I'll definitely test it out.
      __________________

      ~My Deviantart - Litharreon Wiki - Litharreon Game Download~

      Reply With Quote
        #3    
      Old March 31st, 2015 (11:48 AM).
      kcgcrazy kcgcrazy is offline
         
        Join Date: Nov 2013
        Location: Canada
        Gender: Male
        Posts: 119
        Quote:
        Originally Posted by Saving Raven View Post
        Very cool! I'll definitely test it out.
        Thanks!
        Reply With Quote
          #4    
        Old March 31st, 2015 (3:31 PM).
        shiney570 shiney570 is offline
           
          Join Date: Aug 2014
          Location: Germany
          Gender: Male
          Posts: 95
          hey seems nice!

          instead of the whole opacity block you could maybe make use of pbFadeInAndShow(@sprites) and pbFadeOutAndHide(@sprites).
          Reply With Quote
            #5    
          Old March 31st, 2015 (4:06 PM).
          kcgcrazy kcgcrazy is offline
             
            Join Date: Nov 2013
            Location: Canada
            Gender: Male
            Posts: 119
            Quote:
            Originally Posted by shiney570 View Post
            hey seems nice!

            instead of the whole opacity block you could maybe make use of pbFadeInAndShow(@sprites) and pbFadeOutAndHide(@sprites).
            thanks for the tip! i didnt know about that. ill keep that in mind for next time.
            Reply With Quote
              #6    
            Old March 31st, 2015 (5:52 PM).
            kcgcrazy kcgcrazy is offline
               
              Join Date: Nov 2013
              Location: Canada
              Gender: Male
              Posts: 119
              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
              Reply With Quote
                #7    
              Old April 2nd, 2015 (3:42 PM).
              Bowlstir's Avatar
              Bowlstir Bowlstir is offline
              Media Arts and Game Development
                 
                Join Date: Apr 2008
                Location: USA
                Gender: Male
                Nature: Adamant
                Posts: 198
                Looks awesome, now we have appeal to the minecrafters :p
                __________________


                Reply With Quote
                  #8    
                Old April 21st, 2015 (9:25 AM).
                kcgcrazy kcgcrazy is offline
                   
                  Join Date: Nov 2013
                  Location: Canada
                  Gender: Male
                  Posts: 119
                  Updated the script to allow for custom amount of each item required as well as the desired amount crafted
                  Reply With Quote
                    #9    
                  Old April 25th, 2015 (3:53 PM).
                  akane159 akane159 is offline
                     
                    Join Date: Oct 2012
                    Gender: Female
                    Posts: 68
                    i get this error :S , you know how to fixed?
                    Reply With Quote
                      #10    
                    Old April 25th, 2015 (5:18 PM).
                    kcgcrazy kcgcrazy is offline
                       
                      Join Date: Nov 2013
                      Location: Canada
                      Gender: Male
                      Posts: 119
                      Quote:
                      Originally Posted by akane159 View Post
                      i get this error :S , you know how to fixed?
                      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:

                      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
                      })
                      
                      # Item Crafter
                      ItemHandlers::UseFromBag.add(:ITEMCRAFTER,proc{|item|
                         Kernel.pbMessage(_INTL("{1} used the {2}.",$Trainer.name,PBItems.getName(item)))
                         ItemCrafterScene.new
                         next 1
                      })


                      tell me if that fixes the error.
                      Reply With Quote
                        #11    
                      Old April 25th, 2015 (5:28 PM). Edited April 25th, 2015 by akane159.
                      akane159 akane159 is offline
                         
                        Join Date: Oct 2012
                        Gender: Female
                        Posts: 68
                        nothing :S T_T when i select "craft" i get this error :S


                        like this ?

                        Spoiler:


                        T_T it does not work
                        Reply With Quote
                          #12    
                        Old April 26th, 2015 (9:11 AM).
                        kcgcrazy kcgcrazy is offline
                           
                          Join Date: Nov 2013
                          Location: Canada
                          Gender: Male
                          Posts: 119
                          Quote:
                          Originally Posted by akane159 View Post
                          nothing :S T_T when i select "craft" i get this error :S


                          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
                          Reply With Quote
                            #13    
                          Old April 26th, 2015 (10:18 AM).
                          akane159 akane159 is offline
                             
                            Join Date: Oct 2012
                            Gender: Female
                            Posts: 68
                            now it worked, thnx :D!
                            Reply With Quote
                              #14    
                            Old July 3rd, 2015 (5:38 PM).
                            kcgcrazy kcgcrazy is offline
                               
                              Join Date: Nov 2013
                              Location: Canada
                              Gender: Male
                              Posts: 119
                              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
                              Reply With Quote
                                #15    
                              Old July 4th, 2015 (1:07 PM).
                              p.claydon p.claydon is offline
                                 
                                Join Date: Jan 2011
                                Gender: Female
                                Posts: 389
                                so this only allows crafting of 2 different items to make one item is that correct?
                                __________________
                                Still learning how to sprite but if you want to look at my progress then here you go
                                http://pclaydon.deviantart.com/gallery/
                                Reply With Quote
                                  #16    
                                Old July 4th, 2015 (2:08 PM).
                                kcgcrazy kcgcrazy is offline
                                   
                                  Join Date: Nov 2013
                                  Location: Canada
                                  Gender: Male
                                  Posts: 119
                                  Quote:
                                  Originally Posted by p.claydon View Post
                                  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
                                  Reply With Quote
                                    #17    
                                  Old August 7th, 2015 (12:28 AM).
                                  AndromedaKerova AndromedaKerova is offline
                                     
                                    Join Date: Aug 2015
                                    Gender: Female
                                    Nature: Sassy
                                    Posts: 32
                                    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.
                                    Reply With Quote
                                      #18    
                                    Old August 7th, 2015 (12:16 PM).
                                    kcgcrazy kcgcrazy is offline
                                       
                                      Join Date: Nov 2013
                                      Location: Canada
                                      Gender: Male
                                      Posts: 119
                                      Quote:
                                      Originally Posted by AndromedaKerova View Post
                                      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
                                      Reply With Quote
                                        #19    
                                      Old August 8th, 2015 (3:16 AM).
                                      AndromedaKerova AndromedaKerova is offline
                                         
                                        Join Date: Aug 2015
                                        Gender: Female
                                        Nature: Sassy
                                        Posts: 32
                                        No I hadn't. I'd assumed they just went into the pictures folder like most other addons.
                                        Don't I feel stupid. ¬_¬
                                        __________________
                                        Currently working on 2 projects.
                                        Chromia (banner to be added)
                                        Mirror (banner to be added)
                                        Reply With Quote
                                          #20    
                                        Old August 8th, 2015 (11:22 AM).
                                        kcgcrazy kcgcrazy is offline
                                           
                                          Join Date: Nov 2013
                                          Location: Canada
                                          Gender: Male
                                          Posts: 119
                                          Quote:
                                          Originally Posted by AndromedaKerova View Post
                                          No I hadn't. I'd assumed they just went into the pictures folder like most other addons.
                                          Don't I feel stupid. ¬_¬
                                          haha dont worry about it. Im just glad people are actually using this script i made!
                                          Reply With Quote
                                            #21    
                                          Old August 8th, 2015 (7:59 PM).
                                          AndromedaKerova AndromedaKerova is offline
                                             
                                            Join Date: Aug 2015
                                            Gender: Female
                                            Nature: Sassy
                                            Posts: 32
                                            Oh I love the idea of being able to make your own Pokéballs and stuff. I was planning to fix up the Kurt stuff and add it to my game but THIS seems much more original.
                                            __________________
                                            Currently working on 2 projects.
                                            Chromia (banner to be added)
                                            Mirror (banner to be added)
                                            Reply With Quote
                                              #22    
                                            Old January 5th, 2016 (9:31 PM).
                                            PunkPhantom's Avatar
                                            PunkPhantom PunkPhantom is offline
                                            "midna's a cat" -vinny, vinesauce
                                               
                                              Join Date: Mar 2014
                                              Age: 23
                                              Gender: Female
                                              Nature: Naive
                                              Posts: 79
                                              I'm trying to make it so you don't have to unlock any of the recipes, i also want to remove the Pokeball, Greatball, and Ultraball recipes, but i'm a little confused how. Sorry I don't know Ruby.
                                              __________________
                                              POKEMON ABSOLUTION
                                              coming soon
                                              Reply With Quote
                                                #23    
                                              Old January 14th, 2016 (7:42 AM).
                                              rizakh rizakh is offline
                                                 
                                                Join Date: Jul 2015
                                                Posts: 35
                                                its very nice, but, for some reason it return just 'UNKNOW' values and didnt show the sprites of itens that i set or the balls. what i need to do?
                                                Reply With Quote
                                                  #24    
                                                Old January 14th, 2016 (9:58 PM).
                                                kcgcrazy kcgcrazy is offline
                                                   
                                                  Join Date: Nov 2013
                                                  Location: Canada
                                                  Gender: Male
                                                  Posts: 119
                                                  Quote:
                                                  Originally Posted by rizakh View Post
                                                  its very nice, but, for some reason it return just 'UNKNOW' values and didnt show the sprites of itens that i set or the balls. what i need to do?
                                                  its because the recipes are probably locked. but i need to edit this script anyways. its old and i realize that i did the unlocking system kind of wrong. as well as ill make 2 versions. one that has the locked recipes and one without.
                                                  Reply With Quote
                                                    #25    
                                                  Old January 16th, 2016 (7:03 AM).
                                                  rizakh rizakh is offline
                                                     
                                                    Join Date: Jul 2015
                                                    Posts: 35
                                                    And how can i unlock manually? :X

                                                    its very very nice and i need this to survive :c XDD
                                                    Reply With Quote
                                                    Reply

                                                    Quick Reply

                                                    Join the conversation!

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

                                                    Create a PokéCommunity Account
                                                    Thread Tools

                                                    Posting Rules
                                                    You may not post new threads
                                                    You may not post replies
                                                    You may not post attachments
                                                    You may not edit your posts

                                                    BB code is On
                                                    Smilies are On
                                                    [IMG] code is On
                                                    HTML code is Off

                                                    Forum Jump


                                                    All times are GMT -8. The time now is 2:42 PM.