WE
dúvida

Erro em npc...

Por WExpert, 26 de fev. de 2013 em Scripts

resolvido
otserv
tibia
script
21
1.9k
WExpertW
26 de fevereiro de 2013 às 16:07

mais vou te explicar pra q eh...

isso eh um npc de saga, que modifica a storage do player, mais pra o player passar dessa "saga" ele precisa matar o monstro e dps ser teleportado e ganhar a storage pra ir pra proxima saga, se n tiver essa parada de playerpz o player n vai precisar matar o monstro e vai ser teleportado so em falar hi/yes , por isso precisa :/

SlicerS
26 de fevereiro de 2013 às 16:07

se tu quer q o player esteja em pz..

if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 and getPlayerPz(cid) then

 

se tu quer q o player n esteja em pz

if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 and not getPlayerPz(cid) then

 

em tese era pra ser assim, pela funçao q o rok mando ali...

RoksasR
26 de fevereiro de 2013 às 16:08

Bom, eu tinha pensando nisso mesmo. Pois como o Slicer falou seria TRUE E FALSE, e não tem nada abaixo disso, creio eu.

Tente assim:

 

 

local focus = 0

local talk_start = 0

local target = 0

local following = false

local attacking = false

 

function onThingMove(creature, thing, oldpos, oldstackpos)

 

end

 

 

function onCreatureAppear(creature)

 

end

 

 

function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('Ahahha.')

focus = 0

talk_start = 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)

msg = string.lower(msg)

 

if (msgcontains(msg, 'hi') and (focus == 0)) then

if getDistanceToCreature(cid) < 4 then

if getPlayerPz(cid) == 0 then

 

selfSay('Hahaha ' .. getCreatureName(cid) .. '! Can you death me? Ueeeee ueee')

focus = cid

talk_start = os.clock()

 

 

 

 

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Sorry, ' .. getCreatureName(cid) .. '! hahahaha.')

 

elseif focus == cid then

talk_start = os.clock()

 

if msgcontains(msg, 'yes') then

if getPlayerStorageValue(cid,8000) >= 1 then

selfSay('Sorry You Cant Do this saga.')

else

doTeleportThing(cid, x = {132, y = 610, z = 7})

selfSay('You death!')

focus = 0

talk_start = 0

 

end

 

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Good bye, ' .. getCreatureName(cid) .. '!')

focus = 0

talk_start = 0

end

end

end

end

end

 

function onThink()

doNpcSetCreatureFocus(focus)

if (os.clock() - talk_start) > 45 then

if focus > 0 then

selfSay('Next Please...')

end

focus = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

end

 

 

Bom cara se não der, podia adicionar uma storage quando matar o monstro, e só teleportar se tiver a storage, ai n precisa de Pz

Editado Fevereiro 26 por Roksas

WExpertW
26 de fevereiro de 2013 às 16:12

Vlwwwww slicer, rep+ deu serto a q vc mandou, e roksas n deu serto a sua quando poe ==0 ou ==1 n da serto :/

 

mais a do slicer funfou corretamente intão rep+ slicer e vlw ae por tentar ajudar roksas(se eu pudesse eu te dava rp+ so q esgotou ;/ msm assim vlw , e vc foi o kra q mais mi ajudou ate agora, eu acho q umas 5 vezes xD

 

vlw ae e t+ galera

Editado Fevereiro 26 por WExpert

RoksasR
26 de fevereiro de 2013 às 16:16

Nossa que burro eu. Era só por o "not", já tava assim no primeiro script q tu mando haha.

Bom, dúvida sanada, tópico reported.

 

BOA SORTE ;D

ErimythE
26 de fevereiro de 2013 às 16:48

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