Postado Janeiro 15, 2018 7 anos Autor Esse script não vai funcionar nesta versão, só se refizer ele inteiro.
Postado Janeiro 15, 2018 7 anos Testa ai Crafter.XML Citar <?xml version="1.0" encoding="UTF-8"?> <npc name="Jiruki" script="crafter.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="232"/> </npc> Crafter.LUA Citar local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local npcTopic, xmsg = {}, {} 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 local craft = { ["demon helmet"] = {reward = {{2493, 1}}, items = {{id = 2160, count = 1}, {id = 2148, count = 1}}}, ["magic plate armor"] = {reward = {{2472, 1}}, items = {{id = 2160, count = 10}, {id = 2044, count = 2}}}, ["soft boots"] = {reward = {{6132, 1}}, items = {{id = 2160, count = 1}, {id = 2148, count = 1}}}, ["knight armor"] = {reward = {{2376, 1}}, items = {{id = 2160, count = 1}, {id = 2148, count = 1}}} } local function checkItemsNeeded(cid, items) local check = {} for i, v in pairs(items) do if getPlayerItemCount(cid, v.id) >= v.count then check[#check + 1] = 1 end end return #check end local function getItemsFromTable(items) local str = '' if table.maxn(items) > 0 then for i = 1, table.maxn(items) do str = str .. items.count .. ' ' .. getItemNameById(items.id) if i ~= table.maxn(items) then str = str .. ', ' end end end return str end local function craftingEffects(position, delay) local text = {"Ishhh!", "Kaboom", "Tic Tac", "BUM!", "Blop Blop!", "Cronch!"} local effects = {2, 6, 25, 31, 36,40, 54, 51, 65, 66, 67, 68} if delay ~= 0 then doSendAnimatedText(position, text[math.random(1, #text)], math.random(1, 255)) doSendMagicEffect(position, effects[math.random(1, #effects)]) addEvent(craftingEffects, 1000, position, delay - 1) end end function creatureSayCallback(cid, type, msg) local talkUser, msg = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, string.lower(msg) if(not npcHandler:isFocused(cid)) then if isInArray({"hi", "hello"}, msg) then npcHandler:addFocus(cid) npcHandler:say("Ola, "..getPlayerName(cid)..". Posso Construir Alguns {items} Para Voce, Mas Preciso De Linceças Especiais Para Faze Los.", cid) npcTopic[talkUser] = 1 else return false end elseif msgcontains(msg, "items") and npcTopic[talkUser] == 1 then local text = "" for i, v in pairs(craft) do text = text .. " {"..i.."}, " end npcHandler:say("Eu Posso Contruir " .. text .. " Qual Deles Voce Deseja?", cid) npcTopic[talkUser] = 2 elseif craft[msg] and npcTopic[talkUser] == 2 then npcHandler:say("Oh, " .. msg .. " E Uma Boa Escolha. Deixe Me Ver ... Eu Preciso " .. getItemsFromTable(craft[msg].items) .. ", Voce As Tem?" , cid) npcTopic[talkUser] = 3 xmsg[talkUser] = msg elseif not craft[msg] and npcTopic[talkUser] == 2 then npcHandler:say("Eu Nao Estou Elaborando Esse Item, Talvez Eu Possa Considerar Seu Pedido Mais Tarde.", cid) npcTopic[talkUser] = 0 elseif msgcontains(msg, "yes") and npcTopic[talkUser] == 3 then local x = craft[xmsg[talkUser]] local delay = 6 if checkItemsNeeded(cid, x.items) == #x.items then craftingEffects(getCreaturePosition(getNpcCid()), delay) for i = 1, #x.items do doPlayerRemoveItem(cid, x.items.id, x.items.count) end addEvent(function() if isPlayer(cid) then for i = 1, #x.reward do doPlayerAddItem(cid, x.reward[1], x.reward[2]) end end end, delay*1000) local type = talkUser == 0 and TALKTYPE_SAY or TALKTYPE_PRIVATE_NP addEvent(doCreatureSay, delay*1000, getNpcCid(), "Muito Obrigado! Aqui Esta O Seu Item Como Eu Prometi.", type, cid) npcTopic[talkUser] = 0 else npcHandler:say("Desculpe, Mas Voce Nao Tem Os Itens Que Eu Preciso.", cid) npcTopic[talkUser] = 0 end elseif msgcontains(msg, "no") and npcTopic[talkUser] == 3 then npcHandler:say("Ok, maybe on the next.", cid) npcTopic[talkUser] = 0 elseif msgcontains(msg, "bye") then npcHandler:say("Bye.", cid) npcHandler:releaseFocus(cid) else npcHandler:say("Estou Muito Ocupado, Nao Posso Falar Com voce Agora!", cid) npcTopic[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.