• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[TFS 1.2] Simple Crafting System.

strutZ

Australian OT Member {AKA Beastn}
Joined
Nov 16, 2014
Messages
1,391
Solutions
7
Reaction score
550
Hello,

Wasn't going to release this because there is already a couple but open source right?
Like always it is using @Non Sequitur modal window system which can be found HERE

You will have to install that in order to be able to use this system.

Pictures

Main Screen
365ab70c051a18c7b3f7128e9416f6c3.png


Selection Screen
37c6bbd309818c4e1522a19c5a5b9cbe.png


Item Selection Screen (Please note pressing ok brings you back to the selection screen.)
6e831aac3ecb4735bb7c7bca9cdb22f0.png

Why use this?
Much cleaner then all the other crafting systems.. easy configurable and you just need to add the action script and the lib files. There is no need to register the scripts on login.lua or add creaturescripts!

Information on the system
It has an easy config section for you to customize it how you would like it! You just need to fill out the config table found in the action script (pictured below)
Code:
-- Window Config
   mainTitleMsg = "Crafting System", -- Main window title
   mainMsg = "Welcome to the crafting system. Please choose a vocation to begin.", -- Main window message

   craftTitle = "Crafting System: ", -- Title of the crafting screen after player picks of vocation
   craftMsg = "Here is a list of all items that can be crafted for the ", -- Message on the crafting screen after player picks of vocation
-- End Window Config

-- Player Notifications Config
   needItems = "You do not have all the required items to make ", -- This is the message the player recieves if he does not have all required items

-- Crafting Config
   system = {
  [1] = {vocation = "Master Sorcerer", -- This is the category can be anything.
       items = {
         [1] = {item = "Shadow's Sceptre", -- item name (THIS MUST BE EXACT OR IT WILL NOT WORK!)
             itemID = 25249, -- item to be made
             reqItems = { -- items and the amounts in order to craft.
                 [1] = {item = 25224, count = 50}, -- Silver Tokens
                 [2] = {item = 9969, count = 1}, -- Black Skull
                 [3] = {item = 5904, count = 30}, -- Magic Sulphur
                 [4] = {item = 7451, count = 1}, -- Shadow Sceptre
                 [5] = {item = 22396, count = 50}, -- Cluster of Solace
               },
             },

Installation

1)
Install the modal window helper HERE

2) Register the script in /data/actions/actions.xml by adding this line (Replacing "ITEMID" with the item you want to use:
Code:
    <action itemid="ITEMID" script="crafting.lua"/>
3) Create a new text document in /data/actions/scripts and name it "crafting.lua" and paste the following:
http://pastebin.com/dF2Qp7wx
4) Add the following line to your global.lua:
Code:
dofile('data/lib/crafting.lua')
5) Create a new text document in /data/lib/ and name it "crafting.lua" and paste the following:
http://pastebin.com/5QwAviAP

Enjoy =)
 
I cant find the line which makes it show the item sprite/picture on modal window.
 
I cant find the line which makes it show the item sprite/picture on modal window.
line 58 of the lib.

Code:
 self:showTextDialog(item, details)

