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"
},
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>
what are u talking about?When players walk on title with actionid: 60000 teleported to down floor xD wtf?
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 :/
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
if not player:isProfession(item.actionid) then
return player:sendCancelMessage("You need to learn "..craftingProfessionsConfig[item.actionid].skillName.." before using this.")
end
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