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

Simple item crafting system + interface (v18 & v19)

124
Posts
3
Years
  • This resource has been updated to v19. Older versions of this script will no longer be supported, but are still available for download (see below).

    This script allows you to implement item crafting into your game, with a clean and partially customisable UI!

    Features
    • Fully customisable crafting recipes.
    • Ability to craft multiple of any given item at a time (if ingredients allow).
    • Up to 6 ingredients per recipe.
    • Animated background, with the option to disable this if you do not like it.
    • Easy to customise the background into whatever you like by editing the bg.png graphic.
    • Sprite and text positions are agnostic to screen resolution.

    Here's what the UI looks like by default.
    Spoiler:

    And here's what it looks like with the default animated background (the animated background is not choppy in-game).
    Spoiler:


    Installation (v19)
    1. Download the .zip file from this MediaFire link.
    2. Once downloaded, open the .zip file.
    3. Drag the two folders you see into your project's main folder (where you have Game.exe), allowing them to merge with your existing folders. And that's it!

    Installation (v18/18.1)
    1. Download the .zip file from this MediaFire link.
    2. Once downloaded, open the .zip file.
    3. Copy the contents of script.txt and paste it into a new script section above Main.
    4. Drag the Graphics folder into your project's main folder (where you have Game.exe), allowing it to merge with your existing Graphics folder.

    How to use
    In an event, you need to call pbItemCrafter(stock, speech1, speech2).
    Here, stock is an array that contains two elements. First, the symbolic name of the item you wish to craft (e.g. :FULLRESTORE). Second, an array of ingredients (symbolic names) and their costs. I'll give an example of this shortly.
    speech1 and speech2 are text that display on screen when you begin and finish crafting, respectively. These are optional arguments. By default, speech1 is "Let's get started!" and speech2 is "Come back soon!".

    Here's a simple example of how to set up the event:
    Code:
    pbItemCrafter([
    [:FULLRESTORE,[:POTION,5,:ORANBERRY,10,:REVIVE,1,:LUMBERRY,2,:FULLHEAL,1,:XSPEED,3]]
    ])
    In this example, we want to craft a Full Restore. The ingredients for 1 Full Restore are 5 Potions, 10 Oran Berries, 1 Revive, 2 Lum Berries, 1 Full Heal and 3 X Speeds. The ingredients array must be formatted in this way: ingredient_1, cost_1, ingredient_2, cost_2, etc.

    You can specify up to 6 ingredients in any given recipe and whatever costs you deem appropriate.

    Here's an example of more than one item being offered by the item crafter:
    Code:
    pbItemCrafter([
    [:FULLRESTORE,[:POTION,5,:ORANBERRY,10,:REVIVE,1,:LUMBERRY,2,:FULLHEAL,1,:XSPEED,3]],
    [:TM01,[:YELLOWAPRICORN,5,:POKEBALL,10,:REPEL,22]],
    [:LAGGINGTAIL,[:HARDSTONE,1,:IRONBALL,1]],
    [:SITRUSBERRY,[:POTION,2]]
    ])

    There are 4 possible items to craft here, all with varying recipe lengths and costs. There's no limit to the number of items to be crafted, only on the number of ingredients (at the moment).

    Here's a final example where you can change the text that appears when beginning/ending item crafting:
    Code:
    pbItemCrafter([
    [:FULLRESTORE,[:POTION,5,:ORANBERRY,10,:REVIVE,1,:LUMBERRY,2,:FULLHEAL,1,:XSPEED,3]],
    [:TM01,[:YELLOWAPRICORN,5,:POKEBALL,10,:REPEL,22]],
    [:LAGGINGTAIL,[:HARDSTONE,1,:IRONBALL,1]],
    [:SITRUSBERRY,[:POTION,2]]
    ], speech1="I heard a rumour...", speech2="...that you installed this script.")

    Controls
    • Press the left/right arrows to move between recipes.
    • Press the up/down arrows to increase/decrease the quantity you wish to craft.
    • Press C/Space/Enter to begin crafting. In v19, this is now whatever you have mapped to "Use".
    • Press X/Esc to close the UI. In v19, this is now whatever you have mapped to "Back".

    Current limitations
    Maybe you want more than 6 ingredients in a recipe? It could be tricky to fit additional icons on the screen.
    Longer item names might overlap icons/other text. I can look into this if this is a problem for lots of people.

    Please credit ThatWelshOne_ if you use this resource. I have set up the Plugin Manager which should add credits automatically.

    Please let me know if there are any issues/questions either here or via Discord (ThatWelshOne_#3324). I'm always happy to help where I can.

    Thanks for reading!
     
    Last edited:
    107
    Posts
    3
    Years
    • Seen Apr 27, 2023
    Your script is very good! very optimized and beautiful 😍
    I really liked it, could I add the function of crafting more than one item at a time?
     
    107
    Posts
    3
    Years
    • Seen Apr 27, 2023
    Could you provide support in case the Bag is at its maximum capacity of items to receive? if limited in c essentials
     
    124
    Posts
    3
    Years
  • Your script is very good! very optimized and beautiful 😍
    I really liked it, could I add the function of crafting more than one item at a time?

    Hello! Thank you for your kind words.
    There is already the option to craft multiple of any given item by pressing the up/down arrow keys.

    I will look into the bag limit you mentioned. I thought I had already done that, but maybe I overlooked something.

    Quick edit: there's actually no limit to the number of items you can hold. I can add a check in anyway for the sake of completeness, but as far as I can tell it will do nothing. I updated the script in the download link if you want to grab the update with the bag limit check.
     
    Last edited:
    57
    Posts
    3
    Years
    • Seen May 27, 2023
    Looks pretty good, can you make it that you can craft the item anywhere if you know the recipe? cause it kinda sucks to keep a event just to craft
     
    124
    Posts
    3
    Years
  • Looks pretty good, can you make it that you can craft the item anywhere if you know the recipe? cause it kinda sucks to keep a event just to craft

    Yes, a portable item crafting item is possible. The script would be identical, just how you set it up will be different. You would need to define and create the item (probably a key item) that the player can use from their bag. You would also need to use a variable to track what recipes are known and to push into this variable when a new recipe is learned. For example:
    Code:
    pbSet(123,[]) # Use variable 123 to store all known recipes
    pbGet(123).push([:SITRUSBERRY,[:POTION,2]]) # When you want the player to learn a new recipe, push it into the array held in variable 123
    pbItemCrafter(pbGet(123)) # The item crafting method can then be passed variable 123 to craft any currently known recipes
    You will need to check whether any recipes are currently known using pbGet(123).length>0, otherwise the game will crash. I'll leave the rest of this to you. If this is something that enough people care about, I can make a short tutorial on how to do this.
     
    57
    Posts
    3
    Years
    • Seen May 27, 2023
    Yes, a portable item crafting item is possible. The script would be identical, just how you set it up will be different. You would need to define and create the item (probably a key item) that the player can use from their bag. You would also need to use a variable to track what recipes are known and to push into this variable when a new recipe is learned. For example:
    Code:
    pbSet(123,[]) # Use variable 123 to store all known recipes
    pbGet(123).push([:SITRUSBERRY,[:POTION,2]]) # When you want the player to learn a new recipe, push it into the array held in variable 123
    pbItemCrafter(pbGet(123)) # The item crafting method can then be passed variable 123 to craft any currently known recipes
    You will need to check whether any recipes are currently known using pbGet(123).length>0, otherwise the game will crash. I'll leave the rest of this to you. If this is something that enough people care about, I can make a short tutorial on how to do this.

    Can you make a short tutorial 😅 I didnt get anything you said
     
    124
    Posts
    3
    Years
  • Can you make a short tutorial 😅 I didnt get anything you said

    First, add this to the bottom of your PBS/items.txt file:
    Code:
    XXX,WORKBENCH,Workbench,Workbenches,8,0,"A portable workbench for crafting items out in the field.",2,0,6,
    Replace XXX with whatever the next ID would be for your game. I called the item Workbench, but you can change this. The description, too. The internal name (WORKBENCH) needs to be consistent with the code below.

    Next, go to PItem_ItemEffects in the script editor and paste this chunk of code at the bottom:
    Code:
    ItemHandlers::UseInField.add(:WORKBENCH,proc{|item|
      if pbGet(123).length>0
        pbItemCrafter(pbGet(123))
        next 1
      else
        pbMessage(_INTL("You don't know any recipes."))
        next 0
      end
    })
    
    ItemHandlers::UseFromBag.add(:WORKBENCH,proc{|item|
      if pbGet(123).length>0
        next 2
      else
        pbMessage(_INTL("You don't know any recipes."))
        next 0
      end
    })

    That's it for adding a portable item crafting item to your game. You'll probably want a graphic, but I'll leave that to you to do.

    When you give the player the Workbench item, you should use this code:
    Code:
    pbReceiveItem(:WORKBENCH)
    pbSet(123,[])
    That second line is very important, otherwise the game will crash when you try to use the item.

    The final thing is to store recipes in variable 123 so that the player can use them for crafting. Whenever you want the player to learn a new recipe, you need to put something like this code in an event:
    Code:
    pbGet(123).push(
    [:SITRUSBERRY,[:POTION,2]]
    )

    This follows the same formatting as the original resource, so you could instead do:
    Code:
    pbGet(123).push(
    [:FULLRESTORE,[:POTION,5,:ORANBERRY,10,:REVIVE,1,:LUMBERRY,2,:FULLHEAL,1,:XSPEED,3]]
    )
    Whatever you want, really.

    You can store multiple recipes at once like this:
    Code:
    pbGet(123).push(
    [:SITRUSBERRY,[:POTION,2]],
    [:FULLRESTORE,[:POTION,5,:ORANBERRY,10,:REVIVE,1,:LUMBERRY,2,:FULLHEAL,1,:XSPEED,3]]
    )

    There are a few minor things you want might to tweak about the original item crafting script to fit the now portable nature of this item. For example, removing the text that says "Come back soon!" when you finish crafting. I can help you with that if you can't see how to do it.

    That should be everything. I hope this is useful. Let me know if you (or anyone else reading this) have any issues.
     
    16
    Posts
    7
    Years
  • I managed to backport this script to the v16(it was surprisingly easy lol), and I love it, is the most complete and comfortable crafting script to use, for both the dev and the player.

    Also, I created a little method to edit the amount of recipes using just simple conditions like game switches, variables, etc...
    I think it is super easy to use, so I will leave the code in here in case anyone wants to have it:
    Code:
    def pbCrafteos
    #The base recipes you want to give to the player.
        recetaslist=[
            [:POTION,[:FRESHWATER,1,:ORANBERRY,1]],
            [:SUPERPOTION,[:POTION,2]],
            [:CASTELIACONE,[:MOOMOOMILK,1,:SNOWBALL,2]],
        ]
    
    #Copy this if you want adding more recipes, you can change the "$game_switches" for whatever condition you want.  
        if $game_switches[100]  
          recetaslist+=[
            [:FULLRESTORE,[:POTION,5,:ORANBERRY,10,:REVIVE,1,:LUMBERRY,2,:FULLHEAL,1,:XSPEED,3]]
          ]
        end
            
        pbItemCrafter(recetaslist)
    end

    It's used calling pbCrafteos, the rest of the changes should be done inside the method, by editing the array of "recetaslist"
     
    124
    Posts
    3
    Years
  • Spoiler:


    Wonderful! Thanks so much for sharing this to help anyone on an older version of Essentials.
    It's nice to see that you handled this in a similar way to how I did just above your comment when making the script useable via an item rather than an NPC.
     
    3
    Posts
    5
    Years
    • Seen Jul 29, 2021
    Um... what's happening here?

    gionGTd.png
     
    124
    Posts
    3
    Years
  • How do I store in a variable when the player makes a potion?

    Go to line 138 of the script, the line that looks like pbSEPlay("Pkmn move learnt"). Put this bit of code on a new line above:
    $game_variables[123] +=1 if isConst?(item,PBItems,:POTION)

    That should add 1 to variable 123 every time the player crafts a Potion.
     
    107
    Posts
    3
    Years
    • Seen Apr 27, 2023
    I will take advantage of the recent creation of this wonder to ask. Is there a time interval between productions?
     

    YashPokeFan123

    #PokeFan
    283
    Posts
    3
    Years
    • Seen Apr 28, 2023
    This script allows you to implement item crafting into your game, with a clean and partially customisable UI! This script is compatible with v18/18.1 only.

    Features
    • Fully customisable crafting recipes.
    • Ability to craft multiple of any given item at a time (if ingredients allow).
    • Up to 6 ingredients per recipe.
    • Animated background, with the option to disable this if you do not like it.
    • Easy to customise the background into whatever you like by editing the bg.png graphic.
    • Sprite and text positions are agnostic to screen resolution.

    Here's what the UI looks like by default.

    And here's what it looks like with the default animated background (the animated background is not choppy in-game).


    Installation
    1. Download the .zip file from this MediaFire link.
    2. Once downloaded, open the .zip file.
    3. Copy the contents of script.txt and paste it into a new script section above Main.
    4. Drag the Graphics folder into your project's main folder (where you have Game.exe and all that), allowing it to merge with your existing Graphics folder.

    How to use
    In an event, you need to call pbItemCrafter(stock, speech1, speech2).
    Here, stock is an array that contains two elements. First, the symbolic name of the item you wish to craft (e.g. :FULLRESTORE). Second, an array of ingredients (symbolic names) and their costs. I'll give an example of this shortly.
    speech1 and speech2 are text that display on screen when you begin and finish crafting, respectively. These are optional arguments. By default, speech1 is "Let's get started!" and speech2 is "Come back soon!".

    Here's a simple example of how to set up the event:
    Code:
    pbItemCrafter([
    [:FULLRESTORE,[:POTION,5,:ORANBERRY,10,:REVIVE,1,:LUMBERRY,2,:FULLHEAL,1,:XSPEED,3]]
    ])
    In this example, we want to craft a Full Restore. The ingredients for 1 Full Restore are 5 Potions, 10 Oran Berries, 1 Revive, 2 Lum Berries, 1 Full Heal and 3 X Speeds. The ingredients array must be formatted in this way: ingredient_1, cost_1, ingredient_2, cost_2, etc.

    You can specify up to 6 ingredients in any given recipe and whatever costs you deem appropriate.

    Here's an example of more than one item being offered by the item crafter:
    Code:
    pbItemCrafter([
    [:FULLRESTORE,[:POTION,5,:ORANBERRY,10,:REVIVE,1,:LUMBERRY,2,:FULLHEAL,1,:XSPEED,3]],
    [:TM01,[:YELLOWAPRICORN,5,:POKEBALL,10,:REPEL,22]],
    [:LAGGINGTAIL,[:HARDSTONE,1,:IRONBALL,1]],
    [:SITRUSBERRY,[:POTION,2]]
    ])

    There are 4 possible items to craft here, all with varying recipe lengths and costs. There's no limit to the number of items to be crafted, only on the number of ingredients (at the moment).

    Here's a final example where you can change the text that appears when beginning/ending item crafting:
    Code:
    pbItemCrafter([
    [:FULLRESTORE,[:POTION,5,:ORANBERRY,10,:REVIVE,1,:LUMBERRY,2,:FULLHEAL,1,:XSPEED,3]],
    [:TM01,[:YELLOWAPRICORN,5,:POKEBALL,10,:REPEL,22]],
    [:LAGGINGTAIL,[:HARDSTONE,1,:IRONBALL,1]],
    [:SITRUSBERRY,[:POTION,2]]
    ], speech1="I heard a rumour...", speech2="...that you installed this script.")

    Controls
    • Press the left/right arrows to move between recipes.
    • Press the up/down arrows to increase/decrease the quantity you wish to craft.
    • Press C/Space/Enter to begin crafting.
    • Press X/Esc to close the UI.

    Current limitations
    Maybe you want more than 6 ingredients in a recipe? It could be tricky to fit additional icons on the screen.
    Longer item names might overlap icons/other text. I can look into this if this is a problem for lots of people.

    Please credit ThatWelshOne_ if you use this resource. I have set up the Plugin Manager which should add credits automatically.

    Please let me know if there are any issues/questions either here or via Discord (ThatWelshOne_#3324). I'm always happy to help where I can.

    Thanks for reading!

    19v Compability?
     
    124
    Posts
    3
    Years
  • I will take advantage of the recent creation of this wonder to ask. Is there a time interval between productions?

    What do you mean by this, sorry? Do you mean whether there's a way to delay the crafting rather than it being instant?

    19v Compability?

    Yes, this will be happening once I've got my head around how the game data are now structured.
     
    124
    Posts
    3
    Years
  • Alright, here we go. This script has now been updated to v19. Please let me know if there are any issues.

    Support for older versions of Essentials will be discontinued moving forward, but you can still download the v18/18.1 script if you want it (check main post),
     
    Last edited:
    Back
    Top