Cara, posta o script completo por favor
)
Usando spoilers pf.
info
Group: Herói
Joined: 14/12/10
Posts: 3.6k
Reputation: +846
Gender: Masculino

Cara, posta o script completo por favor
)
Usando spoilers pf.
info
Group: Infante
Joined: 27/01/13
Posts: 1.7k
Reputation: +104
Gender: Masculino

Duvida como eu fasso alguma coisa dentro de spoiler?
info
Group: Artesão
Joined: 28/10/12
Posts: 128
Reputation: +15
Tibia Character: Tidifen

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)) and getDistanceToCreature(cid) < 4 and 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
travel(cid, 132, 610, 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
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
Edited Fevereiro 26 by WExpert
info
Group: Herói
Joined: 14/12/10
Posts: 3.6k
Reputation: +846
Gender: Masculino

Sky, creio que isso seja flood. Mandasse PM ou criasse um tópico
)
Bom, faça assim:
COLOQUE SEU CODIGO AKI [/spoiler.]
ja era
), essas 2 tags no começo e no fim do código
(SEM O PONTO NO FINAL
@@TOPICO
BOM, 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
travel(cid, 132, 610, 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
Edited Fevereiro 26 by Roksas
info
Group: Infante
Joined: 27/01/13
Posts: 1.7k
Reputation: +104
Gender: Masculino

Rep+
REP+
Edited Fevereiro 26 by SkyDarkyes
info
Group: Herói
Joined: 14/12/10
Posts: 3.6k
Reputation: +846
Gender: Masculino

cara
é só no final
no começo é
sem o /
;]
Funcionou o script?
info
Group: Artesão
Joined: 28/10/12
Posts: 128
Reputation: +15
Tibia Character: Tidifen

n funfou, eu tenho um script parecido aki e funfa olha ae:
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('Hey!.')
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)) and getDistanceToCreature(cid) < 4 then
selfSay('Do you want to finish Gt Saga??')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! ????????.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'yes') then
if getPlayerStorageValue(cid,8000) <= 53 then
selfSay('Sorry You Cant Do this saga.')
elseif msgcontains(msg, 'yes') then
if getPlayerStorageValue(cid,8000) >= 55 then
selfSay('Sorry You Cant Do this saga.')
else
if doPlayerAddItem(cid,5894,1) then
setPlayerStorageValue(cid,8000,55)
selfSay('Congratulations!')
focus = 0
talk_start = 0
end
end
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. getCreatureName(cid) .. '!')
focus = 0
talk_start = 0
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
interessante q copiei e colei na script do outro e continuou com akele erro, mais na dele msm n tem erro nenhum, vc fala hi e ele fala you finish gt saga? '-'
Edited Fevereiro 26 by WExpert
info
Group: Príncipe
Joined: 19/08/10
Posts: 4k
Reputation: +1.1k
Gender: Masculino

sabes oq essa funçao faz?
getPlayerPz(cid)
o resto da linha 39 parece esta correto, eu soh n sei oq essa funçao retorna entao pode ser ela q ta dando o erro.. sei la kk
info
Group: Artesão
Joined: 28/10/12
Posts: 128
Reputation: +15
Tibia Character: Tidifen

eu tentei tirar essa funçao ae e continua o erro ![]()
info
Group: Herói
Joined: 14/12/10
Posts: 3.6k
Reputation: +846
Gender: Masculino

Slicer, essa função coloquei assim:
if getPlayerPz(cid) <= 0 then
Ou seja
0 = NAO TA DENTRO PZ
1 = TA DENTRO PZ
Não sei se ele tem essa function na lib dele ;s
Experimente colocar isso no arquivo lib/050-function
function getPlayerPz(cid)
return (getTilePzInfo(getCreaturePosition(cid)) == TRUE)
end
Edited Fevereiro 26 by Roksas
info
Group: Infante
Joined: 27/01/13
Posts: 1.7k
Reputation: +104
Gender: Masculino

REP
Edited Fevereiro 26 by SkyDarkyes
info
Group: Príncipe
Joined: 19/08/10
Posts: 4k
Reputation: +1.1k
Gender: Masculino

@rok
se essa eh a funçao entao tu flo errado.. ela retorna true e false e n 0 e 1
e entao era esse o erro do script dele...
info
Group: Artesão
Joined: 28/10/12
Posts: 128
Reputation: +15
Tibia Character: Tidifen

eu ja tinha colokado essa função aki, mais parece q ta errada msm pq testei sem ela e deu serto....e foi mal ae eu me confundi com as pastas dos servers ae tava falando errado malz, se tiver como ajeitar essa função mi ajudem pois preciso dela..
eu colokei == na função e funfou
olha oq eu pensei..
ja q n existe numero a baixo de 0 na script eh por isso q ta dando erro pq ta assim <= intão colokei == mais so q o npc n quer transportar o player :s
e eu acho q o 1 n ta dentro de pz neh n ?
info
Group: Artesão
Joined: 28/10/12
Posts: 128
Reputation: +15
Tibia Character: Tidifen
Bom, eu ligo o server de boa, ae quando falo hi pro npc ele n fala nada e no log do theforgottenserver aparece isso
[Error - Npc Interface]
data/npc/sripts/test.lua:39: attempt to compare boolean with number stack traceback:
data/npc/scripts/test.lua:39: in function <data/npc/scripts/test.lua:36>
Obs: O q tem na linha 36 do script do npc é "function onCreatureSay(cid, type, msg)" <--sem aspas
E na 39: if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 and getPlayerPz(cid) <= 0 then
Quem ajudar leva meu reP+