Ir para conteúdo

Posts Recomendados

Opa gente esse eh meu primeiro post e eu to com 1 problema nu meu npc

 

A sweaty cyclops...

 

tipo ele funfa normalzinho, mais qnd algm n diz bye pra ele, ele buga e ngm mais consegue falar com ele, dae eu tenhu q kikar meu OT

 

esse eh o script dele:

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('Good bye then.')

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('Olá ' .. creatureGetName(cid) .. '! Eu sou um ferreiro .. Tem algo para mim??')

focus = cid

talk_start = os.clock()

 

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

selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

 

elseif focus == cid then

talk_start = os.clock()

 

if msgcontains(msg, 'crown armor') or msgcontains(msg,'piece of royal steel') then

selfSay('Você quer trocar a Crown Armor pela Piece of royal steel ?')

talk_state = 1

 

elseif msgcontains(msg, 'boh') or msgcontains(msg,'enchanted chicken wings') then

selfSay('Você quer trocar a Boh pela Enchanted chicken wings ??')

talk_state = 2

 

elseif msgcontains(msg, 'fighting spirit') or msgcontains(msg, 'royal helmet') then

selfSay('Você quer trocar 2 Royal Helmet por Fighting spirit ??')

talk_state = 3

elseif msgcontains(msg, 'warriors sweat') or msgcontains(msg,'warrior helmet') then

selfSay('Você quer trocar 4 warrior helmet por warriors sweat ??')

talk_state = 4

elseif msgcontains(msg, 'spool of yarn') or msgcontains(msg,'giant spider silk') then

selfSay('Você quer trocar 10 giant spider silk por Spool of yarn ??')

talk_state = 5

elseif msgcontains(msg, 'crude iron') or msgcontains(msg,'giant sword') then

selfSay('Você quer trocar uma giant sword por um crude iron ??')

talk_state = 6

elseif msgcontains(msg, 'devil helmet') or msgcontains(msg,'piece of hell steel') then

selfSay('Você quer trocar um devil helmet por um piece of hell steel ??')

talk_state = 7

elseif msgcontains(msg, 'dragon shield') or msgcontains(msg,'piece of draconian steel') then

selfSay('Você quer trocar um dragon shield por um piece of draconian steel ??')

talk_state = 8

 

 

elseif talk_state == 1 then

if msgcontains(msg, 'yes') then

itemstatus = doPlayerRemoveItem(cid,2487,1)

if itemstatus == 0 then

selfSay('Sorry, you not have items.')

else

doPlayerAddItem(cid,5887,1)

selfSay('Obrigado !!')

end

end

talk_state = 0

 

elseif talk_state == 2 then

if msgcontains(msg, 'yes') then

itemstatus = doPlayerRemoveItem(cid,2195,1)

if itemstatus == 0 then

selfSay('Sorry, you not have items.')

else

doPlayerAddItem(cid,5891,1)

selfSay('Thanks for items.')

end

end

talk_state = 0

 

elseif talk_state == 3 then

if msgcontains(msg, 'yes') then

itemstatus = doPlayerRemoveItem(cid,2498,2)

if itemstatus == 0 then

selfSay('Sorry, you not have items.')

else

doPlayerAddItem(cid,5884,1)

selfSay('Thanks for items.')

end

end

talk_state = 0

elseif talk_state == 4 then

if msgcontains(msg, 'yes') then

itemstatus = doPlayerRemoveItem(cid,2475,4)

if itemstatus == 0 then

selfSay('Sorry, you not have items.')

else

doPlayerAddItem(cid,5885,1)

selfSay('Thanks for items.')

end

end

talk_state = 0

elseif talk_state == 5 then

if msgcontains(msg, 'yes') then

itemstatus = doPlayerRemoveItem(cid,5879,10)

if itemstatus == 0 then

selfSay('Sorry, you not have items.')

else

doPlayerAddItem(cid,5886,1)

selfSay('Thanks for items.')

end

end

talk_state = 0

elseif talk_state == 6 then

if msgcontains(msg, 'yes') then

itemstatus = doPlayerRemoveItem(cid,2393,1)

if itemstatus == 0 then

selfSay('Sorry, you not have items.')

else

doPlayerAddItem(cid,5892,1)

selfSay('Thanks for items.')

end

end

talk_state = 0

 

elseif talk_state == 7 then

if msgcontains(msg, 'yes') then

itemstatus = doPlayerRemoveItem(cid,2462,1)

if itemstatus == 0 then

selfSay('Sorry, you not have items.')

else

doPlayerAddItem(cid,5888,1)

selfSay('Thanks for items.')

end

end

talk_state = 0

elseif talk_state == 8 then

if msgcontains(msg, 'yes') then

itemstatus = doPlayerRemoveItem(cid,2516,1)

if itemstatus == 0 then

selfSay('Sorry, you not have items.')

else

doPlayerAddItem(cid,5889,1)

selfSay('Thanks for items.')

end

end

 

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

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

focus = 0

talk_start = 0

end

end

function onCreatureChangeOutfit(creature)

 

end

function onThink()

 

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

if focus > 0 then

selfSay('Next Please...')

end

focus = 0

end

end

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

 

Ou seja o problema eh ele dar o "Proximo por favor..." qnd o kara jah tah a uns 5 sqm do npc por exemplo...

E eu n tenhu a menor ideia de como fazer isso :p

Por favor me ajudem... to precisanu mto

 

 

vlw ;D

Link para o comentário
https://xtibia.com/forum/topic/93474-pedido-de-npc-a-sweaty-cyclops/
Compartilhar em outros sites

×
×
  • Criar Novo...