Boa Dia ! Bem eu criei Varios Npc's de addons todos separados, um para cada addon mais não da para summonar eles no mapa eu queria saber se o script tem algo de errado ai vai o script do npc !
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
npcHandler:setMessage(MESSAGE_GREET, "Olá Jovem |PLAYERNAME|. Quer ter uma roupa de mago? Eu posso arrumar, colhete os itens necessario que ganhará sua roupa de mago! Diga {addons} ou {help} se você não sabe o que fazer.')
function playerBuyAddonNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.confirm ~= true) and (parameters.decline ~= true) then
if(getPlayerPremiumDays(cid) == 0) and (parameters.premium == true) then
npcHandler:say('Sorry, but this addon is only for premium players!', cid)
npcHandler:resetNpc()
return true
end
if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then
npcHandler:say('You already have this addon!', cid)
npcHandler:resetNpc()
return true
end
local itemsTable = parameters.items
local items_list = ''
if table.maxn(itemsTable) > 0 then
for i = 1, table.maxn(itemsTable) do
local item = itemsTable
items_list = items_list .. item[2] .. ' ' .. getItemNameById(item[1])
if i ~= table.maxn(itemsTable) then
items_list = items_list .. ', '
end
end
end
local text = ''
if (parameters.cost > 0) and table.maxn(parameters.items) then
text = items_list .. ' and ' .. parameters.cost .. ' gp'
elseif (parameters.cost > 0) then
text = parameters.cost .. ' gp'
elseif table.maxn(parameters.items) then
text = items_list
end
npcHandler:say('Você trouxe os iten ' .. text .. ' para Mage addon?', cid)
return true
elseif (parameters.confirm == true) then
local addonNode = node:getParent()
local addoninfo = addonNode:getParameters()
local items_number = 0
if table.maxn(addoninfo.items) > 0 then
for i = 1, table.maxn(addoninfo.items) do
local item = addoninfo.items
if (getPlayerItemCount(cid,item[1]) >= item[2]) then
items_number = items_number + 1
end
end
end
if(getPlayerMoney(cid) >= addoninfo.cost) and (items_number == table.maxn(addoninfo.items)) then
doPlayerRemoveMoney(cid, addoninfo.cost)
if table.maxn(addoninfo.items) > 0 then
for i = 1, table.maxn(addoninfo.items) do
local item = addoninfo.items
doPlayerRemoveItem(cid,item[1],item[2])
end
end
doPlayerAddOutfit(cid, addoninfo.outfit_male, addoninfo.addon)
doPlayerAddOutfit(cid, addoninfo.outfit_female, addoninfo.addon)
setPlayerStorageValue(cid,addoninfo.storageID,1)
npcHandler:say('Aqui está.', cid)
else
npcHandler:say('Você não tem itens necessários!', cid)
end
npcHandler:resetNpc()
return true
elseif (parameters.decline == true) then
npcHandler:say('Não está interessado? Talvez outros addon?', cid)
npcHandler:resetNpc()
return true
end
return false
end
local noNode = KeywordNode:new({'no'}, playerBuyAddonNPC, {decline = true})
local yesNode = KeywordNode:new({'yes'}, playerBuyAddonNPC, {confirm = true})
-- hunter (done)
local outfit_node = keywordHandler:addKeyword({'Chapéu de Mago'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {5903,1}, outfit_female = 138, addon = 2, outfit_male = 130, addon = 1, storageID = 20048})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'Varinha de Mago'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {7440,1}, {7424,1}, {8092,1}, {8094,1}, outfit_female = 138, addon = 1, outfit_male = 130, addon = 2, storageID = 20049})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Meu caro eu posso fazer uma roupa de mago para você diga {help} para escolher qual você quer.'})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Jovem posso fazer lhe o Chapéu de Mago ou a a Varinha de Mago me fale Chapéu de Mago ou Varinha de Mago qual você quer?.'})
npcHandler:addModule(FocusModule:new())
<?xml version="1.0" encoding="UTF-8"?><npc name="Nargues" script="data/npc/scripts/mageaddon.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="130" head="76" body="132" legs="89" feet="40" addons="2"/>
</npc>
Aqui Vai uma Imagen :
Desculpa eu sou novo no xtibia e nao sei muito bem como postar agradeço des de já !