AJUDA ?
- Fórum
- OTServ
- Pedidos
- Tópicos Sem Resposta
- NPC Que puxa 4 Player
info
Grupo: Campones
Registrado: 01/06/17
Posts: 43
Reputação: +1
Gênero: Masculino
Char no Tibia: [ADM]Neq

info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

4 horas atrás, DrewMarques disse:AJUDA ?
Primeiro tente procurar por um NPC que teleporte 1 pessoa, depois peça ajuda para alguém colocar para teleportar somente se tiver quatro. Geralmente ajudas que demandam muito tempo não são atendidas, pois cada um tem seu tempo.
Coloque também informações sobre seu servidor.
Editado Junho 11 por Caronte
info
Grupo: Campones
Registrado: 01/06/17
Posts: 43
Reputação: +1
Gênero: Masculino
Char no Tibia: [ADM]Neq

1 hora atrás, Caronte disse:
Primeiro tente procurar por um NPC que teleporte 1 pessoa, depois peça ajuda para alguém colocar para teleportar somente se tiver quatro. Geralmente ajudas que demandam muito tempo não são atendidas, pois cada um tem seu tempo.
Coloque também informações sobre seu servidor.
Eu tenho um NPC aki
local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() end local cfg = { toPos = {x=359, y=1667, z=7}, -- Posição que o jogador sera teleportado level = 170, -- Level necessário para ser teleportado price = 50 -- Dinheiro a ser cobrado para ser teleportado} 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, 'rocket') then selfSay('You are sure you want to go? You can not return.', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') then if getPlayerLevel(cid) >= cfg.level then if doPlayerRemoveMoney(cid, cfg.price) then doTeleportThing(cid, cfg.toPos) talkState[talkUser] = 0 else selfSay('You don\'t have enough money.', cid) end else selfSay('You need level having above '.. cfg.level ..'.', cid) end elseif msgcontains(msg, 'no') then selfSay('Skirt here!', cid) end endend npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())
SERVIDOR: Poketibia versao 8.54 tfs 0.3.6
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

@DrewMarques, vou te ajudar
Obrigado por postar mais informações.
Sobre o level, são todos os players que precisam ter level? ou só o que conversa?
E dinheiro, somente tira de um player?
info
Grupo: Campones
Registrado: 01/06/17
Posts: 43
Reputação: +1
Gênero: Masculino
Char no Tibia: [ADM]Neq

Agora, Caronte disse:@DrewMarques, vou te ajudar
Obrigado por postar mais informações.
Sobre o level, são todos os players que precisam ter level? ou só o que conversa?
E dinheiro, somente tira de um player?
Sim todos os Player tem q ter lvl 170 , ja o dinheiro n precisa dinheiro pode ser retirado
Editado Junho 11 por DrewMarques
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

Faz um tempo que não programo lua, ultimamente tenho só programado em C , mas ta aí:
local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endlocal cfg = { toPos = {x=359, y=1667, z=7}, -- Posição que o jogador sera teleportado level = 170, -- Level necessário para ser teleportado price = 50, -- Dinheiro a ser cobrado para ser teleportado {x=123, y=456, z=7}, {x=123, y=456, z=7}, {x=123, y=456, z=7}, {x=123, y=456, z=7},}local naopode = 0function 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, 'rocket') then selfSay('You are sure you want to go? You can not return.', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') then naopode = 0 if getPlayerLevel(cid) >= cfg.level then for i = 1, 4 do if not isPlayer(getThingFromPos(cfg[i])) then naopode = 1 end end if naopode == 0 then if doPlayerRemoveMoney(cid, cfg.price) then for p = 1, 4 do doTeleportThing(getThingFromPos(cfg[i]), cfg.toPos) end talkState[talkUser] = 0 else selfSay('You don\'t have enough money.', cid) end else selfSay('You need 4 players to enter.', cid) talkState[talkUser] = 0 end else selfSay('You need level having above '.. cfg.level ..'.', cid) end elseif msgcontains(msg, 'no') then selfSay('Skirt here!', cid) end endendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())
Se tiver erro me fala por favor, você tem que alterar:
{x=123, y=456, z=7},{x=123, y=456, z=7}, {x=123, y=456, z=7}, {x=123, y=456, z=7},
para onde os players tem que ficar.
Por favor, se tiver erro poste como você deixou o script, e para testar esse script são necessários 4 players nas coordenadas que você configurar, você pode colocar as 4 coordenadas iguais para 1 piso somente, assim você testa só com você, mas teste com piso diferente também, para ver se o script está certo.
Editado Junho 11 por Caronte
info
Grupo: Campones
Registrado: 01/06/17
Posts: 43
Reputação: +1
Gênero: Masculino
Char no Tibia: [ADM]Neq

