Comparte
Ver el tema anteriorIr abajoVer el tema siguiente
avatar
Aportador
Mensajes Mensajes : 98
Ver perfil de usuario

Sistema de Herreria =O

el Mar Oct 18, 2011 5:26 pm
Reputación del mensaje :100% (1 voto)
Primero vamos a actions\actions.xml y metemos estas lineas:

Código:


Luego
actions\scripts\ creamos blacksmithing.lua y metemos:

Código:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if(getPlayerStorageValue(cid, 60010) < 0) then
                setPlayerStorageValue(cid, 60010, 0)
        end
        show = "The recipe book. Here you can see and update your smithing recipes.\nProperty of " .. getPlayerName(cid) .. ".\n\n"
        entries = 0
        allEntries = 0
        for names, values in pairs(recipes) do
                value = ""
                finalItems = ""
                if(getPlayerStorageValue(cid, recipes[names].storage) ~= 1) then
                        value = ""
                        string = ""
                        allEntries = allEntries + 1
                else
                        for item, count in pairs(recipes[names].requiredItems) do
                                items = "                    - " .. count .. "x " .. getItemNameById(item)
                                finalItems = finalItems .. "\n" .. items
                        end
                        value = "    - Required items: ".. finalItems
                        string = "    - Recipe name: " .. names .. "\n          - Required skill: " .. recipes[names].skill .. "\n          " .. value .. "\n\n"
                        entries = entries + 1
                        allEntries = allEntries + 1
                end
                show = show .. "" .. string
        end
        endLine = show .. "    Number of recipe entries: " .. entries .. "\n    Number of all known recipes: " .. allEntries .. "\n    Unknown recipes: " .. allEntries - entries .. "\n    Your blacksmithing skill: " .. getPlayerStorageValue(cid, 60010)
        doShowTextDialog(cid, 1961, endLine)
        return true
end

Igual, vamos a actions\scripts\creamos scroll.lua y metemos esto:

