Postado Abril 17, 2015 10 anos Gente, como eu libero pros npcs djinn me responderem quando eu fale hi com ele? Quando eu falo DJANNI'HAH pro NPC Yaman ele me responde só que dá debug logo após algum dialogo. Estou tentando liberar sem missões, já liberei la no lib. Não sei se tem algo a ver mas a tfs é 1.0 UP
Postado Abril 17, 2015 10 anos Solução Tu disse que já tirou da LIB então troca os script's dos NPC's em "Data/npc/scripts": Alesar.lua: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 function getTable() local list = { {id = 2532, buy = 5000, sell = 900, name='Ancient Shield'}, {id = 2489, buy = 1500, sell = 400, name='Dark Armor'}, {id = 2490, buy = 1000, sell = 250, name='Dark Helmet'}, {id = 2396, buy = 5000, sell = 0, name='Ice Rapier'}, {id = 2409, buy = 6000, sell = 900, name='Serpent Sword'}, {id = 2529, buy = 0, sell = 800, name='Black Shield'}, {id = 7428, buy = 0, sell = 10000, name='Bonebreaker'}, {id = 2434, buy = 0, sell = 2000, name='Dragon Hammer'}, {id = 7419, buy = 0, sell = 15000, name='Dreaded Cleaver'}, {id = 7860, buy = 0, sell = 2000, name='Earth Knight Axe'}, {id = 7875, buy = 0, sell = 2000, name='Energy Knight Axe'}, {id = 7750, buy = 0, sell = 2000, name='Fiery Knight Axe'}, {id = 2393, buy = 0, sell = 17000, name='Giant Sword'}, {id = 7407, buy = 0, sell = 8000, name='Haunted Blade'}, {id = 7769, buy = 0, sell = 2000, name='Icy Knight Axe'}, {id = 2476, buy = 0, sell = 5000, name='Knight Armor'}, {id = 2430, buy = 0, sell = 2000, name='Knight Axe'}, {id = 2477, buy = 0, sell = 5000, name='Knight Legs'}, {id = 2663, buy = 0, sell = 150, name='Mystic Turban'}, {id = 7421, buy = 0, sell = 22000, name='Onyx Flail'}, {id = 7411, buy = 0, sell = 20000, name='Ornamented Axe'}, {id = 2411, buy = 0, sell = 50, name='Poison Dagger'}, {id = 2436, buy = 0, sell = 6000, name='Skull Staff'}, {id = 2479, buy = 0, sell = 500, name='Strange Helmet'}, {id = 7413, buy = 0, sell = 4000, name='Titan Axe'}, {id = 2528, buy = 0, sell = 8000, name='Tower Shield'}, {id = 2534, buy = 0, sell = 15000, name='Vampire Shield'}, {id = 2475, buy = 0, sell = 5000, name='Warrior Helmet'} } return list end function creatureSayCallback(cid, type, msg) msg = msg:lower(); local player = Player(cid) -- GREET if msgcontains(msg, "DJANNI'HAH") or msgcontains(msg, 'hi') then npcHandler:addFocus(cid) npcHandler:say("What do you want from me, " .. getCreatureName(cid) .."?", player) end -- GREET if(not npcHandler:isFocused(cid)) then return false end if (msgcontains(msg, "bye") or msgcontains(msg, "farewell")) then npcHandler:say("Finally.", player) npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) end return true end local function onTradeRequest(cid) TradeRequest(cid, npcHandler, getTable(), GreenDjinn, 4) end npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) Yaman.lua: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 function getTable() local list = { {id = 2201, buy = 1000, sell = 100, name = 'Dragon Necklace'}, {id = 2213, buy = 2000, sell = 100, name = 'Dwarven Ring'}, {id = 2167, buy = 2000, sell = 100, name = 'Energy Ring'}, {id = 2168, buy = 900, sell = 50, name = 'Life Ring'}, {id = 2164, buy = 5000, sell = 250, name = 'Might Ring'}, {id = 2200, buy = 700, sell = 100, name = 'Protection Amulet'}, {id = 2216, buy = 2000, sell = 100, name = 'Ring of Healing'}, {id = 2170, buy = 100, sell = 50, name = 'Silver Amulet'}, {id = 2161, buy = 100, sell = 30, name = 'Strange Talisman'}, {id = 2169, buy = 2000, sell = 100, name = 'Time Ring'}, {id = 2327, buy = 0, sell = 100, name = 'Ankh'}, {id = 18412, buy = 0, sell = 6500, name = 'Glacial Rod'}, {id = 2183, buy = 0, sell = 3000, name = 'Hailstorm Rod'}, {id = 2186, buy = 0, sell = 200, name = 'Moonlight Rod'}, {id = 18411, buy = 0, sell = 6000, name = 'Muck Rod'}, {id = 2194, buy = 0, sell = 50, name = 'Mysterious Fetish'}, {id = 2185, buy = 0, sell = 1000, name = 'Necrotic Rod'}, {id = 8911, buy = 0, sell = 1500, name = 'Northwind Rod'}, {id = 2182, buy = 0, sell = 100, name = 'Snakebite Rod'}, {id = 8912, buy = 0, sell = 3600, name = 'Springsprout Rod'}, {id = 2181, buy = 0, sell = 2000, name = 'Terra Rod'}, {id = 8910, buy = 0, sell = 4400, name = 'Underworld Rod'} } return list end function creatureSayCallback(cid, type, msg) local player = Player(cid) if msgcontains(msg, "DJANNI'HAH") or msgcontains(msg, 'hi') then npcHandler:addFocus(cid) npcHandler:say("Be greeted, human " .. player:getName() .. ". How can a humble djinn be of service?", player) end if(not npcHandler:isFocused(cid)) then return false end if (msgcontains(msg, "bye") or msgcontains(msg, "farewell")) then npcHandler:say("Finally.", player) npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) elseif isInArray({"enchanted chicken wing", "boots of haste"}, msg:lower()) then npcHandler:say('Do you want to trade Boots of haste for Enchanted Chicken Wind?', cid) npcHandler.topic[cid] = 1 elseif isInArray({"warrior Sweat", "warrior helmet"}, msg:lower()) then npcHandler:say('Do you want to trade 4 Warrior Helmet for Warrior Sweat?', cid) npcHandler.topic[cid] = 2 elseif isInArray({"fighting Spirit", "royal helmet"}, msg:lower()) then npcHandler:say('Do you want to trade 2 Royal Helmet for Fighting Spirit', cid) npcHandler.topic[cid] = 3 elseif isInArray({"magic sulphur", "fire sword"}, msg:lower()) then npcHandler:say('Do you want to trade 3 Fire Sword for Magic Sulphur', cid) npcHandler.topic[cid] = 4 elseif isInArray({"job", "items"}, msg:lower()) then npcHandler:say('I trade Enchanted Chicken Wing for Boots of Haste, Warrior Sweat for 4 Warrior Helmets, Fighting Spirit for 2 Royal Helmet Magic Sulphur for 3 Fire Swords', cid) npcHandler.topic[cid] = 0 elseif msgcontains(msg,'yes') and npcHandler.topic[cid] <= 4 and npcHandler.topic[cid] >= 1 then local trade = { {NeedItem = 2195, Ncount = 1, GiveItem = 5891, Gcount = 1}, -- Enchanted Chicken Wing {NeedItem = 2475, Ncount = 4, GiveItem = 5885, Gcount = 1}, -- Flask of Warrior's Sweat {NeedItem = 2498, Ncount = 2, GiveItem = 5884, Gcount = 1}, -- Spirit Container {NeedItem = 2392, Ncount = 3, GiveItem = 5904, Gcount = 1}, -- Magic Sulphur } if player:getItemCount(trade[npcHandler.topic[cid]].NeedItem) >= trade[npcHandler.topic[cid]].Ncount then player:removeItem(trade[npcHandler.topic[cid]].NeedItem, trade[npcHandler.topic[cid]].Ncount) player:addItem(trade[npcHandler.topic[cid]].GiveItem, trade[npcHandler.topic[cid]].Gcount) return npcHandler:say(msg,'Here you are') else npcHandler:say('Sorry but you don\'t have the item', player) end elseif msgcontains(msg,'no') and (npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 5) then npcHandler:say(msg,'Ok then', player) npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) end return true end local function onTradeRequest(cid) TradeRequest(cid, npcHandler, getTable(), GreenDjinn, 4) end npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) ➥ Regras | Seções OTServ | Seções BOT
Postado Abril 17, 2015 10 anos Autor Funcinou, mas porque eu não consigo trocar o Spirit Container e o Flask of Warrior's Sweat? Os outros 2 eu consegui, mas esses 2 não.
Postado Abril 17, 2015 10 anos Funcinou, mas porque eu não consigo trocar o Spirit Container e o Flask of Warrior's Sweat? Os outros 2 eu consegui, mas esses 2 não. É por que contém letras maiúsculas no nome, não reparei nisso, troque o Yaman.lua: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 function getTable() local list = { {id = 2201, buy = 1000, sell = 100, name = 'Dragon Necklace'}, {id = 2213, buy = 2000, sell = 100, name = 'Dwarven Ring'}, {id = 2167, buy = 2000, sell = 100, name = 'Energy Ring'}, {id = 2168, buy = 900, sell = 50, name = 'Life Ring'}, {id = 2164, buy = 5000, sell = 250, name = 'Might Ring'}, {id = 2200, buy = 700, sell = 100, name = 'Protection Amulet'}, {id = 2216, buy = 2000, sell = 100, name = 'Ring of Healing'}, {id = 2170, buy = 100, sell = 50, name = 'Silver Amulet'}, {id = 2161, buy = 100, sell = 30, name = 'Strange Talisman'}, {id = 2169, buy = 2000, sell = 100, name = 'Time Ring'}, {id = 2327, buy = 0, sell = 100, name = 'Ankh'}, {id = 18412, buy = 0, sell = 6500, name = 'Glacial Rod'}, {id = 2183, buy = 0, sell = 3000, name = 'Hailstorm Rod'}, {id = 2186, buy = 0, sell = 200, name = 'Moonlight Rod'}, {id = 18411, buy = 0, sell = 6000, name = 'Muck Rod'}, {id = 2194, buy = 0, sell = 50, name = 'Mysterious Fetish'}, {id = 2185, buy = 0, sell = 1000, name = 'Necrotic Rod'}, {id = 8911, buy = 0, sell = 1500, name = 'Northwind Rod'}, {id = 2182, buy = 0, sell = 100, name = 'Snakebite Rod'}, {id = 8912, buy = 0, sell = 3600, name = 'Springsprout Rod'}, {id = 2181, buy = 0, sell = 2000, name = 'Terra Rod'}, {id = 8910, buy = 0, sell = 4400, name = 'Underworld Rod'} } return list end function creatureSayCallback(cid, type, msg) local player = Player(cid) if msgcontains(msg, "DJANNI'HAH") or msgcontains(msg, 'hi') then npcHandler:addFocus(cid) npcHandler:say("Be greeted, human " .. player:getName() .. ". How can a humble djinn be of service?", player) end if(not npcHandler:isFocused(cid)) then return false end if (msgcontains(msg, "bye") or msgcontains(msg, "farewell")) then npcHandler:say("Finally.", player) npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) elseif isInArray({"enchanted chicken wing", "boots of haste"}, msg:lower()) then npcHandler:say('Do you want to trade Boots of haste for Enchanted Chicken Wind?', cid) npcHandler.topic[cid] = 1 elseif isInArray({"warrior sweat", "warrior helmet"}, msg:lower()) then npcHandler:say('Do you want to trade 4 Warrior Helmet for Warrior Sweat?', cid) npcHandler.topic[cid] = 2 elseif isInArray({"fighting spirit", "royal helmet"}, msg:lower()) then npcHandler:say('Do you want to trade 2 Royal Helmet for Fighting Spirit', cid) npcHandler.topic[cid] = 3 elseif isInArray({"magic sulphur", "fire sword"}, msg:lower()) then npcHandler:say('Do you want to trade 3 Fire Sword for Magic Sulphur', cid) npcHandler.topic[cid] = 4 elseif isInArray({"job", "items"}, msg:lower()) then npcHandler:say('I trade Enchanted Chicken Wing for Boots of Haste, Warrior Sweat for 4 Warrior Helmets, Fighting Spirit for 2 Royal Helmet Magic Sulphur for 3 Fire Swords', cid) npcHandler.topic[cid] = 0 elseif msgcontains(msg,'yes') and npcHandler.topic[cid] <= 4 and npcHandler.topic[cid] >= 1 then local trade = { {NeedItem = 2195, Ncount = 1, GiveItem = 5891, Gcount = 1}, -- Enchanted Chicken Wing {NeedItem = 2475, Ncount = 4, GiveItem = 5885, Gcount = 1}, -- Flask of Warrior's Sweat {NeedItem = 2498, Ncount = 2, GiveItem = 5884, Gcount = 1}, -- Spirit Container {NeedItem = 2392, Ncount = 3, GiveItem = 5904, Gcount = 1}, -- Magic Sulphur } if player:getItemCount(trade[npcHandler.topic[cid]].NeedItem) >= trade[npcHandler.topic[cid]].Ncount then player:removeItem(trade[npcHandler.topic[cid]].NeedItem, trade[npcHandler.topic[cid]].Ncount) player:addItem(trade[npcHandler.topic[cid]].GiveItem, trade[npcHandler.topic[cid]].Gcount) return npcHandler:say(msg,'Here you are') else npcHandler:say('Sorry but you don\'t have the item', player) end elseif msgcontains(msg,'no') and (npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 5) then npcHandler:say(msg,'Ok then', player) npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) end return true end local function onTradeRequest(cid) TradeRequest(cid, npcHandler, getTable(), GreenDjinn, 4) end npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) ➥ Regras | Seções OTServ | Seções BOT
Postado Abril 17, 2015 10 anos Autor Poderia me passar uma do NPC Haroun que também troque esses 2 items? É que ele tbm não está trocando
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.