1 hora atrás, Caronte disse:
Faz um tempo que não programo lua, ultimamente tenho só programado em C , mas ta aí:
local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endlocal cfg = { toPos = {x=359, y=1667, z=7}, -- Posição que o jogador sera teleportado level = 170, -- Level necessário para ser teleportado price = 50, -- Dinheiro a ser cobrado para ser teleportado {x=123, y=456, z=7}, {x=123, y=456, z=7}, {x=123, y=456, z=7}, {x=123, y=456, z=7},}local naopode = 0function 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, 'rocket') then selfSay('You are sure you want to go? You can not return.', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') then naopode = 0 if getPlayerLevel(cid) >= cfg.level then for i = 1, 4 do if not isPlayer(getThingFromPos(cfg[i])) then naopode = 1 end end if naopode == 0 then if doPlayerRemoveMoney(cid, cfg.price) then for p = 1, 4 do doTeleportThing(getThingFromPos(cfg[i]), cfg.toPos) end talkState[talkUser] = 0 else selfSay('You don\'t have enough money.', cid) end else selfSay('You need 4 players to enter.', cid) talkState[talkUser] = 0 end else selfSay('You need level having above '.. cfg.level ..'.', cid) end elseif msgcontains(msg, 'no') then selfSay('Skirt here!', cid) end endendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())
Se tiver erro me fala por favor, você tem que alterar:
{x=123, y=456, z=7},{x=123, y=456, z=7}, {x=123, y=456, z=7}, {x=123, y=456, z=7},para onde os players tem que ficar.
Por favor, se tiver erro poste como você deixou o script, e para testar esse script são necessários 4 players nas coordenadas que você configurar, você pode colocar as 4 coordenadas iguais para 1 piso somente, assim você testa só com você, mas teste com piso diferente também, para ver se o script está certo.
Bom ele funcionou na parte de pedir os player ,mais quando tem os 4 player ele n puxa
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
local cfg = {
toPos = {x=1039, y=563, z=7}, -- Posição que o jogador sera teleportado
level = 1, -- Level necessário para ser teleportado
price = 0, -- Dinheiro a ser cobrado para ser teleportado
{x=1063, y=880, z=7},
{x=1063, y=881, z=7},
{x=1063, y=882, z=7},
{x=1063, y=883, z=7},
}
local naopode = 0
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, 'sim') then
selfSay('You are sure you want to go? You can not return.', cid)
talkState[talkUser] = 1
elseif talkState[talkUser] == 1 then
if msgcontains(msg, 'yes') then
naopode = 0
if getPlayerLevel(cid) >= cfg.level then
for i = 1, 4 do
if not isPlayer(getThingFromPos(cfg)) then
naopode = 1
end
end
if naopode == 0 then
if doPlayerRemoveMoney(cid, cfg.price) then
for p = 1, 4 do
doTeleportThing(getThingFromPos(cfg), cfg.toPos)
end
talkState[talkUser] = 0
else
selfSay('You don\'t have enough money.', cid)
end
else
selfSay('Desculpe Mais Precisa de um grupo de 4 Players', cid)
talkState[talkUser] = 0
end
else
selfSay('You need level having above '.. cfg.level ..'.', cid)
end
elseif msgcontains(msg, 'no') then
selfSay('Skirt here!', cid)
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