Código:
local scrolls = {
        [8000] = {name = "magic plate armor", storage = 8000},
        [8001] = {name = "mastermind shield", storage = 8001}
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
        if(item.itemid == 10122) then
                if(getPlayerStorageValue(cid, recipes[scrolls[item.actionid].name].storage) ~= 1) then
                        setPlayerStorageValue(cid, recipes[scrolls[item.actionid].name].storage, 1)
                        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
                        doCreatureSay(cid, "You've learned how to smith " .. scrolls[item.actionid].name .. ".", TALKTYPE_ORANGE_1)
                        doRemoveItem(item.uid, 1)
                else
                        doCreatureSay(cid, "You already know how to smith " .. scrolls[item.actionid].name .. ".", TALKTYPE_ORANGE_1)
                end
        else
                if(getPlayerStorageValue(cid, scrolls[item.actionid].storage) ~= 1) then
                        scroll = doCreateItemEx(10122, 1)
                        doItemSetAttribute(scroll, "aid", item.actionid)
                        doItemSetAttribute(scroll, "description", "This scroll contains a recipe for " .. scrolls[item.actionid].name .. ".")
                        doPlayerAddItemEx(cid, scroll, false)
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You've found a recipe scroll.")
                        setPlayerStorageValue(cid, scrolls[item.actionid].storage, 1)
                else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It's empty.")
                end
        end
        return true
end

npc\gor'noth.xml

Código:


       
       


npc\scripts\blacksmithing.lua

Código:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local smelting = {
        ["huge chunk of crude iron"] = {[2393] = 1},
        ["piece of royal steel"] = {[2487] = 1},
        ["piece of hell steel"] = {[2462] = 1},
        ["piece of draconian steel"] = {[2516] = 1},
        ["piece of iron"] = {[2152] = 1, [2148] = 30}
}
 
function onCreatureAppear(cid)
        npcHandler:onCreatureAppear(cid)
end
function onCreatureDisappear(cid)
        npcHandler:onCreatureDisappear(cid)
end
function onCreatureSay(cid, type, msg)
        npcHandler:onCreatureSay(cid, type, msg)
end
function onThink()
        npcHandler:onThink()
end
 
npcHandler:setMessage(MESSAGE_GREET, "Greetings |PLAYERNAME|. If you're looking for either {smelting}, {jewelcrafting} or {smithing recipes}, you found a right person. I can teach you how to smith things for money or some {"services"}.")
 
function creatureSayCallback(cid, type, msg)
        if(not npcHandler:isFocused(cid)) then
                return false
        end
        local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
        if(msgcontains(msg, "services")) then
                npcHandler:say("Sometimes a {recipe} is so precious that it has no price in gold, then the only reasonable price for a recipe is a quest or a service which would cover the price.", cid, 1000)
        elseif(msgcontains(msg, "jewelcrafting")) then
                npcHandler:say("Jewelcrafting is a part of blacksmithing in which a blacksmith cuts a gem or a jewel.", cid, 1000)
        elseif(msgcontains(msg, "smithing")) then
                npcHandler:say("Smithing is a part of blacksmithing in which a blacksmith uses a forge.", cid, 1000)
        elseif(msgcontains(msg, "smelting")) then
                npcHandler:say("I can smelt some metals for you, but only if you have required ingredients.", cid, 1000)
        elseif(msgcontains(msg, "recipe")) then
                npcHandler:say("I can offer you almost all blacksmithing recipes that are known in the world. Each recipe is unique and represents a process in smithing or crafting in which result a blacksmith recives a various gems or armors.", cid, 1000)
        elseif msgcontains(msg, "blacksmith hammer") or msgcontains(msg, "tool") then
                if(doPlayerRemoveMoney(cid, 5000) == true) then
                        doPlayerAddItem(cid, 2422, 1)
                        npcHandler:say("This {blacksmith hammer} is a very high quality item. Use it wisely.", cid, 1000)
                else
                        npcHandler:say("You don't have enught money to buy this {tool}.", cid, 1000)
                end
        elseif(msgcontains(msg, "book")) then
                if doPlayerRemoveMoney(cid, 5000) == true then
                        doPlayerAddItem(cid, 1961, 1)
                        npcHandler:say("This {recipe book} is a very high quality item. Use it wisely.", cid, 1000)
                else
                        npcHandler:say("You don't have enught money to buy this {book}.", cid, 1000)
                end
        end
        for names, values in pairs(recipes) do
                if(msg == names) then
                        if(values.sellable == true) then
                                if(getPlayerStorageValue(cid, values.storage) ~= 1) then
                                        talkState[talkUser] = values.talkState
                                        npcHandler:say("Do you really want to learn how to smith {" .. names .. "}?", cid, 1000)
                                else
                                        npcHandler:say("You already know how to smith that.", cid, 1000)
                                        talkState[talkUser] = 0
                                end
                        elseif(values.sellable == false and values.mission) then
                                if(getPlayerStorageValue(cid, values.storage) ~= 1) then
                                        itemList = ""
                                        for items, count in pairs(values.mission) do
                                                itemList = itemList .. " " .. count .. "x " .. getItemNameById(items) .. ","
                                        end   
                                        talkState[talkUser] = values.talkState
                                        npcHandler:say("If you want to learn how to smith {" .. names .. "}, you have to bring me: {" .. itemList .. " " .. values.price .. " and a blacksmith hammer}. Do you have required materials now?", cid, 1000)
                                else
                                        npcHandler:say("You've already completed this task for me.", cid, 1000)
                                        talkState[talkUser] = 0
                                end
                        end
                elseif(msgcontains(msg, "yes")) then
                        if(talkState[talkUser] > 0) then
                                if(talkState[talkUser] == values.talkState) then
                                        if(getPlayerStorageValue(cid, 60010) >= values.skill) then
                                                npcHandler:say("Your blacksmithing skill is too low.", cid, 1000)
                                                talkState[talkUser] = 0
                                                return true
                                        end
                                        if(values.mission) then
                                                for items, count in pairs(values.mission) do
                                                        if(getPlayerItemCount(cid, items) < count) then
                                                                npcHandler:say("You don't have required items.", cid, 1000)
                                                                talkState[talkUser] = 0
                                                                return true
                                                        end
                                                end
                                                if(doPlayerRemoveMoney(cid, values.price) == true) then
                                                        for items, count in pairs(values.mission) do
                                                                doPlayerRemoveItem(cid, items, count)
                                                        end
                                                        setPlayerStorageValue(cid, values.storage, 1)
                                                        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
                                                        npcHandler:say("Here you are, your " .. names .. " recipe. Take care of it, becouse it's one of the rarest recipes in the world!", cid, 1000)
                                                        talkState[talkUser] = 0
                                                else
                                                        npcHandler:say("You don't have enought cash to buy this recipe.", cid, 1000)
                                                        talkState[talkUser] = 0
                                                end
                                                return true
                                        end
                                        if(doPlayerRemoveMoney(cid, values.price) == true) then
                                                setPlayerStorageValue(cid, values.storage, 1)
                                                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
                                                npcHandler:say("You learned the recipe of smithing {" .. names .. "}.", cid)
                                        else
                                                npcHandler:say("You don't have enought money.", cid)
                                        end
                                        talkState[talkUser] = 0
                                end
                        end
                elseif(msgcontains(msg, "no")) then
                        npcHandler:say("No? Then no...", cid, 1000)
                        talkState[talkUser] = 0
                end
        end
        for names, values in pairs(smelting) do
                if(msg == names) then
                        for item, count in pairs(smelting[names]) do
                                if(doPlayerRemoveItem(cid, item, count) == true) then
                                        doPlayerAddItem(cid, getItemIdByName(names), 1)
                                        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HITBYFIRE)
                                        npcHandler:say("Here you are, a " .. names .. ".", cid, 1000)
                                else
                                        npcHandler:say("You don't have required ingredients.", cid, 1000)
                                end
                        end
                end
        end
        return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


