• 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.x] Crafting System

Is kinda sad that no one contributed with the receipes tho...
 
I have just implemented it right now i have only made 1 xD i will make a few for ya :)

here is 1 for ya :)

[8] = {item = 8925, skill = 100, storage = 108, mats = {{2432, 3}, {20131, 10}, {2208, 5}}, time = 30, difficulty = 50}

It uses Fire axe x 3 / Broken Throwing axe x 10 / 5 axe rings to create a solar axe :)

1 thing for sure is this, I am going to have a load of fun making a few recipes etc.
I was thinking of using War hammers to break Fire axes to make Broken Throwing axes etc...
Colors any chance of adding a talk action to see your skill points?
Like !craftpoints and it shows up with your progress and crafting lvl so far?
Best regards.
Leon
 
Last edited by a moderator:
Definitely going to get in on this ;) THanks so much
 
Here are a few basic recipes to get you guys started.
Code:
craftingProfessionsConfig = {
   [50501] = {
     skillName = "Blacksmithing",
     skillRecipes = {
--<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Recipies for foundation materials>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
       [1] = {item = 2234, skill = 10, storage = 101, mats = {{2383, 1}, {2434, 1}}, time = 10, difficulty = 20},-- Spike Sword, Dragon Hammer = Broken Sword.
       [2] = {item = 20131, skill = 10, storage = 102, mats = {{2378, 1}, {2434, 1}}, time = 10, difficulty = 20},-- Battle axe, Dragon hammer = Broken Throwing Axe.
       [3] = {item = 12408, skill = 10, storage = 103, mats = {{2423, 1}, {2434, 1}}, time = 10, difficulty = 20},-- Clerical Mace, Dragon Hammer = Broken Shamanic Staff
       [4] = {item = 12407, skill = 10, storage = 104, mats = {{2455, 1}, {2434, 1}}, time = 10, difficulty = 20},-- Crossbow, Dragon Hammer = Broken Crossbow
       [5] = {item = 7735, skill = 15, storage = 105, mats = {{2187, 1}, {2434, 1}}, time = 10, difficulty = 20},-- Wand of Inferno, Dragon Hammer = SpellWand
--<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Recipes for ores>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
       [6] = {item = {2256,10}, skill = 30, storage = 106, mats = {{2376, 1}, {2386, 1}, {2398, 1}, {2287, 1}}, time = 30, difficulty = 20},-- Sword, Axe, Mace, Light Magic Missile Rune = Metal Trash x10
       [7] = {item = {5880,5}, skill = 40, storage = 107, mats = {{2256, 100}, {2287, 10}}, time = 30, difficulty = 40},-- Metal Trash x100, Light Magic Missile rune x 10 = Iron Ore x 5
--<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Recipes for tools>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
       [8] = {item = 2434, skill = 40, storage = 108, mats = {{2398, 15}, {5920, 1}, {2311, 5}}, time = 40, difficulty = 50},-- Mace x15, Green Dragon Scale, Heavy Magic Missile x5 = Dragon Hammer
       [9] = {item = 2391, skill = 50, storage = 109, mats = {{2434, 3}, {5882, 1}, {2311, 10}}, time = 40, difficulty = 50},-- Dragon Hammer x3, Red Dragon Scale, Heavy Magic Missile x10 = War Hammer
--<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Recipes for weapons>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
       [10] = {item = 7384, skill = 50, storage = 110, mats = {{2234, 5}, {2256, 20}, {2391, 1}}, time = 40, difficulty = 40},-- Broken Sword, Metal Trash x20, War Hammer = Mystic Sword
       [11] = {item = 15404, skill = 50, storage = 111, mats = {{2432, 2}, {2256, 20}, {2391, 1}}, time = 40, difficulty = 50},-- Broken Throwing Axe, Metal Trash x20, War hammer = Deepling Ax
     },
     message = "Crafting allows you to create anything from potions to bombs to weapons of the highest caliber. The materials used in crafting can be obtained through gathering and through drops in dungeons and the open world.\n\n"
   },

Hope this helps guys :)
Best regards.
Leon
 
Alright i cant seem to get this script to work on TFS 1.1..

I have learned blacksmithing and a recipe
Then I stand on the tile and use the anvil and i get this error:

Code:
Lua Script Error: [Action Inferface]
data/actions/scripts/custom/craftsys.lua:onUse
data/actions/scripts/custom/craftsys.lua:21:  attempt to call global 'getItemName' (a nil value)
stack traceback:
         [C]: in function 'getItemName'
         data/actions/scripts/custom/craftsys.lua;21 in function <data/actions/scripts/custom/craftsys.lua:5>

Any Ideas?
 
wow... I had to add
Code:
dofile ('data/compat.lua')
In global... wow..
 
Yeah I used some compat functions... I'll update this script within the next week for sure so it won't need aditional/old libs.
 
Colors,
Give me an example of how I will register with the monster loot this recipe, or an example of how it would look a quest to a specific recipe.
 
@EDIT: I forgot to mention 2 things: The learning books needs to be item id 2217 with action id equal to the profession id. The recipes needs to be item id 1967 with action id equal to the profession id and with the text of the storage.

