Poketibias - Tudo sobre Tibia e OTServ!
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.
Poketibias - Tudo sobre Tibia e OTServ!

Tudo sobre Tibia, OTServ e Bots!


Você não está conectado. Conecte-se ou registre-se

NPC Task Item Poketibia

Ir para baixo  Mensagem [Página 1 de 1]

1NPC Task Item Poketibia Empty NPC Task Item Poketibia Ter Jul 07, 2015 2:41 pm

Luis Loiola


Membro
Membro

Olá, eu sou NTO Tokyo, e venho até vocês Viciados trazer 1 tutorial de como criar 1 npc task quest para poketibia server!!!

==========================================================================================================================


1º Passo - Copie 1 arquivo.xml da sua pasta data/npc e mude o nome para o nome que você, depois cole isso dentro dele:


Spoiler ;
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Brender" script="default.lua" walkinterval="350000" floorchange="0" speed="0">
<health now="150" max="150"/>
<look type="255" head="91" body="114" legs="86" feet="0"/>
<parameters>
<parameter key="message_greet" value="Ola |PLAYERNAME|.Voce que fazer a {task} rapido!"/> </parameters>

</npc>





==========================================================================================================================




2º Passo - Agora vai em data/npc/script copia qualquer arquivo.lua de la coloca o nome que você quizer (este nome vai colocar onde esta de azul no script acima) e cola isso dentro:


Spoiler
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {20}
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false


storage = x -- storage id
item = x -- coloca aqui o id do item que vai ter que ir buscar
quantiitem = x -- quantidade do item acima que precisa pegar
premio1 = x -- coloque aqui o id do dinheiro
quant1 = x -- quantidade de grana que vai ganhar
pexp = x -- experiencia que vai ganhar no premio







function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end




function onThingMove(creature, thing, oldpos, oldstackpos, item, itemEx)

end

function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Tchau, e boa sorte.',cid)
focus = 0
talk_start = 0
talkState[talkUser] = 0
end
end
function onCreatureTurn(creature)

end

function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if getDistanceToCreature(cid) > 4 then
return false
end

if talkState[talkUser] ~= 3 then
msg = string.lower(msg)
end

if (msgcontains(msg, 'hi')) then

if #getCreatureSummons(cid) >= 1 then
selfSay('Porfavor, chame o pokemon para a pokebola...', cid)
focus = 0
talkState[talkUser] = 1
return false
end

if getPlayerStorageValue(cid, 17001) == 1 then
focus = 0
talkState[talkUser] = 1

selfSay('Saia do Ride.', cid)
return false
end
if getPlayerStorageValue(cid, 7778) >= 1 then
focus = 0
talkState[talkUser] = 1
selfSay('Você está usando alguma habilidade.', cid)
return false
end

fala = "Hey, eu estou precisando urgentemente de x itens. Será que você poderia me ajudar?"

selfSay(fala,cid)
talkState[talkUser] = 1
elseif ( ( msgcontains(msg,"yes") or (msgcontains(msg,"sim") ) ) and talkState[talkUser] == 1 ) then

quest1 = getPlayerStorageValue(cid,storage)
if quest1 == 2 then
selfSay('Cara, você já me ajudou!',cid)
else

if quest1 ==1 then
selfSay('Bom! Então vc trouxe os meus itens? Deixe-me ver.',cid)
if doPlayerRemoveItem(cid, item, quantiitem) == true then
selfSay('Obrigado! Agora poderei fazer meu projeto. Aqui esta sua recompença!',cid)
doPlayerAddItem(cid,premio1,quant1)
doPlayerAddExp(cid,pexp)
setPlayerStorageValue(cid,storage, 2)
talkState[talkUser] = 0
else
selfSay('Voce não trouxe os meus itens... Volte quando tive-los.',cid)
talkState[talkUser] = 0
end

else
selfSay('Me traga os itens para o meu projeto.',cid)
setPlayerStorageValue(cid,storage, 1)
end
end














elseif(msgcontains(msg, 'no')) then
talkState[talkUser] = 0
selfSay('Okay, obrigado mesmo assim.', cid)
elseif(msgcontains(msg, 'bye')) then
selfSay('Até mais!', cid)
talkState[talkUser] = 0
end

end


function onCreatureChangeOutfit(creature)

end

Ir para o topo  Mensagem [Página 1 de 1]

Permissões neste sub-fórum
Não podes responder a tópicos