Vamos a
talkactions\talkactions.xml y metemos esta linea:
Código:


Luego a
talkactions\scripts\ creamos blacksmithing.lua y le metemos:

Código:
local function doPlayerAddOwnSkill(cid, storage, craftValue)
                if(getPlayerStorageValue(cid, storage) < 0) then
                        skillValue = 0
                else
                        skillValue = getPlayerStorageValue(cid, storage)
                end
                if(craftValue + 10 > skillValue) then
                        return setPlayerStorageValue(cid, storage, skillValue + 1)
                elseif(craftValue + 20 > skillValue) then
                        if(math.random(1, 2) == 1) then
                                return setPlayerStorageValue(cid, storage, skillValue + 1)
                        else
                                return true
                        end
                elseif(craftValue + 30 > skillValue) then
                        if(math.random(1, 5) == 1) then
                                return setPlayerStorageValue(cid, storage, skillValue + 1)
                        else
                                return true
                        end
                elseif(craftValue + 40 > skillValue) then
                        return true
                end
        end
 
function onSay(cid, words, param)
        param = string.lower(param)
        if(getPlayerStorageValue(cid, 60010) < 0) then
                setPlayerStorageValue(cid, 60010, 0)
        end
        if(recipes[param]) then
                if(getPlayerStorageValue(cid, recipes[param].storage) == 1) then
                        if(getPlayerStorageValue(cid, 60010) >= recipes[param].skill) then
                                if(getPlayerItemCount(cid, config.tool) > 0) then
                                        smithTile = getPlayerPosition(cid)
                                        smithTile.stackpos = 0
                                        if(getThingfromPos(smithTile).actionid == config.actionId) then
                                                for items, count in pairs(recipes[param].requiredItems) do
                                                        if(getPlayerItemCount(cid, items) < count) then
                                                                doCreatureSay(cid, "You don't have required ingredients to craft " .. param .. ".", TALKTYPE_ORANGE_1)
                                                                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
                                                                return true
                                                        end
                                                end
                                                for items, count in pairs(recipes[param].requiredItems) do
                                                        doPlayerRemoveItem(cid, items, count)
                                                end
                                                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
                                                craftedItem = doCreateItemEx(getItemIdByName(param), 1)
                                                doItemSetAttribute(craftedItem, "description", "It was crafted by " .. getPlayerName(cid) .. ".")
                                                doPlayerAddItemEx(cid, craftedItem, true)
                                                doPlayerAddOwnSkill(cid, 60010, recipes[param].skill)
                                                doCreatureSay(cid, "You've crafted " .. param .. ".", TALKTYPE_ORANGE_1)
                                                return true
                                        else
                                                doCreatureSay(cid, "The forge is too far from you.", TALKTYPE_ORANGE_1)
                                                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
                                        end
                                else
                                        doCreatureSay(cid, "You don't have required tools to craft " .. param .. ".", TALKTYPE_ORANGE_1)
                                        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
                                end
                        else
                                doCreatureSay(cid, "You don't have enought blacksmithing skill to craft " .. param .. ".", TALKTYPE_ORANGE_1)
                                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
                        end
                else
                        doCreatureSay(cid, "You don't have recipe for that.", TALKTYPE_ORANGE_1)
                        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
                end
        else
                doCreatureSay(cid, "There is no such a recipe.", TALKTYPE_ORANGE_1)
                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
        return true