Here is a little example from a looting script
Code:
local item = player:addItem(1967, 1)
local rndm = math.random(50501, 50506)
local rndm2 = math.random(1, #craftingProfessionsConfig[rndm].skillRecipes)

item:setAttribute(ITEM_ATTRIBUTE_TEXT, craftingProfessionsConfig[rndm].skillRecipes[rndm2].storage)
item:setAttribute(ITEM_ATTRIBUTE_NAME, getItemName(craftingProfessionsConfig[rndm].skillRecipes[rndm2].item).." ("..craftingProfessionsConfig[rndm].skillName.." Recipe)")
item:setAttribute(ITEM_ATTRIBUTE_ACTIONID, rndm)


Need help with this :/
 
Last edited:
Colors,
Give me an example of how I will register with the monster loot this recipe, or an example of how it would look a quest to a specific recipe.
@EDIT: I forgot to mention 2 things: The learning books needs to be item id 2217 with action id equal to the profession id. The recipes needs to be item id 1967 with action id equal to the profession id and with the text of the storage.

Here is a little example from a looting script
Code:
local item = player:addItem(1967, 1)
local rndm = math.random(50501, 50506)
local rndm2 = math.random(1, #craftingProfessionsConfig[rndm].skillRecipes)

item:setAttribute(ITEM_ATTRIBUTE_TEXT, craftingProfessionsConfig[rndm].skillRecipes[rndm2].storage)
item:setAttribute(ITEM_ATTRIBUTE_NAME, getItemName(craftingProfessionsConfig[rndm].skillRecipes[rndm2].item).." ("..craftingProfessionsConfig[rndm].skillName.." Recipe)")
item:setAttribute(ITEM_ATTRIBUTE_ACTIONID, rndm)


Need help with this :/

Based on zbizu's extra loot (https://otland.net/threads/tfs-1-1-extra-loot-system.230102), is not tested, I just added some text lines...
Code:
    local extra_loot = {
        {hasName = "dragon", items = {
            {id = 1967, count = 1, chance = 40000, aid = 50501, storage = 101}, -- 40%
            {id = 2160, countMax = 4, chance = 10000}
        }},
        {items = {
            {id = 2365, chance = 10000},
            {id = 2392, chance = 1000}
        }},
    }

    function Container:addExtraLoot(c, t)
        if t.hasName then
            local cn = c:getName():lower()
            local cm = t.hasName:lower()
            if not cn:match(cm) then
                return true
            end
        end
     
        for i = 1, #t.items do
            local count = 1
            if t.items[i].count then
                if t.items[i].countMax then
                    count = math.random(t.items[i].count, t.items[i].countMax)
                else
                    count = t.items[i].count
                end
            else
                if t.items[i].countMax then
                    count = math.random(1, t.items[i].countMax)
                end
            end
         
            if math.random(0, 100000) <= t.items[i].chance then
                local item = self:addItem(t.items[i].id, count)
                if t.items[i].storage and t.items[i].aid then
                    item:setAttribute(ITEM_ATTRIBUTE_TEXT, t.items[i].storage)
                    item:setAttribute(ITEM_ATTRIBUTE_NAME, ItemType(craftingProfessionsConfig[t.items[i].aid].skillRecipes[t.items[i].storage].item):getName().." ("..craftingProfessionsConfig[t.items[i].aid].skillName.." Recipe)")
                    item:setAttribute(ITEM_ATTRIBUTE_ACTIONID, t.items[i].aid)
                end
            end
        end
    end

    function onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
        if not creature:isMonster() then return true end
        if corpse and corpse:isContainer() then
            for i = 1, #extra_loot do
                corpse:addExtraLoot(creature, extra_loot[i])
            end
        end
        return true
    end

{id = 2152, count = 2, chance = 40000, aid = 50501, storage = 101}, -- 40%
Id of the first profession, Storage of the first item to craft.
 
Colors, i use TFS 1.0, because I have problem in my vps to update the wheezy for jessie.

There is no other way to make the recipes?
An NPC that sells them? Or chest quest ....


Or, How do I remove the need for recipes?
 
Last edited:
At the moment that I made the script I couldn't find a better way to make the recipes, I don't know if there's a better way now.
You can buy them from NPCs only via the old way (hi, buy x recipe, yes). As for chest, yes, you can do it as the same way, you just need to change the item attributes... Is not that hard.

To remove the storage (profession, recipes) checks:

In the action script (actions/scripts/craftsys.lua):
This one is for the profession check, just erase the whole thing.
Code:
        if not player:isProfession(item.actionid) then
            return player:sendCancelMessage("You need to learn "..craftingProfessionsConfig[item.actionid].skillName.." before using this.")
        end

This one is for the recipe check, remove or comment the lines marked.
Code:
        for i = 1, #recipes do
            if player:getStorageValue(craftingProfessionsConfig.baseRecipeStorage + recipes[i].storage) == 1 then --THIS LINE
                modal:addChoice(i, capAll(ItemType(recipes[i].item):getName()).." [Skill Needed: "..recipes[i].skill.." - Point Cost: "..recipes[i].points.."p]")
            end --THIS LINE
        end
That should work.
 
Colors, but how to put the storage and action id on the recipe for those who are buying the npc?

Excuse my stupidity, but I know only work with items that have IDA, do not know how to make a npc sell item with storage, or a quest to an item with storage.
 
Last edited:
I deleted the marked lines (if and end), but it does not work, gave error.
If I get the recipes system will show all items for crafting available without I need the recipe?
 
If you got and error you should post the error and the modified script.
 
I removed the lines marked for you.
v3I134L.png


Console Error
3Ka7Xwh.png
 
Colors.
Excuse me for the previous questions.
I managed to create the recipe!

Now when I click on the recipe that I can not use, which has a higher skill appears this message.
For now, ok.
J4T9HIs.png


The problem appears when I click on the recipe that I have skill to use.
Console Error:
zwe0YyE.png
 
Back
Top