Opa, acho que esqueci de uma coisinha, toma aqui:
local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endlocal cfg = { toPos = {x=1039, y=563, z=7}, -- Posição que o jogador sera teleportado level = 1, -- Level necessário para ser teleportado price = 0, -- Dinheiro a ser cobrado para ser teleportado {x=1063, y=880, z=7}, {x=1063, y=881, z=7}, {x=1063, y=882, z=7}, {x=1063, y=883, z=7}, }local naopode = 0function 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, 'sim') then selfSay('You are sure you want to go? You can not return.', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') then naopode = 0 if getPlayerLevel(cid) >= cfg.level then for i = 1, 4 do if not isPlayer(getThingFromPos(cfg)) then naopode = 1 end end if naopode == 0 then if doPlayerRemoveMoney(cid, cfg.price) then for p = 1, 4 do doTeleportThing(getThingFromPos(cfg[p]), cfg.toPos) end talkState[talkUser] = 0 else selfSay('You don\'t have enough money.', cid) end else selfSay('Desculpe Mais Precisa de um grupo de 4 Players', cid) talkState[talkUser] = 0 end else selfSay('You need level having above '.. cfg.level ..'.', cid) end elseif msgcontains(msg, 'no') then selfSay('Skirt here!', cid) end endendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())
info
Grupo: Campones
Registrado: 01/06/17
Posts: 43
Reputação: +1
Gênero: Masculino
Char no Tibia: [ADM]Neq

Agora, Caronte disse:Opa, acho que esqueci de uma coisinha, toma aqui:
local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endlocal cfg = { toPos = {x=1039, y=563, z=7}, -- Posição que o jogador sera teleportado level = 1, -- Level necessário para ser teleportado price = 0, -- Dinheiro a ser cobrado para ser teleportado {x=1063, y=880, z=7}, {x=1063, y=881, z=7}, {x=1063, y=882, z=7}, {x=1063, y=883, z=7}, }local naopode = 0function 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, 'sim') then selfSay('You are sure you want to go? You can not return.', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') then naopode = 0 if getPlayerLevel(cid) >= cfg.level then for i = 1, 4 do if not isPlayer(getThingFromPos(cfg)) then naopode = 1 end end if naopode == 0 then if doPlayerRemoveMoney(cid, cfg.price) then for p = 1, 4 do doTeleportThing(getThingFromPos(cfg[p]), cfg.toPos) end talkState[talkUser] = 0 else selfSay('You don\'t have enough money.', cid) end else selfSay('Desculpe Mais Precisa de um grupo de 4 Players', cid) talkState[talkUser] = 0 end else selfSay('You need level having above '.. cfg.level ..'.', cid) end elseif msgcontains(msg, 'no') then selfSay('Skirt here!', cid) end endendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())
mesma coisa
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

Agora, DrewMarques disse:mesma coisa
Está usando 4 players mesmo? e o npc não diz nada?
info
Grupo: Campones
Registrado: 01/06/17
Posts: 43
Reputação: +1
Gênero: Masculino
Char no Tibia: [ADM]Neq

info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endlocal cfg = { toPos = {x=1039, y=563, z=7}, -- Posição que o jogador sera teleportado level = 1, -- Level necessário para ser teleportado price = 0, -- Dinheiro a ser cobrado para ser teleportado {x=1063, y=880, z=7}, {x=1063, y=881, z=7}, {x=1063, y=882, z=7}, {x=1063, y=883, z=7}, }local naopode = 0function 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, 'sim') then selfSay('You are sure you want to go? You can not return.', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') then naopode = 0 if getPlayerLevel(cid) >= cfg.level then for i = 1, 4 do if not isPlayer(getThingFromPos(cfg[p])) then naopode = 1 else naopode = 0 end if naopode == 0 then if doPlayerRemoveMoney(cid, cfg.price) then for p = 1, 4 do doTeleportThing(getThingFromPos(cfg[p]), cfg.toPos) end talkState[talkUser] = 0 else selfSay('You don\'t have enough money.', cid) end else selfSay('Desculpe Mais Precisa de um grupo de 4 Players', cid) talkState[talkUser] = 0 end else selfSay('You need level having above '.. cfg.level ..'.', cid) end elseif msgcontains(msg, 'no') then selfSay('Skirt here!', cid) end endendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())
info
Grupo: Campones
Registrado: 01/06/17
Posts: 43
Reputação: +1
Gênero: Masculino
Char no Tibia: [ADM]Neq