end


Nos vamos a lib\000-constant.lua y le metemos:

Código:
recipes = {
        ["steel shield"] = {skill = 0, storage = 100, price = 50, talkState = 1, sellable = true, requiredItems = {[2152] = 1, [2225] = 1}},
        ["plate shield"] = {skill = 10, storage = 101, price = 100, talkState = 2, sellable = true, requiredItems = {[2152] = 2, [2225] = 2}},
        ["brass shield"] = {skill = 25, storage = 102, price = 150, talkState = 3, sellable = true, requiredItems = {[2152] = 3, [2225] = 2}},
        ["battle shield"] = {skill = 45, storage = 103, price = 200, talkState = 4, sellable = true, requiredItems = {[2152] = 2, [2225] = 3}},
        ["guardian shield"] = {skill = 75, storage = 104, price = 250, talkState = 5, sellable = true, requiredItems = {[2152] = 20, [2225] = 1}},
        ["dragon shield"] = {skill = 90, storage = 105, price = 700, talkState = 6, sellable = true, requiredItems = {[2152] = 20, [7399] = 1}},
        ["crown shield"] = {skill = 120, storage = 106, price = 1500, talkState = 7, sellable = true, requiredItems = {[5889] = 1, [5882] = 2}},
        ["demon shield"] = {skill = 165, storage = 107, price = 1700, talkState = 8, sellable = true, requiredItems = {[5888] = 3, [7393] = 1}},
        ["mastermind shield"] = {skill = 190, storage = 108, price = 5000, talkState = 9, sellable = true, requiredItems = {[5892] = 2, [5887] = 1, [5889] = 2, [2150] = 15}},
        ["chain legs"] = {skill = 0, storage = 109, price = 50, talkState = 10, sellable = true, requiredItems = {[2152] = 1, [2225] = 1}},
        ["brass legs"] = {skill = 25, storage = 110, price = 150, talkState = 11, sellable = true, requiredItems = {[2152] = 2, [2225] = 2}},
        ["plate legs"] = {skill = 55, storage = 111, price = 300, talkState = 12, sellable = true, requiredItems = {[2152] = 3, [2225] = 3}},
        ["knight legs"] = {skill = 85, storage = 112, price = 1000, talkState = 13, sellable = true, requiredItems = {[2152] = 40, [2225] = 1}},
        ["crown legs"] = {skill = 125, storage = 113, price = 1500, talkState = 14, sellable = true, requiredItems = {[5889] = 1, [5882] = 3}},
        ["golden legs"] = {skill = 170, storage = 114, price = 20000, talkState = 15, sellable = true, requiredItems = {[5887] = 2, [5892] = 2, [5889] = 2, [5885] = 1, [5884] = 1, [9971] = 2}},
        ["brass helmet"] = {skill = 0, storage = 115, price = 50, talkState = 16, sellable = true, requiredItems = {[2225] = 1}},
        ["viking helmet"] = {skill = 10, storage = 116, price = 100, talkState = 17, sellable = true, requiredItems = {[2152] = 1, [2225] = 1}},
        ["chain helmet"] = {skill = 20, storage = 117, price = 150, talkState = 18, sellable = true, requiredItems = {[2152] = 2, [2225] = 1}},
        ["iron helmet"] = {skill = 40, storage = 118, price = 200, talkState = 19, sellable = true, requiredItems = {[2152] = 2, [2225] = 3}},
        ["steel helmet"] = {skill = 60, storage = 119, price = 200, talkState = 20, sellable = true, requiredItems = {[2152] = 3, [2225] = 2}},
        ["crown helmet"] = {skill = 90, storage = 120, price = 500, talkState = 21, sellable = true, requiredItems = {[5889] = 1, [5882] = 1}},
        ["warrior helmet"] = {skill = 120, storage = 121, price = 700, talkState = 22, sellable = true, requiredItems = {[5889] = 1, [5885] = 1}},
        ["crusader helmet"] = {skill = 150, storage = 122, price = 750, talkState = 23, sellable = true, requiredItems = {[5889] = 1, [2225] = 5}},
        ["royal helmet"] = {skill = 180, storage = 123, price = 1500, talkState = 24, sellable = true, requiredItems = {[5887] = 1, [5892] = 1, [5885] = 1}},
        ["skull helmet"] = {skill = 190, storage = 124, price = 2000, talkState = 25, sellable = true, requiredItems = {[5887] = 1, [5892] = 1, [2230] = 3, [2231] = 3, [2229] = 2}},
        ["steel boots"] = {skill = 160, storage = 125, price = 5000, talkState = 26, sellable = true, requiredItems = {[5887] = 2, [5892] = 1}},
        ["scale armor"] = {skill = 0, storage = 126, price = 50, talkState = 27, sellable = true, requiredItems = {[2152] = 1, [2225] = 1}},
        ["brass armor"] = {skill = 10, storage = 127, price = 100, talkState = 28, sellable = true, requiredItems = {[2152] = 2, [2225] = 1}},
        ["chain armor"] = {skill = 25, storage = 128, price = 150, talkState = 29, sellable = true, requiredItems = {[2152] = 2, [2225] = 2}},
        ["plate armor"] = {skill = 45, storage = 129, price = 250, talkState = 30, sellable = true, requiredItems = {[2152] = 3, [2225] = 3}},
        ["noble armor"] = {skill = 75, storage = 130, price = 300, talkState = 31, sellable = true, requiredItems = {[2152] = 10, [2225] = 1, [2147] = 1}},
        ["knight armor"] = {skill = 95, storage = 131, price = 400, talkState = 32, sellable = true, requiredItems = {[2152] = 40, [2225] = 1}},
        ["crown armor"] = {skill = 125, storage = 132, price = 700, talkState = 33, sellable = true, requiredItems = {[5889] = 1, [5882] = 4}},
        ["golden armor"] = {skill = 145, storage = 133, price = 1900, talkState = 34, sellable = true, requiredItems = {[5887] = 1, [5892] = 1, [9971] = 2}},
        ["dragon scale mail"] = {skill = 170, storage = 134, price = 2500, talkState = 35, sellable = true, requiredItems = {[5887] = 2, [5892] = 2, [5920] = 5}},
        ["magic plate armor"] = {skill = 200, storage = 135, price = 40000, talkState = 36, sellable = true, requiredItems = {[5887] = 8, [2153] = 1, [2154] = 1, [2155] = 1, [2156] = 1, [2158] = 1}},
        ["modified crossbow"] = {skill = 140, storage = 136, price = 5000, talkState = 37, sellable = true, requiredItems = {[2455] = 1, [5887] = 1}},
        ["royal spear"] = {skill = 80, storage = 137, price = 600, talkState = 38, sellable = true, requiredItems = {[2389] = 1, [2152] = 1}},
        ["spear"] = {skill = 30, storage = 138, price = 200, talkState = 39, sellable = true, requiredItems = {[2225] = 1}},
        ["throwing knife"] = {skill = 50, storage = 139, price = 250, talkState = 40, sellable = true, requiredItems = {[2225] = 1}},
        ["violet gem"] = {skill = 150, storage = 142, price = 2000, talkState = 43, sellable = true, requiredItems = {[2150] = 25}},
        ["yellow gem"] = {skill = 150, storage = 143, price = 2000, talkState = 44, sellable = true, requiredItems = {[9970] = 15}},
        ["green gem"] = {skill = 150, storage = 144, price = 2000, talkState = 45, sellable = true, requiredItems = {[2149] = 25}},
        ["red gem"] = {skill = 150, storage = 145, price = 2000, talkState = 46, sellable = true, requiredItems = {[2147] = 25}},
        ["blue gem"] = {skill = 0, storage = 146, price = 2000, talkState = 47, sellable = true, requiredItems = {[2146] = 25}},
}
config = {
        tool = 2422,
        maxSkill = 210,
        actionId = 4500,
}





