Essa seção não deve ser usada para pedidos ou dúvidas, temos uma seção específica para isso. Por favor, preste mais atenção da próxima vez.
Movido para Pedidos e Dúvidas - Scripting.
info
Group: Marquês
Joined: 16/06/07
Posts: 1.2k
Reputation: +377
Gender: Masculino
Tibia Character: Nenhum

info
Group: Conde
Joined: 16/09/07
Posts: 600
Reputation: +151
Gender: Masculino
Tibia Character: NãoJogoMais

Sei que saberá editar depois que o script estiver pronto, mas quando for assim, coloque as ids dos items para facilitar para os scripters.
Se não fizerem pra ti, quando eu voltar eu monto.
Boa sorte.
info
Group: Campones
Joined: 28/07/13
Posts: 54
Reputation: 0
Gender: Masculino
Tibia Character: Careconaldo

Desculpe Omega e adriano agradeço muito se montar ele para mim ^^
Fiz rapidinho aqui, porque jaja estou saindo:
XML do NPC:
<?xml version="1.0" encoding="UTF-8"?> <npc name="Flawless Ice Crystal" script="flawlesscrystal.lua" walkinterval="0" floorchange="0" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="523" head="114" body="119" legs="114" feet="114" corpse="2212"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|, voce deseja trocar 10 life crystal por 1 Flawless Ice Crystal?"/> </parameters> </npc>
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
local cfg = {
life_crystal = xxx, --ID do life crystal
life_crystal_qnt = 10, --Quantidade de life crystal necessários.
flawless_ice_crystal = xxx, --ID do flawless ice crystal.
flawless_ice_crystal_qnt = 1, --Quantidade de flawless ice crystal que o player irá receber.
}
if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then
if getPlayerItemCount(cid, cfg.life_crystal) >= cfg.life_crystal_qnt then
selfSay("Aqui está seu Flawless Ice Crystal!", cid)
doPlayerRemoveItem(cid, cfg.life_crystal, cfg.life_crystal_qnt)
doPlayerAddItem(cid, flawless_ice_crystal, flawless_ice_crystal_qnt)
talkState[talkUser] = 0
return true
else
selfsay("Você não tem "..life_crystal_qnt.." Life Crystals para trocar...", cid)
talkState[talkUser] = 0
return true
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())Edited Novembro 14 by zipter98
info
Group: Marquês
Joined: 03/02/13
Posts: 1.2k
Reputation: +254
Gender: Masculino
Tibia Character: Partiu Baladinha

Zipter, só corrigindo que sairá um erro aqui:
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
local cfg = {
life_crystal = xxx, --ID do life crystal
life_crystal_qnt = 10, --Quantidade de life crystal necessários.
flawless_ice_crystal = xxx, --ID do flawless ice crystal.
flawless_ice_crystal_qnt = 1, --Quantidade de flawless ice crystal que o player irá receber.
}
if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then
if getPlayerItemCount(cid, cfg.life_crystal) >= cfg.life_crystal_qnt then
selfSay("Aqui está seu Flawless Ice Crystal!", cid)
doPlayerRemoveItem(cid, cfg.life_crystal, cfg.life_crystal_qnt)
doPlayerAddItem(cid, flawless_ice_crystal, flawless_ice_crystal_qnt)
talkState[talkUser] = 0
return true
else
selfsay("Você não tem "..life_crystal_qnt.." Life Crystals para trocar...", cid)
talkState[talkUser] = 0
return true
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
O seu está assim:
selfsay("Você não tem "..life_crystal_qnt" Life Crystals para trocar...", cid)
Correto:
selfsay("Você não tem "..life_crystal_qnt.." Life Crystals para trocar...", cid)
Se esqueceu dos ".." ali hehehe' abraços.
Tinha feito correndo, ai nem reparei nisso e.e Valeu por corrigir!
Edited Novembro 14 by zipter98
info
Group: Campones
Joined: 28/07/13
Posts: 54
Reputation: 0
Gender: Masculino
Tibia Character: Careconaldo

so vou testar aki se der certo rep+
aki não deu não quando vou ponhar o npc ele fica invezivel n da pa ver ele e quando chego in game perto dele da debug no char e nem da de logar o char até eu tirar o npc ;/
Deve ser problema do XML que mandei. Recomendo que faça um XML próprio, ou mude essa parte:
<look type="523" head="114" body="119" legs="114" feet="114" corpse="2212"/>
Respectivamente, a "roupa" do NPC (look type); as cores da outfit dele (head, body, legs e feet); e a corpse dele. (esse último, como não altera muita coisa, pode deixar 2212.)
Edited Novembro 15 by zipter98
info
Group: Campones
Joined: 28/07/13
Posts: 54
Reputation: 0
Gender: Masculino
Tibia Character: Careconaldo

ok
irei evr aki





info
Group: Campones
Joined: 28/07/13
Posts: 54
Reputation: 0
Gender: Masculino
Tibia Character: Careconaldo
Queria saber se vcs poderiam fazer esse npc pra mim
nome DO NPC = Flawless Ice Crystal
quando um player for falar com ele quero que seja asim
player : hi
npc : ola [nome do player] voce deseja trocar 10 life crystal por 1 Flawless Ice Crystal
player : yes
aew se o player tiver 10 life crystal na bp o npc pega esses 10 life crystal e da 1 Flawless Ice Crystal
valendo rep+