PL
poketibia

[Encerrado] NPC de promote poketibia

Por Pluzetti, 07 de abr. de 2013 em Tópicos Sem Resposta

promote
tibia
otserv
14
1.2k
PluzettiP
07 de abril de 2013 às 15:09

Gostaria de um npc que quando vc falasse com ele seria assim:

 

 

Player: Hi

NPC: Olá Kevintwo para virar Treinador elite diga promote

Player :Promote

NPC: Parabéns agora vc é um Treinador elite

 

 

 

AlGUEM PODE ME AJUDAR?

 

 

EM BREVE POKÉMON AWAY ONLINE...NÃO PERCAM A GRANDE INAUGURAÇÃO

Editado Abril 7 por Pluzetti

RoksasR
07 de abril de 2013 às 15:19

Tenta assim, em data/npc/scripts crie um arquivo chamado promotrainer.lua e adicione dentro:

 

 

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 vocgain = 6 -- ID DA VOCATION TREINADOR

 

if msgcontains(msg, "hi") then

selfSay("Hi "..getCreatureName(cid).." to do promoted a Treinador, say 'promote'")

talkState = 1

 

if talkState == 1 then

if msgcontains(msg, "promote") and getPlayerVocation(cid) ~= vocgain then

doPlayerSetVocation(cid,vocgain)

selfSay("Congratulations, you has been promoted!")

doPlayerSendTextMessage(cid,27,"Você será kikado em 10 segundos, recolha seus items!")

addEvent(doRemoveCreature, 10*1000, cid, true)

end

else

selfSay("You cannot promote again, bye!")

end

end

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

Agora volte uma pasta (data/npc), crie um arquivo chamado Promotrainer.xml e adicione dentro:

 

 

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Trainer" script="promotrainer.lua" walkinterval="2000" floorchange="0">

<health now="100" max="100"/>

<look type="130" head="39" body="122" legs="125" feet="57" addons="0"/>

</npc>

 

 

 

 

Agora reinicia o server, e fala:

 

/n Trainer

PluzettiP
07 de abril de 2013 às 15:37

Ele apenas fala isso

15:35 Trainer: Welcome, Kevintwo! I have been expecting you.

 

eu falo promote e nao faz mais nada

firewereF
07 de abril de 2013 às 15:46

tenta flaar promote

 

hi promote e yes . pode dar serto

 

local vocgain = 6 -- ID DA VOCATION TREINADOR aqui seria para fazer oque

PluzettiP
07 de abril de 2013 às 15:47

firewere eu falo hi e ele só fala akilo e falo promote é como se nao reconhecesse a fala,sacas?

 

 

seria a vocação q ele iria ganha no caso a 2 q é Treinador elite

Editado Abril 7 por Pluzetti

RoksasR
07 de abril de 2013 às 15:53

Tente:

 

 

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 vocgain = 2 -- ID DA VOCATION TREINADOR

 

 

if msgcontains(msg, "promote") then

if getPlayerVocation(cid) ~= vocgain then

doPlayerSetVocation(cid,vocgain)

selfSay("Congratulations, you has been promoted!")

doPlayerSendTextMessage(cid,27,"Você será kikado em 10 segundos, recolha seus items!")

addEvent(doRemoveCreature, 10*1000, cid, true)

end

else

selfSay("You cannot promote again, bye!")

end

end

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

PluzettiP
07 de abril de 2013 às 15:56

Agr eu falo Hi ele nao reconhece kkkk

RoksasR
07 de abril de 2013 às 15:58

Deu erro no distro?

PluzettiP
07 de abril de 2013 às 15:59

Sim

RoksasR
07 de abril de 2013 às 16:02

 

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 vocgain = 2 -- ID DA VOC Q GANHA

 

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, 'promote')) then

if (getPlayerVocation(cid) < 2) then

doPlayerSetVocation(cid,2)

npcHandler:say('Congratulations, promotioned!', cid)

talkState[talkUser] = 1

end

return true

end

 

return false

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

PluzettiP
07 de abril de 2013 às 16:09

funciono obrigado

firewereF
07 de abril de 2013 às 16:09

tem geito de deixa um npc num lugar fixo sem precisa usar o Rme e quando reiniar o server ele aidna estiver la ??

RoksasR
07 de abril de 2013 às 16:12

Fire, crie um tópico para sua própria dúvida ou envie uma PM ok?

Não, não tem como, apenas pelo Map Editor.

 

~~

 

Tópico movido para seção de dúvidas e pedidos resolvidos!

5 anos depois...
StigalS
21 de abril de 2018 às 02:44
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ 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.