Para usarlo primero tienes que ponerle un action id al piso, luego compras una receta diciendo el nombre de la misma, entonces te tienes que mover al piso con el action id y dices "!smith NOMBRE_DELARECETA"

Post Original:

http://otland.net/f81/blacksmithing-system-98500/#post1021514

Creditos : teckman 100%

Código:
Editado por Adm Eddie
Para que sirve este script ?
Basicamente lo que hace este script es que cuando usas una herramienta en un item seleccionado y tu habilidad(skill) de F.E. Mining es mayor que la habilidad necesaria del Item mejora el item.

Osea.... es un ejemplo MU haces mas fuerte tu item.

Texto original:
Código:
Basically what this script does: when you use a tool on selected item, and your skill of f.e. mining is > than required skill of item it destroys item and give you loot, then in 2 minutes it creates the same item in the same place but for a period of 5 minutes it is not mineable. You can do as much professions as you want. I will keep developing the code and update it systematically.


avatar
Aportador
Mensajes Mensajes : 134
Ver perfil de usuario

Re: Sistema de Herreria =O

el Mar Oct 18, 2011 6:05 pm
Gracias por el Aporte Yerenix pero
en todo el post no eh visto que digas para que sirve..

Pero bueno te hice el favor y investige para que servia mas o menos.
Edite el post.



9/10
Saludos
avatar
Aportador
Mensajes Mensajes : 98
Ver perfil de usuario

Re: Sistema de Herreria =O

el Mar Oct 18, 2011 7:31 pm
Porfavor Adm Eddie "No Estes Editando mis Post" No tienes Permiso de mi para Editarlos y si quieres poner mas informacion dime en una Respuesta para Que sirve y Eso
avatar
Administrador
Mensajes Mensajes : 350
Ver perfil de usuariohttp://www.othispano.net

Re: Sistema de Herreria =O

el Mar Oct 18, 2011 7:52 pm
Buena

PD: Un Global Moderador,o moderador,tiene el derecho de editar un post para que se vea mas precentable,etc.

Pd2: Arregla un codigo que no sirve.!
avatar
Miembro
Mensajes Mensajes : 131
Ver perfil de usuario

Re: Sistema de Herreria =O

el Mar Oct 25, 2011 8:08 am
esta bueno el script men sirve para mapas rl ;O
+Rep
Contenido patrocinado

Re: Sistema de Herreria =O

Ver el tema anteriorVolver arribaVer el tema siguiente
Permisos de este foro:
No puedes responder a temas en este foro.