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

RevScripts Craft table

Belfahar

New Member
Joined
Jul 21, 2016
Messages
25
Reaction score
3
Hi everyone, it's me again! I appreciate all the support and help you have given, I am learning little by little. Today i trying to create an item crafting system, the player clicks on the statue and opens the modal window for interaction, but the script is not working.

Lua:
local forgeExal = Action()

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

local config = {
    mainTitleMsg = "Thazoran Forge",
    mainMsg = "Welcome to the Thazoran.\nPlease choose a category:",
 
    craftTitle = "Thazoran Forge: ",
    craftMsg = "Click on Recipe to see the necessary resources needed to craft a new item.\n\nHere is a list of all resources that can be crafted: ",
    needItems = "You do not have all the required items to craft.",
    system = {
        [1] = {tiers = "Set level 50",
            items = {
                [1] = {item = "Crusader Helmet",
                        itemID = 3391,
                        reqItems = {
                                [1] = {item = 22722, count = 4}, -- 4 copper token
                                [2] = {item = 10275, count = 50}, -- 50 carrion worm fang
                            },
                        },
 
                [2] = {item = "Crown Armor",
                        itemID = 3381,     
                        reqItems = {
                                [1] = {item = 22722, count = 4}, -- 4 copper token
                                [2] = {item = 11453, count = 50}, -- 50 orc broken helmet
                            },
                        },                 
 
                [3] = {item = "Crown Legs",
                        itemID = 3382,         
                        reqItems = {
                                [1] = {item = 22722, count = 4}, -- 4 copper token
                                [2] = {item = 11482, count = 50}, -- 50 piece of warrior armor
                        },
                    },
 
                [4] = {item = "Fur Boots",
                        itemID = 7457,             
                        reqItems = {
                                [1] = {item = 22722, count = 4}, -- 4 copper token
                                [2] = {item = 9657, count = 50}, -- 50 cyc toe
                        },
                    },
                },
            },
        [2] = {tiers = "Set level 100",
            items = {
                [1] = {item = "Royal Helmet",
                        itemID = 3392,
                        reqItems = {
                                [1] = {item = 22722, count = 4}, -- 4 copper token
                                [2] = {item = 10275, count = 50}, -- 50 carrion worm fang
                            },
                        },
 
                [2] = {item = "Dragon Scale Armor",
                        itemID = 3386,     
                        reqItems = {
                                [1] = {item = 22722, count = 4}, -- 4 copper token
                                [2] = {item = 11453, count = 50}, -- 50 orc broken helmet
                            },
                        },                 
 
                [3] = {item = "Zaoan Legs",
                        itemID = 10387,         
                        reqItems = {
                                [1] = {item = 22722, count = 4}, -- 4 copper token
                                [2] = {item = 11482, count = 50}, -- 50 piece of warrior armor
                        },
                    },
 
                [4] = {item = "Soft Boots",
                        itemID = 6529,             
                        reqItems = {
                                [1] = {item = 22722, count = 4}, -- 4 copper token
                                [2] = {item = 9657, count = 50}, -- 50 cyc toe
                        },
                    },
                },
            },
        },
        }
      
function forgeExal.onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    if player:getStorageValue(490201) == 1 then
        player:sendMainCraftWindow(config)
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You didn't learn how to craft items. You need the dwarf craft rune.")
        return true
        end
end
forgeExal:aid(23401)
forgeExal:register()

Error:


Code:
[2023-23-11 16:33:30.102] [error] Lua script error:
scriptInterface: [Scripts Interface]
scriptId: [C:\Canary-Dungeon\data-otservbr-global/scripts\actions\custom_dungeon\craft_rare_eq.lua:callback]
timerEvent: []
 callbackId:[]
function: []
error [...-global/scripts\actions\custom_dungeon\craft_rare_eq.lua:91: attempt to index global 'modalWindow' (a nil value)
stack traceback:
        [C]: in function '__index'
        ...-global/scripts\actions\custom_dungeon\craft_rare_eq.lua:91: in function <...-global/scripts\actions\custom_dungeon\craft_rare_eq.lua:89>]

EDIT:

I add data/events/scripts/craft_system.lua and dofile('data/events/scripts/craft_system.lua') on global.lua
And now modal window open, but dont change the options.
 
Last edited:
Back
Top