Ir para conteúdo

Saiba Tudo Sobre Npc,monster E Spells!


Lucas Rap

Posts Recomendados

  • 4 weeks later...

:blink: amigo me ajuda com uma coisa , meu serv eh 8.0

 

e o poison field/ fire field / fire bomb / magic wall

 

estao demorando mt para sair qeria saber detalhadamente como

 

abaixar o tempo de duraçao deles

Link para o comentário
Compartilhar em outros sites

bom tuto...mas o exemplo do npc podia ser mais util...eu pelo menos acho mto ruim um npc q sumona bixo pra vc, daki a poco vai virar pokemon >.<

só p deixar claro, achei o tutorial bom, só naum gostei do exemplo.

tentei fazer um npc pro citizen addon, mas parece q tem um erro...qm puder ajudar eu agradeço...

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('Hello ' .. creatureGetName(cid) .. '! How can i help you?.')

 

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 msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

 

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

 

focus = 0

 

talk_start = 0

 

 

 

elseif focus == cid then

 

talk_start = os.clock()

 

 

 

if msgcontains(msg, 'addons') then

 

if isPremium(cid) then

 

selfSay('Ah, right, almost forgot about the backpack! Have you brought me 80 pieces of minotaur leather as requested?.')

 

talk_state = 0

 

else

 

selfSay('I have nothing for you.')

 

talk_state = 0

 

end

 

end

 

 

 

------------------------------------start addons-------------------------------------------

 

 

 

if msgcontains(msg, 'first addon') then

 

if isPremium(cid) then

 

if haveItem(cid, 5878, 80, 0, 1) == 1 then

 

selfSay('Did you bring me 80 minotaur leathers?')

 

talk_state = 1

 

else

 

selfSay('Alright then, if you bring me 100 pieces of fine minotaur leather I will see what I can do for you. You probably have to kill really many minotaurs though... so good luck!')

 

talk_state = 0

 

end

 

else

 

selfSay('Sorry, you need a premium account to get addons.')

 

talk_state = 0

 

end

 

 

 

elseif msgcontains(msg, 'second addon') then

 

if isPremium(cid) then

 

if haveItem(cid, 5890, 30, 0, 1) == 1 and haveItem(cid, 5902, 50, 0, 1) == 1 and haveItem(cid, 2480, 1, 0, 0) == 1 then

 

selfSay('Did you bring me 30 chicken feathers, 50 honeycombs and 1 legion helmet?')

 

talk_state = 2

 

else

 

selfSay('Okay, here we go, listen closely! I need a few things... a basic hat of course, maybe a legion helmet would do. Then about 30 chicken feathers... and 50 honeycombs as glue. That's it, come back to me once you gathered it!')

 

talk_state = 0

 

end

 

else

 

selfSay('Sorry, you need a premium account to get addons.')

 

talk_state = 0

 

end

 

------------------------------------message confirmation-------------------------------------------

 

 

 

if msgcontains(msg, 'no') then

 

selfSay('Ok than.')

 

talk_state = 0

 

 

 

elseif msgcontains(msg, 'yes') and talk_state == 1 then

 

talk_state = 0

 

if haveItem(cid, 5878, 80, 0, 1) == 1 then

 

xx = doPlayerAddAddon(cid, 1, 1)

 

if xx == 1 or xx == 3 then

 

if doPlayerRemoveItem(cid, 5878, 80) == 1 then

 

selfSay('Just in time! Your backpack is finished. Here you go, I hope you like it.')

 

end

 

else

 

selfSay('Sorry, you already have this addon.')

 

end

 

else

 

selfSay('Sorry, you dont have these items.')

 

end

 

 

 

elseif msgcontains(msg, 'yes') and talk_state == 2 then

 

talk_state = 0

 

if haveItem(cid, 5890, 30, 0, 1) == 1 and haveItem(cid, 5902, 50, 0, 1) == 1 and haveItem(cid, 2480, 1, 0, 0) == 1 then

 

xx = doPlayerAddAddon(cid, 1, 2)

 

if xx == 2 or xx == 3 then

 

if doPlayerRemoveItem(cid, 5890, 30) == 1 and doPlayerRemoveItem(cid, 5902, 50) == 1 and doPlayerRemoveItem(cid, 2480, 1) == 1 then

 

selfSay('Great job! That must have taken a lot of work. Okay, you put it like this... then glue like this... here you are!')

 

end

 

else

 

selfSay('Sorry, you already have this addon.')

 

end

 

else

 

selfSay('Sorry, you dont have these items.')

 

end

 

 

 

function onCreatureChangeOutfit(creature)

 

end

 

 

 

 

 

function onThink()

 

if focus > 0 then

 

x, y, z = creatureGetPosition(focus)

 

myx, myy, myz = selfGetPosition()

 

--npc by Soulblaster and Zorzin--

 

 

 

if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then

 

selfTurn(1)

 

end

 

if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then

 

selfTurn(3)

 

end

 

if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then

 

selfTurn(2)

 

end

 

if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then

 

selfTurn(0)

 

end

 

if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then

 

selfTurn(2)

 

end

 

if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then

 

selfTurn(0)

 

end

 

if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then

 

selfTurn(3)

 

end

 

if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then

 

selfTurn(1)

 

end

 

if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then

 

selfTurn(2)

 

end

 

if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then

 

selfTurn(0)

 

end

 

if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then

 

selfTurn(3)

 

end

 

if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then

 

selfTurn(1)

 

end

 

if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then

 

selfTurn(2)

 

end

 

if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then

 

selfTurn(0)

 

end

 

if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then

 

selfTurn(3)

 

end

 

if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then

 

selfTurn(1)

 

end

 

end

 

 

 

if (os.clock() - talk_start) > 30 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

eu tinha o npc que vendia td os addons, mas tinha alguns dando erro e decidi fazer uns separados...mas ta dando esse erro qdo abre o ot: expected '>' near 's'

alguem sabe pq?

Link para o comentário
Compartilhar em outros sites

Pow cara, Tuto muito bom, mais eu tava precisando de uma ajuda pra editar itens .. ou como criar um tbm .. se vc puder mi explicar alguma coisa .. agradeço desde já ;D

 

abraço

Link para o comentário
Compartilhar em outros sites

  • 1 month later...
  • 1 month later...

Concordo plenamente com os usuarios acima,

esse é um otimo tutorial, no qual se encontra

tudo bem explicado, para novatos como 'eu'

ele será muito util! :bigsmile:

Otimo tutorial Lucas Rap, continue a compartilhar

seus tutors com nosco.

xD

Link para o comentário
Compartilhar em outros sites

  • 2 weeks later...

NOssa veio adorei o topico 1 dos melhores que eu ja vi

Vlww Vai ajudar muito aii quem souber de um bom Mapa que venha com mapa editor me manda pelo msn Vlwwww

alex_nasicimento_9@hotmail.com

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...