Agora, Caronte disse:local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endlocal cfg = { toPos = {x=1039, y=563, z=7}, -- Posição que o jogador sera teleportado level = 1, -- Level necessário para ser teleportado price = 0, -- Dinheiro a ser cobrado para ser teleportado {x=1063, y=880, z=7}, {x=1063, y=881, z=7}, {x=1063, y=882, z=7}, {x=1063, y=883, z=7}, }local naopode = 0function 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, 'sim') then selfSay('You are sure you want to go? You can not return.', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') then naopode = 0 if getPlayerLevel(cid) >= cfg.level then for i = 1, 4 do if not isPlayer(getThingFromPos(cfg[p])) then naopode = 1 else naopode = 0 end if naopode == 0 then if doPlayerRemoveMoney(cid, cfg.price) then for p = 1, 4 do doTeleportThing(getThingFromPos(cfg[p]), cfg.toPos) end talkState[talkUser] = 0 else selfSay('You don\'t have enough money.', cid) end else selfSay('Desculpe Mais Precisa de um grupo de 4 Players', cid) talkState[talkUser] = 0 end else selfSay('You need level having above '.. cfg.level ..'.', cid) end elseif msgcontains(msg, 'no') then selfSay('Skirt here!', cid) end endendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())
[11/06/2017 21:30:13] [Error - LuaScriptInterface::loadFile] datapack/npc/scripts/jenny.lua:54: 'end' expected (to close 'for' at line 34) near 'else'
[11/06/2017 21:30:13] [Warning - NpcScript::NpcScript] Cannot load script: datapack/npc/scripts/jenny.lua
[11/06/2017 21:30:13] datapack/npc/scripts/jenny.lua:54: 'end' expected (to close 'for' at line 34) near 'else'
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endlocal cfg = { toPos = {x=1039, y=563, z=7}, -- Posição que o jogador sera teleportado level = 1, -- Level necessário para ser teleportado price = 0, -- Dinheiro a ser cobrado para ser teleportado {x=1063, y=880, z=7}, {x=1063, y=881, z=7}, {x=1063, y=882, z=7}, {x=1063, y=883, z=7}, }local naopode = 0function 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, 'sim') then selfSay('You are sure you want to go? You can not return.', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') then naopode = 0 if getPlayerLevel(cid) >= cfg.level then for i = 1, 4 do if not isPlayer(getThingFromPos(cfg[p])) then naopode = 1 else naopode = 0 end end if naopode == 0 then if doPlayerRemoveMoney(cid, cfg.price) then for p = 1, 4 do doTeleportThing(getThingFromPos(cfg[p]), cfg.toPos) end talkState[talkUser] = 0 else selfSay('You don\'t have enough money.', cid) end else selfSay('Desculpe Mais Precisa de um grupo de 4 Players', cid) talkState[talkUser] = 0 end else selfSay('You need level having above '.. cfg.level ..'.', cid) end elseif msgcontains(msg, 'no') then selfSay('Skirt here!', cid) end endendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())


info
Grupo: Campones
Registrado: 01/06/17
Posts: 43
Reputação: +1
Gênero: Masculino
Char no Tibia: [ADM]Neq
Oi Scripts do Xtibia Estou precisando de um NPc q puxa 4 player para uma area apenas 4 player, se n tiver os 4 player ele n teleporta, e tmbn q seja 1 vez ao dia q esse NPC Funcione caso alguem ja tiver falado com ele , ele n ira mais teleporta ngm
alguem poderia me ajudar?