começa a fazer ele que eu te ajudo na parte da storage
info
Grupo: Artesão
Registrado: 02/11/12
Posts: 110
Reputação: +4
Char no Tibia: Druid

na parte de storage eu tb sei :s
Não é dificl, basta pegar um de exemplo, se usar nodes então facilita muito. Eu poderia fazer pra ti, mas não te traria conhecimento se tu não tentasse primeiro.
info
Grupo: Artesão
Registrado: 02/11/12
Posts: 110
Reputação: +4
Char no Tibia: Druid

eu tenho esse que só leva para uma city tem como adaptar para 3 lugares?
local tab = {
storage = 10015,
pos = {x = 2205, y = 573, z = 7},
}
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:lower()) end
function onThink() npcHandler:onThink() end
local talkState = {}
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "city1") then
selfSay("Você deseja viajar para city1?", cid)
talkState[talkUser] = 1
elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, tab.storage) > 0 and getPlayerLevel(cid) >= 250 then
selfSay("Chegamos!", cid)
doSendMagicEffect(getThingPos(cid), 10)
npcHandler:releaseFocus(cid)
doTeleportThing(cid, tab.pos)
doSendMagicEffect(tab.pos, 10)
else
selfSay("você não pode viajar", cid)
end
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
info
Grupo: Herói
Registrado: 01/05/08
Posts: 2.6k
Reputação: +536
Gênero: Masculino

gostaria de pedir ajuda de vocês preciso de um npc que teletransporta para 3 lugares diferente mais so teletransportar se o player tiver x storage alguém poderia ajudar?
lugar 1 pode ser chamado de =[city1]
lugar 2 pode ser chamado de =[city2]
lugar 3 pode ser chamado de =[city3]
abraco!
Tenta assim:
local config = {
["city1"] = {str = 12000, pos = {x = 1, y = 2, z = 3}},
["city2"] = {str = 12001, pos = {x = 1, y = 2, z = 3}},
["city3"] = {str = 12002, pos = {x = 1, y = 2, z = 3}}
}
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 creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
msg = string.lower(msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'city1') or msgcontains(msg, 'city2') or msgcontains(msg, 'city3') then
local city = config[msg]
if getPlayerStorageValue(cid, city.str) > 0 then
doTeleportThing(cid, city.pos)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
talkState[talkUser] = 0
selfSay("Chegamos!", cid)
else
selfSay("Voce nao tem permissao para esta viagem.", cid)
talkState[talkUser] = 0
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Editado Setembro 11 por Bruno Minervino
info
Grupo: Artesão
Registrado: 02/11/12
Posts: 110
Reputação: +4
Char no Tibia: Druid

Tenta assim:
local config = { ["city1"] = {str = 12000, pos = {x = 1, y = 2, z = 3}}, ["city2"] = {str = 12001, pos = {x = 1, y = 2, z = 3}}, ["city3"] = {str = 12002, pos = {x = 1, y = 2, z = 3}} } 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 creatureSayCallback(cid, type, msg) msg = string.lower(msg) local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if not npcHandler:isFocused(cid) then return false end if msgcontains(msg, 'hi') and talkState[talkUser] == 0 then selfSay('Ola ' .. getPlayerName(cid) .. '! Eu promovo grandes viagens para {city1}, {city2} e {city3}.') talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then local city = config[msg] if city then if getPlayerStorageValue(cid, city.str) > 0 then doTeleportThing(cid, city.pos) doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) talkState[talkUser] = 0 else selfSay('Voce nao tem permissao para esta viagem.') end else selfSay('Eu nao encontrei este destino em meu itinerario.') end elseif msgcontains(msg, 'bye') then selfSay('Ate logo, ' .. getPlayerName(cid) .. '!') talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
npc n ta respondendo n
https://gist.github.com/dalvorsn/ddd2e23ab8c651fb91da
ps.: tu não falou a respeito do level, então julguei que seria um valor dinamico de acordo com a cidade ...
Editado Setembro 11 por dalvorsn
info
Grupo: Herói
Registrado: 01/05/08
Posts: 2.6k
Reputação: +536
Gênero: Masculino

npc n ta respondendo n
Editei, testa lá.
info
Grupo: Marquês
Registrado: 03/02/13
Posts: 1.2k
Reputação: +254
Gênero: Masculino
Char no Tibia: Partiu Baladinha

Tópico Movido
Este tópico foi movido de "OTServ → Suporte OTServ → Suporte Scripting"
para "OTServ → Suporte OTServ → Suporte Scripting → Pedidos e dúvidas resolvidos - Scripting".





info
Grupo: Artesão
Registrado: 02/11/12
Posts: 110
Reputação: +4
Char no Tibia: Druid
gostaria de pedir ajuda de vocês preciso de um npc que teletransporta para 3 lugares diferente mais so teletransportar se o player tiver x storage alguém poderia ajudar?
lugar 1 pode ser chamado de =[city1]
lugar 2 pode ser chamado de =[city2]
lugar 3 pode ser chamado de =[city3]
abraco!
.
Editado Setembro 11 por leandrozera