se baseie no script do A Sweaty Cyclops que eu achei por ae:
local A Sweaty Cyclops = NPC:new("A Sweaty Cyclops")
A Sweaty Cyclops.outfit = {
type = 22,
head = 0,
body = 0,
legs = 0,
feet = 0
}
A Sweaty Cyclops.greeting = "Hum Humm! Welcume lil' $name."
A Sweaty Cyclops.farewell = "Good bye lil' one."
--A Sweaty Cyclops.listen_radius = 4
--A Sweaty Cyclops.walk_radius = 3
A Sweaty Cyclops.dialog = {
["tibia"] = "One day I'll go and look.";
["ab'dendriel"] = "Me parents live here before town was. Me not care about lil' ones.";
["big|old"] = "Mountain in south. Lil' lil' ones living there.";
["elves"] = "Me not fight them, they not fight me.";
["humans"] = "Always asking me for stuff they can't afford.";
["orcs"] = "Silly ones. Not talk much. Always screaming and hitting.";
["minotaurs"] = "They were friend with me parents. Long before elves here, they often made visit. No longer come here.";
["dwarfs|lil"] = "Lil' lil' ones are so fun. We often chat.";
["god"] = "You shut up. Me not want to hear.";
["smith"] = "Working steel is my profession.";
["steel"] = "Manny kinds of. Like Mesh Kaha Rogh, Za'Kalortith, Uth'Byth, Uth'Morc, Uth'Amon, Uth'Maer, Uth'Doon, and Zatragil";
["Like Mesh Kaha Rogh"] = "Steel that is singing when forged. No one knows where find today.";
["Za'Kalortith"] = "It's evil. Demon iron is. No good cyclops goes where you can find and need evil flame to melt.";
["uth'Byth"] = "Not good to make stuff off. Bad steel it is. But eating magic, so useful is.";
["uth'Morc"] = "Lil' ones it thieves' steel call sometimes. It's dark and making not much noise.";
["uth'Amon"] = "Brigthsteel is. Much art made with it. Sorcerers to lazy and afraid to enchant much.";
["uth'Maer"] = "Heartiron from heart of big old mountain, found very deep. Lil' lil ones fiercely defend. Not wanting to have it used for stuff but holy stuff.";
["uth'Doon"] = "It's high steel called. Only lil' lil' ones know how make.";
["Zatragil"] = "Most ancients use dream silver for different stuff. Now ancients most gone. Most not know about.";
["Teshial|Deraisim|Cenath|Kuridai"] = "Is one of elven family or such thing. Me not understand lil' ones and their busisness.";
["cyclops"] = "Me people not live here much. Most are far away.";
["excalibug"] = "Me wish I could make weapon like it.";
["bast skirt"] = function(self)
local storage = Player.getStorageValue(1119)
if storage == 0 then
self:say("Lil' one bring three bast skirts?")
if Player.getItemTypeCount(itemid) >= 3 and containsAgreement(reply) then
self:say("Good good! Woman happy will be. Now me happy too and help you.")
Player.removeItem(itemid, 0, 3)
Player.setStorageValue(1119, 1)
else
self:say("Me wait then.")
end
end;
["uth'prta"] = function(self) --- chunk of crude iron
local storage = Player.getStorageValue(1119)
if storage < 0 then
self:say("Wait. Me work no cheap is. Do favour for me first, yes?")
if containsAgreement(reply) then
self:say("Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.")
Player.setStorageValue(1119, 0)
else
self:say("Humans always asking me for stuff they can't afford.")
end
else
if Player.getItemTypeCount(itemid) >= 1 then
self:say("Did you bring me a Giant Sword?")
if containsAgreement(reply) then
if Player.getItemTypeCount(itemid) >= 1 then
Player.removeItem(itemid, 0, 1)
Player.addItem(itemid, canDropOnMap = true)
else
self:say("You think me is a fool?")
end
end
else
self:say("I need a Giant Sword to give you the chunk of crude iron. Come back when you have it.")
end
end;
["uth'lokr"] = function(self) --- draconian steel
local storage = Player.getStorageValue(1119)
if storage < 0 then
self:say("Wait. Me work no cheap is. Do favour for me first, yes?")
if containsAgreement(reply) then
self:say("Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.")
Player.setStorageValue(1119, 0)
else
self:say("Humans always asking me for stuff they can't afford.")
end
else
if Player.getItemTypeCount(itemid) >= 1 then
self:say("Did you bring me a Dragon Shield?")
if containsAgreement(reply) then
if Player.getItemTypeCount(itemid) >= 1 then
Player.removeItem(itemid, 0, 1)
Player.addItem(itemid, canDropOnMap = true)
else
self:say("You think me is a fool?")
end
end
else
self:say("I need a Dragon Shield to give you the draconian steel. Come back when you have it.")
end
end;
["uth'kean"] = function(self) --- royal steel
local storage = Player.getStorageValue(1119)
if storage < 0 then
self:say("Wait. Me work no cheap is. Do favour for me first, yes?")
if containsAgreement(reply) then
self:say("Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.")
Player.setStorageValue(1119, 0)
else
self:say("Humans always asking me for stuff they can't afford.")
end
else
if Player.getItemTypeCount(itemid) >= 1 then
self:say("Very noble. Shiny. Me like. But breaks so fast. Me can make from shiny armour. Lil' one want to trade?")
if containsAgreement(reply) then
if Player.getItemTypeCount(itemid) >= 1 then
self:say("Cling clang!")
Player.removeItem(itemid, 0, 1)
Player.addItem(itemid, canDropOnMap = true)
else
self:say("You think me is a fool?")
end
end
else
self:say("I need a Crown Armor to give you the royal steel. Come back when you have it.")
end
end;
["za'ralator"] = function(self) --- hell steel
local storage = Player.getStorageValue(1119)
if storage < 0 then
self:say("Wait. Me work no cheap is. Do favour for me first, yes?")
if containsAgreement(reply) then
self:say("Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.")
Player.setStorageValue(1119, 0)
else
self:say("Humans always asking me for stuff they can't afford.")
end
else
if Player.getItemTypeCount(itemid) >= 1 then
self:say("Did you bring me a Devil Helmet?")
if containsAgreement(reply) then
if Player.getItemTypeCount(itemid) >= 1 then
Player.removeItem(itemid, 0, 1)
Player.addItem(itemid, canDropOnMap = true)
else
self:say("You think me is a fool?")
end
end
else
self:say("I need a Devil Helmet to give you the hell steel. Come back when you have it.")
end
end;
["infernal bolt"] = function(self) --- infernal bolt
local storage = Player.getStorageValue(1119)
if storage < 0 then
self:say("Wait. Me work no cheap is. Do favour for me first, yes?")
if containsAgreement(reply) then
self:say("Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.")
Player.setStorageValue(1119, 0)
else
self:say("Humans always asking me for stuff they can't afford.")
end
else
if Player.getItemTypeCount(itemid) >= 1 then
self:say("Did you bring me a Soul Orb?")
if containsAgreement(reply) then
if Player.getItemTypeCount(itemid) >= 1 then
Player.removeItem(itemid, 0, 1)
Player.addItem(itemid, canDropOnMap = true)
else
self:say("You think me is a fool?")
end
end
else
self:say("I need a Soul Orb to give you the infernal bolt. Come back when you have it.")
end
end;
["gear wheel"] = function(self) --- gear wheel
local storage = Player.getStorageValue(1119)
if storage < 0 then
self:say("Wait. Me work no cheap is. Do favour for me first, yes?")
if containsAgreement(reply) then
self:say("Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.")
Player.setStorageValue(1119, 0)
else
self:say("Humans always asking me for stuff they can't afford.")
end
else
if Player.getItemTypeCount(itemid) >= 1 then
self:say("Did you bring me the Iron Ore?")
if containsAgreement(reply) then
if Player.getItemTypeCount(itemid) >= 1 then
Player.removeItem(itemid, 0, 1)
Player.addItem(itemid, canDropOnMap = true)
else
self:say("You think me is a fool?")
end
end
else
self:say("I need the Iron Ore to give you the gear wheel. Come back when you have it.")
end
end;
da uma olhada na troca , o que vc deve colocar.






info
Group: Barão
Joined: 01/06/10
Posts: 230
Reputation: +25
:XTibia_smile:
to com problema com 2 npc :angry_smile:
1°
ele troca itens por outros itens (itens addons)
exemplo: 10 spider silk por 1 spool of yarn
4 warrior helmet por warrios's sweat
e por assim vai....
o problema é,
ele até respondeu quando eu peço o item que eu quero, + não troca,
e quando eu n tenho o item, ele fala que não tenho "10 spider silk",
por que é primeira parte do script....
outra coisa é ele n diferençia letra maiuscula e minuscula
Script:
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Eu posso trocar 2 royal helmets por {fighting spirit}, 4 warrior helmets por {warrior's sweat}, 3 fire swords por {magic sulphur}, boots of haste por {enchanted chicken wing}, 10 spider silk por {spool of yarn}, 1 devil helmet por {piece of hell steel}, 1 dragon shield por {piece of draconian steel}, 1 crown armor por {piece of royal steel} e 1 giant sword por {huge chunk of crude iron}... Diga apenas o nome do item, para nos negociarmos!"}) if(msgcontains(msg, 'spool of yarn') or msgcontains(msg, 'spider silk')) then selfSay('Você quer trocar 10 Spider Silk por 1 Spool of Yarn?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerItemCount(cid, 5879) >= 10) then doPlayerRemoveItem(cid, 5879, 10) doPlayerAddItem(cid, 5886) selfSay('Aqui esta.', cid) else selfSay('Desculpe, mais você não tem 10 spider silk.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Ok.', cid) end if(msgcontains(msg, 'huge chunk of crude iron') or msgcontains(msg, 'giant sword')) then selfSay('Você quer trocar uma giant spider por um huge chunk of crude iron?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerItemCount(cid, 2393) >= 1) then doPlayerRemoveItem(cid, 2393, 1) doPlayerAddItem(cid, 5892) selfSay('Aqui esta.', cid) else selfSay('Desculpe, mais você não tem uma giant sword.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Ok.', cid) end if(msgcontains(msg, 'enchanted chicken wing') or msgcontains(msg, 'boots of haste')) then selfSay('Você quer trocar uma boots of haste por uma enchanted chicken wing?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerItemCount(cid, 2195) >= 1) then doPlayerRemoveItem(cid, 2195, 1) doPlayerAddItem(cid, 5891) selfSay('Aqui esta.', cid) else selfSay('Desculpe, mais você não tem uma boots of haste.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Ok.', cid) end if(msgcontains(msg, 'warrior sweat') or msgcontains(msg, 'warrior helmet')) then selfSay('Você quer trocar 4 warrior helmet por 1 warrior sweat?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerItemCount(cid, 2475) >= 4) then doPlayerRemoveItem(cid, 2475, 4) doPlayerAddItem(cid, 5885) selfSay('Aqui esta.', cid) else selfSay('Desculpe, mais você não tem 4 warrior helmet.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Ok.', cid) end if(msgcontains(msg, 'fighting spirit') or msgcontains(msg, 'royal helmet')) then selfSay('Você quer trocar 2 royal helmet por 1 fighting spirit?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerItemCount(cid, 2498) >= 2) then doPlayerRemoveItem(cid, 2498, 2) doPlayerAddItem(cid, 5884) selfSay('Aqui esta.', cid) else selfSay('Desculpe, mais você não tem 2 royal helmet.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Ok.', cid) end if(msgcontains(msg, 'magic sulphur') or msgcontains(msg, 'fire sword')) then selfSay('Você quer trocar 3 fire sword por 1 magic sulphur?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerItemCount(cid, 2392) >= 3) then doPlayerRemoveItem(cid, 2392, 3) doPlayerAddItem(cid, 5904) selfSay('Aqui esta.', cid) else selfSay('Desculpe, mais você não tem 3 fire sword.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Ok.', cid) end if(msgcontains(msg, 'piece of hell steel') or msgcontains(msg, 'devil helmet')) then selfSay('Você quer trocar um devil helmet por um piece of hell steel?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerItemCount(cid, 2462) >= 1) then doPlayerRemoveItem(cid, 2462, 1) doPlayerAddItem(cid, 5888) selfSay('Aqui esta.', cid) else selfSay('Desculpe, mais você não tem um devil helmet.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Ok.', cid) end if(msgcontains(msg, 'piece of draconian steel') or msgcontains(msg, 'dragon shield')) then selfSay('Você quer trocar um dragon shield por um piece of draconian steel?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerItemCount(cid, 2516) >= 1) then doPlayerRemoveItem(cid, 2516, 1) doPlayerAddItem(cid, 5889) selfSay('Aqui esta.', cid) else selfSay('Desculpe, mais você não tem um dragon shield.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Ok.', cid) end if(msgcontains(msg, 'piece of royal steel') or msgcontains(msg, 'crown armor')) then selfSay('Você quer trocar uma crown armor por um piece of royal steel?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerItemCount(cid, 2487) >= 1) then doPlayerRemoveItem(cid, 2487, 1) doPlayerAddItem(cid, 5887) selfSay('Aqui esta.', cid) else selfSay('Desculpe, mais você não tem uma crown armor.', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Ok.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())2°
peguei varios npc de base, mais msm assim, ele não quer compra o item do player,
deve ser alguma coisinha errada que eu n achei
<?xml version="1.0" encoding="UTF-8"?> <npc name="Havec" script="data/npc/scripts/default.lua" walkinterval="2000" floorchange="0"> <health now="200" max="200"/> <look type="139" head="20" body="39" legs="45" feet="7" addons="2"/> <parameters> <parameter key="module_shop" value="1"/> <parameter key="shop_sellable" value="Ape Fur,5883,120;Bat Wing,5894,100;Bear Paw,5896,300;Behemoth Claw,5930,1000;Beholder Eye,5898,1000;Blue Note,2349,1000;Blue poc,5912,1000;Brown poc,5913,100;Brutus Bloodbeard's Hat,6099,1000000;Burning Heart,2353,100000;Cat's Paw,5480,100000;Chicken Feather,5890,100;Cobrafang Dagger,2351,100000;Countess Sorrow's Frozen Tear,6536,5000;Crystal Arrow,2352,5000;Deadeye Devious'Eye Patch,6102,100000;Demon Dust,5906,3000;Demon Horn,5954,3000;Demonic Essence,6500,1000;Dracola's Eye,6546,500000;Dragon Claw,5919,500000;Energy Soil,8303,10000;Eternal Flames,8304,5000;Eye Patch,6102,500;Ferumbras'Hat,5903,1000000;Fighting Spirit,5884,60000;Fish Fin,5895,2000;Flawless Ice Crystal,8300,1000;Gear Wheel,9690,1000;Giant Spider Silk,5879,5000;Gland,8971,1000;Glimmering Soil,8299,1000;Glob of Acid Slime,9967,100;Glob of Mercury,9966,100;Glob of Tar,9968,100;Green Dragon Leather,5877,120;Green Dragon Scale,5920,100;Green Piece of Cloth,5910,1000;Gold Ingot,9971,10000;Handmaiden's Protector,6539,50000;Hardened Bone,5925,1000;Heaven Blossom,5921,100;Holy Orchid,5922,1000;Honeycomb,5902,100;Hook,6097,500;Huge Chunk of Crude Iron,5892,10000;Hydra Egg,4850,1000;Iced Soil,8302,1000;Imperor's Trident,6534,500000;Iron Ore,5880,1000;Lethal Lissy's Shirt,6100,50000;Lizard Leather,5876,150;Lizard Scale,5881,120;Magic Sulphur,5904,12000;Mandrake,5015,500000;Minotaur Leather,5878,100;Morgaroth's Heart,5943,10000;Mother Soil,8305,1000;Mr. Punish's Handcuffs,6537,1000000;Nails,8309,100;Natural Soil,8298,1000;Nose Ring,5804,1000000;Ornamented Ankh,2354,5000;Orshabaal's Brain,5808,50000;Peg Leg,6126,500;Perfect Behemoth Fang,5893,1000;Piece of Draconian Steel,5889,10000;Piece of Hell Steel,5888,10000;Piece of Massacre's Shell,6540,500000;Plasmother's Remains,6535,50000;Pure Energy,8306,20000;Red Dragon Leather,5948,100;Red Dragon Scale,7314,200;Red Piece of Cloth,5911,1000;Ron the Ripper's Sabre,6101,100000;Royal Steel,5887,10000;Seeds,7732,500;Shard,7290,1000;Sniper Gloves,5875,3000;Soul Orb,5944,300;Soul Stone,5809,100000;Sword Hilt,2350,150000;The Ring of the Count,8752,10000;Turtle Shell,5899,150;Vampire Dust,5905,1000;Vampiric Crest,9955,10000;Warrior's Sweat,5885,15000;White Piece of Cloth,5909,1000;Wolf Paw,5897,100;Yellow Piece of Cloth,5914,1000;"/> <parameter key="shop_buyable" value="obsidian knife,5908,5000;blessed wooden stake,5942,5000;Rust Remover,9930,100;"/> </parameters> </npc>Obrigado