Ir para conteúdo
Faça parte da equipe! (2024) ×

[Fácil] Fazendo NPC's


PoweR BoLT
 Compartilhar

Merece Fixo ?  

  1. 1. Merece Fixo ?

    • Sim
      0
    • Não
      0


Posts Recomendados

Olaá Galera OTNet !

 

Estou aqui para mostrar como fazer um npc...

 

muito simples.

 

Mão na Massa !

 

Primeiro vá em data/npc e copie qualquer arquivo, cole e renomeie com o nome do seu npc... o meu se chamará Joao... ai eu renomeio como Joao.

 

Abra o arquivo e exclua todo o conteudo e cole isso :

 

<?xml version="1.0"?>

 

<npc name="Joao" script="data/npc/scripts/joao.lua" access="3" lookdir="2" autowalk="25">

<mana now="800" max="800"/>

<health now="200" max="200"/>

<look type="128" head="57" body="32" legs="49" feet="114"/>

</npc>

 

Explicação:

 

O Verde será o nome do seu NPC.

O Vermelho Será a localização do seu NPC.

Por Ultimo e menos importante, o Outfit do NPC.

 

 

Nosso NPC já esta criado agora é so colocar os scripts ! vamos lá ?!

 

Vá em Data/Npc/Scripts, copiei qualquer arquivo, cole e renomeie Joao

(joao é um exemplo como ja disse anteriormente) abra, apague tudo e cole isso:

 

-- Walking --

 

max_x = 1 -- change the max x here. Means the NPC wont walk more to east or west as the number which is set here.

 

max_y = 1 --change the max y here. Means the NPC wont walk more to north or south as the number which is set here.

 

current_x = 0 --do nothing change here

 

current_y = 0 --do nothing change here

 

max_x = max_x - 1 --do nothing change here

 

max_y = max_y - 1 --do nothing change here

 

-- End Walking--

 

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) .. '! I'm selling the VIP Set. My offers are: Divine Armor (14kk), Divine Legs (13kk), Divine Helmet (13kk), Eagle Shield (15kk), Supreme Boots (12kk), Divine Axe (5kk), Divine Sword (5kk), Divine Star (5kk) and Divine Club (5kk).')

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()

 

[red]if msgcontains(msg, 'supreme boots') then

buy(cid,5462,getCount(msg),12000000)

elseif msgcontains(msg, 'divine armor') then

buy(cid,2503,getCount(msg),14000000)

elseif msgcontains(msg, 'divine legs') then

buy(cid,2504,getCount(msg),13000000)

elseif msgcontains(msg, 'divine helmet') then

buy(cid,2342,getCount(msg),13000000)

elseif msgcontains(msg, 'eagle shield') then

buy(cid,2538,getCount(msg),15000000)

elseif msgcontains(msg, 'divine axe') then

buy(cid,2538,getCount(msg),5000000)

elseif msgcontains(msg, 'Divine Star') then

buy(cid,2538,getCount(msg),5000000)

elseif msgcontains(msg, 'divine club') then

buy(cid,2538,getCount(msg),5000000)

elseif msgcontains(msg, 'divine star') then

buy(cid,2538,getCount(msg),5000000)

 

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

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

focus = 0

talk_start = 0

end

end

end

 

 

function onCreatureChangeOutfit(creature)

 

end

 

 

function onThink()

-- Walking --

 

if focus == 0 and max_x >= 0 and max_y >= 0 then

 

cx, cy, cz = selfGetPosition()

 

randmove = math.random(1,20)

 

if randmove == 4 and current_x <= max_x then

 

nx = cx + 1

 

current_x = current_x + 1

 

elseif randmove == 8 and current_x >= (max_x - (max_x * 2)) then

 

nx = cx - 1

 

current_x = current_x - 1

 

elseif randmove == 12 and current_y <= max_y then

 

ny = cy + 1

 

current_y = current_y + 1

 

elseif randmove == 16 and current_y >= (max_y - (max_y * 2)) then

 

ny = cy - 1

 

current_y = current_y - 1

 

elseif randmove <= 20 then

 

nx = cx

 

ny = cy

 

end

 

moveToPosition(nx, ny, cz)

 

end

 

-- End Walking --

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

 

Explicando:

 

é oq o npc vai falar apos voce falar hi para ele

o id dos itens (voce pode colocar dinheiro ao inves dos ID's e colocar os ID's no lugar do dinheiro pro npc poder comprar )

o Preço Dos Itens

Link para o comentário
Compartilhar em outros sites

então cara...

só sei assim...

como diz minha assinatura só sou um mapper...

scripts não é comigo não...

fazer Npc de teleport eu não sei mesmo...

=)

MaLz

Link para o comentário
Compartilhar em outros sites

  • 2 semanas atrás...
Este tópico está impedido de receber novos posts.
 Compartilhar

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...

Informação Importante

Nós fazemos uso de cookies no seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies , caso contrário, vamos supor que você está bem para continuar.