PRECISO DE UM NPC QUE TROCA ITEM POR OUTFIT PARA POKEMON
[Encerrado] NPC QUE TROCA ITEM POR OUTFIT

qual item seria? poderia me mandar o id? e esse outfit do pokemon é um item que da addon para o pokemon?
tipo o npc vai trocar tall item dropado por uma outfit tipo npc clothes porem em vez de dinheiro e item
Vai em outftis.xml
e cria uma outfit
<outfit id="ID" premium="yes" quest="66565"> <list gender="0" lookType="look" name="nome"/> <list gender="1" lookType="look" name="nome"/> </outfit>
Crie um NPC e no arquivo lua dele cole isso:
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 --alterado v2.8 \/ peguem ele todo! local outs = { ["NOME"] = {66565}, } quant = QUANTIDADE item = ID ITEM msg = string.lower(msg) if (msgcontains(msg, 'outfit') or msgcontains(msg, 'outfits')) then selfSay("I sell this outfits: {NOME}??", cid) talkState[talkUser] = 2 elseif outs[msg] and talkState[talkUser] == 2 then selfSay("Are you sure which want trade item for that outfit?", cid) outfit = outs[tostring(msg)] talkState[talkUser] = 3 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then if doPlayerRemoveItem(cid, item, quant)then doPlayerRemoveItem(cid, item, quant) setPlayerStorageValue(cid, outs[1], 1) else selfSay("You need "..quant.."x "..getItemNameById(item).." to get this outfit!", cid) talkState[talkUser] = 0 return false end else selfSay("You already have this outfit, so please, choose another outfit...", cid) talkState[talkUser] = 0 return false end selfSay("So... Here is.", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, 'no') and talkState[talkUser] == 3 then selfSay("So... Please choose another outfit...", cid) talkState[talkUser] = 0 end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Não testei aqui, vê se dá certo ai.
Contato:
Email: contato@ceetros.com
Discord: Ceetros#5376
Telegram: @ceetros
erro na linha 52
[02/02/2016 20:37:56] [Error - LuaScriptInterface::loadFile] data/npc/scripts/roupas.lua:52: 'end' expected (to close 'function' at line 9) near 'elseif'
erro na linha 52
[02/02/2016 20:37:56] [Error - LuaScriptInterface::loadFile] data/npc/scripts/roupas.lua:52: 'end' expected (to close 'function' at line 9) near 'elseif'
[02/02/2016 20:37:56] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/roupas.lua[02/02/2016 20:37:56] data/npc/scripts/roupas.lua:52: 'end' expected (to close 'function' at line 9) near 'elseif'
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 --alterado v2.8 \/ peguem ele todo! local outs = { ["NOME"] = {66565}, } quant = QUANTIDADE item = ID ITEM msg = string.lower(msg) if (msgcontains(msg, 'outfit') or msgcontains(msg, 'outfits')) then selfSay("I sell this outfits: {NOME}??", cid) talkState[talkUser] = 2 elseif outs[msg] and talkState[talkUser] == 2 then selfSay("Are you sure which want trade item for that outfit?", cid) outfit = outs[tostring(msg)] talkState[talkUser] = 3 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then if doPlayerRemoveItem(cid, item, quant)then doPlayerRemoveItem(cid, item, quant) setPlayerStorageValue(cid, outs[1], 1) else selfSay("You need "..quant.."x "..getItemNameById(item).." to get this outfit!", cid) talkState[talkUser] = 0 return false end else selfSay("You already have this outfit, so please, choose another outfit...", cid) talkState[talkUser] = 0 return false selfSay("So... Here is.", cid) talkState[talkUser] = 0 return true elseif msgcontains(msg, 'no') and talkState[talkUser] == 3 then selfSay("So... Please choose another outfit...", cid) talkState[talkUser] = 0 end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Contato:
Email: contato@ceetros.com
Discord: Ceetros#5376
Telegram: @ceetros
DEU ISSO AGR [02/02/2016 20:44:39] [Error - LuaScriptInterface::loadFile] data/npc/scripts/roupas.lua:45: 'end' expected (to close 'if' at line 25) near 'selfSay'
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
--alterado v2.8 \/ peguem ele todo!
local outs = {
["NOME"] = {66565},
}
quant = QUANTIDADE
item = ID ITEM
msg = string.lower(msg)
if (msgcontains(msg, 'outfit') or msgcontains(msg, 'outfits')) then
selfSay("I sell this outfits: {NOME}??", cid)
talkState[talkUser] = 2
end
if outs[msg] and talkState[talkUser] == 2 then
selfSay("Are you sure which want trade item for that outfit?", cid)
outfit = outs[tostring(msg)]
talkState[talkUser] = 3
end
if msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
if doPlayerRemoveItem(cid, item, quant)then
doPlayerRemoveItem(cid, item, quant)
setPlayerStorageValue(cid, outs[1], 1)
else
selfSay("You need "..quant.."x "..getItemNameById(item).." to get this outfit!", cid)
talkState[talkUser] = 0
return false
end
end
if getPlayerStorageValue(cid, outs[1]) == 1 then
selfSay("You already have this outfit, so please, choose another outfit...", cid)
talkState[talkUser] = 0
return false
selfSay("So... Here is.", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, 'no') and talkState[talkUser] == 3 then
selfSay("So... Please choose another outfit...", cid)
talkState[talkUser] = 0
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Contato:
Email: contato@ceetros.com
Discord: Ceetros#5376
Telegram: @ceetros
erro
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
--alterado v2.8 \/ peguem ele todo!
local outs = {
["NOME"] = {sto = 66565, item = item, quant = quant},
}
msg = string.lower(msg)
if (msgcontains(msg, 'outfit') or msgcontains(msg, 'outfits')) then
selfSay("I sell this outfits: {NOME}??")
talkState[talkUser] = 2
end
if outs[msg] and talkState[talkUser] == 2 then
selfSay("Are you sure which want trade item for that outfit?")
outfit = outs[tostring(msg)]
talkState[talkUser] = 3
end
if msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
if doPlayerRemoveItem(cid, outs[1].item, outs[1].quant)then
doPlayerRemoveItem(cid, outs[1].item, outs[1].quant)
setPlayerStorageValue(cid, outs[1].sto, 1)
else
selfSay("You need "..outs[1].quant.."x "..getItemNameById(outs[1].item).." to get this outfit!")
talkState[talkUser] = 0
return false
end
end
if getPlayerStorageValue(cid, outs[1].sto) == 1 then
selfSay("You already have this outfit, so please, choose another outfit...")
talkState[talkUser] = 0
return false
selfSay("So... Here is.")
talkState[talkUser] = 0
return true
elseif msgcontains(msg, 'no') and talkState[talkUser] == 3 then
selfSay("So... Please choose another outfit...")
talkState[talkUser] = 0
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Contato:
Email: contato@ceetros.com
Discord: Ceetros#5376
Telegram: @ceetros
mesmo erro [03/02/2016 10:05:15] [Error - LuaScriptInterface::loadFile] data/npc/scripts/roupas.lua:46: 'end' expected (to close 'if' at line 42) near 'selfSay'
[03/02/2016 10:05:15] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/roupas.lua
[03/02/2016 10:05:15] data/npc/scripts/roupas.lua:46: 'end' expected (to close 'if' at line 42) near 'selfSay'
mesmo erro [03/02/2016 10:05:15] [Error - LuaScriptInterface::loadFile] data/npc/scripts/roupas.lua:46: 'end' expected (to close 'if' at line 42) near 'selfSay'
[03/02/2016 10:05:15] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/roupas.lua
[03/02/2016 10:05:15] data/npc/scripts/roupas.lua:46: 'end' expected (to close 'if' at line 42) near 'selfSay'
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 --alterado v2.8 \/ peguem ele todo! local outs = { ["NOME"] = {sto = 66565, item = item, quant = quant}, } msg = string.lower(msg) if (msgcontains(msg, 'outfit') or msgcontains(msg, 'outfits')) then selfSay("I sell this outfits: {"..outs[1].."}??") talkState[talkUser] = 2 end if outs[msg] and talkState[talkUser] == 2 then selfSay("Are you sure which want trade item for that outfit?") outfit = outs[tostring(msg)] talkState[talkUser] = 3 end if msgcontains(msg, 'yes') and talkState[talkUser] == 3 then if doPlayerRemoveItem(cid, outs[1].item, outs[1].quant)then doPlayerRemoveItem(cid, outs[1].item, outs[1].quant) setPlayerStorageValue(cid, outs[1].sto, 1) elfSay("So... Here is.") talkState[talkUser] = 0 return true else selfSay("You need "..outs[1].quant.."x "..getItemNameById(outs[1].item).." to get this outfit!") talkState[talkUser] = 0 return false end end if getPlayerStorageValue(cid, outs[1].sto) == 1 then selfSay("You already have this outfit, so please, choose another outfit...") talkState[talkUser] = 0 return false elseif msgcontains(msg, 'no') and talkState[talkUser] == 3 then selfSay("So... Please choose another outfit...") talkState[talkUser] = 0 end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Contato:
Email: contato@ceetros.com
Discord: Ceetros#5376
Telegram: @ceetros
+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
"O fracasso é a oportunidade de se começar de novo inteligentemente"