showTextDialog(ITEM<<<< This is the item that is displayed in the modal window. , details <<<<< This sends the text.
 
2571zqp.jpg

When i click "Details"
It really isn't there but i believe its something like this:

Code:
function capAll(str)
    return str:gsub("^(%a)", string.upper):gsub("([^%a]%a)", string.upper)
end


Just place it in the top of the lib.
 
It really isn't there but i believe its something like this:

Code:
function capAll(str)
    return str:gsub("^(%a)", string.upper):gsub("([^%a]%a)", string.upper)
end


Just place it in the top of the lib.

It show for 0.3 sec and dissapear and no error in the console
 
It show for 0.3 sec and dissapear and no error in the console

Oh whoops I'm so sorry.. I forgot i used that function... Here it it. Add it to the bottom of your global.lua or your functions lib.


Code:
function capAll(str)
    local newStr = ""; wordSeparate = string.gmatch(str, "([^%s]+)")
    for v in wordSeparate do
        v = v:gsub("^%l", string.upper)
        if newStr ~= "" then
            newStr = newStr.." "..v
        else
            newStr = v
        end
    end
    return newStr
end

Also with the error you are receiving like I said in the config, The name must be 100% accurate. meaning all commas are entered.
 
Last edited:
Oh whoops I'm so sorry.. I forgot i used that function... Here it it. Add it to the bottom of your global.lua or your functions lib.


Code:
function capAll(str)
    local newStr = ""; wordSeparate = string.gmatch(str, "([^%s]+)")
    for v in wordSeparate do
        v = v:gsub("^%l", string.upper)
        if newStr ~= "" then
            newStr = newStr.." "..v
        else
            newStr = v
        end
    end
    return newStr
end

Also with the error you are receiving like I said in the config, The name must be 100% accurate. meaning all commas are entered.
Now working 100% thanks bro amazing crafting system!
 
Oh whoops I'm so sorry.. I forgot i used that function... Here it it. Add it to the bottom of your global.lua or your functions lib.


Code:
function capAll(str)
    local newStr = ""; wordSeparate = string.gmatch(str, "([^%s]+)")
    for v in wordSeparate do
        v = v:gsub("^%l", string.upper)
        if newStr ~= "" then
            newStr = newStr.." "..v
        else
            newStr = v
        end
    end
    return newStr
end

Also with the error you are receiving like I said in the config, The name must be 100% accurate. meaning all commas are entered.
I did both the lib script and bottom of global and when i click details is shows same error :|

edit: Ok now it shows no error, when i click details it stays on the same window ;d
 
I did both the lib script and bottom of global and when i click details is shows same error :|

edit: Ok now it shows no error, when i click details it stays on the same window ;d

Code:
[1] = {item = "Shadow's Sceptre", -- item name (THIS MUST BE EXACT OR IT WILL NOT WORK!)

The name has to be exactly as it is on items.xml
 
Code:
[1] = {item = "Shadow's Sceptre", -- item name (THIS MUST BE EXACT OR IT WILL NOT WORK!)

The name has to be exactly as it is on items.xml
ok thanks ^^ i will test it out and reply soon

edit: Works thanks for the help again
 
Last edited:
1 gold coin to create 100 fish

(actually more like 100 sudden death runes + 100 rune crafting potions to create 100 masterful sudden death runes in the same action, instead of repeating 1 SD rune + 1 potion to create 1 master SD rune 100 times over, but the idea is the same)
 
1 gold coin to create 100 fish

(actually more like 100 sudden death runes + 100 rune crafting potions to create 100 masterful sudden death runes in the same action, instead of repeating 1 SD rune + 1 potion to create 1 master SD rune 100 times over, but the idea is the same)

Sure is. Do these edits.

In your action script, under itemID add
Code:
count = <Amount of items player gets>,
So should look like this

Code:
-- Crafting Config
    system = {
    [1] = {vocation = "Master Sorcerer", -- This is the category can be anything.
            items = {
                [1] = {item = "Shadow's Sceptre", -- item name (THIS MUST BE EXACT OR IT WILL NOT WORK!)
                        itemID = 25249, -- item to be made
                        count = 2,
                        reqItems = { -- items and the amounts in order to craft.
                                [1] = {item = 25224, count = 50}, -- Silver Tokens
                                [2] = {item = 9969, count = 1}, -- Black Skull
                                [3] = {item = 5904, count = 30}, -- Magic Sulphur
                                [4] = {item = 7451, count = 1}, -- Shadow Sceptre
                                [5] = {item = 22396, count = 50}, -- Cluster of Solace
                            },
                        },
This will create 2 Shadow's Sceptre when they have all the req items.

Then in your lib file, Go to line 77 and change this
Code:
        self:addItem(config.system[lastChoice].items[choice.id].itemID)
to this
Code:
        self:addItem(config.system[lastChoice].items[choice.id].itemID, config.system[lastChoice].items[choice.id].count)
 
Back
Top