TU

Como Configurar Os Seus Npcs

Por Tuco, 15 de dez. de 2005 em Tutoriais de Scripting

15
5.3k
TucoT
15 de dezembro de 2005 às 21:03

Bom... eu percebi q tinha muita gente pedind de como configurar os seus npcs e vou ensinar aki de como configurar alguns tipos de npcs..

Como fazer um npc vender itens diferentes:

focus = 0

talk_start = 0

target = 0

following = false

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 ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) Oq ele vai falar ao npc and getDistanceToCreature(cid) < 3 then

selfSay('Hello ' .. creatureGetName(cid) .. '! I sell ham, meat, carrots, apples, brown breads, brown mushrooms and eggs (everything for 9gps).') Oq o npc irá responder

focus = cid

talk_start = os.clock()

end

if string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 3 then

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

end

if msgcontains(msg, 'brown bread') and focus == cid then

(id do item, quantidade, e quantos gps) buy(cid,3540,1,8)

talk_start = os.clock()

end

if msgcontains(msg, 'ham') and focus == cid then

buy(cid,3520,1,8)Buy é comprar do npc sell é vender para o npc..

talk_start = os.clock()

end

if msgcontains(msg, 'carrot') and focus == cid then

buy(cid,3533,1,8)

talk_start = os.clock()

end

if msgcontains(msg, 'meat') and focus == cid then

buy(cid,3515,1,8)O

talk_start = os.clock()

end

if msgcontains(msg, 'apple') and focus == cid then

buy(cid,3523,1,8)

talk_start = os.clock()

end

if msgcontains(msg, 'brown mushroom') and focus == cid then

buy(cid,3660,1,8)

talk_start = os.clock()

end

if msgcontains(msg, 'egg') and focus == cid then

buy(cid,3544,1,8)

talk_start = os.clock()

end

if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 3 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

Bom espero ter ajudado!

15 de dezembro de 2005 às 22:45

por.ra muito 10 esse tutorial cara se ta de parabens

16 de dezembro de 2005 às 10:57

Aff é tão facil fazer issu -.-,só vc muda lá para o id,quantidade e preço do item.E tbm pode mudar as falas,eu decosbrir tudo issu sozinhu.é mt facil.+ eu ñ to conseguindo sabe como colok os npc em varias posições

TucoT
16 de dezembro de 2005 às 15:27

pra por em varias posiçoes vai na pasta word e via te um arquivo xamado "npc"

dai tu abre com o bloco de notas e vai ta assim por exemplo nu meu OT:

<?xml version="1.0"?>

<npclist>

<npc name="Dark Rodo" x="143" y="38" z="7"/>Nome do npc dai vc vai no seu map editor e ve as cordenadas do lugaar desejado e bota ali em x y z e pronto!

<npc name="Seller" x="163" y="55" z="6"/>

<npc name="Mad" x="134" y="38" z="7"/>

<npc name="Obi" x="164" y="55" z="5"/>

<npc name="Dark Rodo" x="176" y="157" z="6"/>

<npc name="Seller" x="164" y="157" z="6"/>

<npc name="Lector" x="163" y="162" z="7"/>

<npc name="Perac" x="163" y="143" z="7"/>

<npc name="Mad" x="163" y="147" z="7"/>

<npc name="Guild Master" x="163" y="167" z="7"/>

<npc name="Guild Master" x="139" y="55" z="5"/>

<npc name="Lector" x="126" y="38" z="7"/>

<npc name="Perac" x="145" y="40" z="6"/>

<npc name="Dufi" x="158" y="52" z="7"/>

</npclist><?xml version="1.0"?>

<npclist>

CalmoC
20 de dezembro de 2005 às 10:08

KARA VLW MESMO MUITO BOM OTIMO ESSE TUTO VLW MESMO!!!

efewE
20 de dezembro de 2005 às 10:43

****Victor****-

tem gente que não sabe, ninguém nasce sabendo, você conseguiu porque fico fusando, tem gente que não sabe onde fusa, eu mesmo não sabia fazer uma coisa boba, que era fazê account, isso foi como comecei com otserv, agora já sei quase tudo.

Grato

2 semanas depois...
28 de dezembro de 2005 às 11:32

tpw e pra fazer um npc q so fala (serimona) ex. um padre oq agente tem q fazer???

1 mês depois...
TucoT
04 de janeiro de 2006 às 22:56

inves de por sell etc.. poe só uma fala

2 meses depois...
TozzyT
24 de março de 2006 às 19:31

na verdade....EU NÃO ENTENDI NADA...XDDDDDDDD

so noobão...tenham dó de min....

2 anos depois...
MarioPortoM
28 de julho de 2008 às 06:58

ótimo tutorial Tuco,ta de parabens,com certeza vai ajudar os iniciantes em OT :great:

1 mês depois...
BrunoB
08 de agosto de 2008 às 22:24

existe tópico assim na seção!

10 de agosto de 2008 às 01:09

Cara organiza melhor isso

 

Tá ilegivel.

2 semanas depois...
rogerlpR
22 de agosto de 2008 às 00:49

Muito bom esse tutorial! estás de parabéns

salvatoreS
23 de agosto de 2008 às 11:16

poderia ficar mais organizado e melhor explicado, mas vlw

SharingamaS
29 de agosto de 2008 às 18:28

Tutorial está bom, porém está um pouco dificil de enender =/ e falta mais organização. Tirando isso ta

muito bom.

 

Abraços,

Vinicious (aaaaaaaaaa...)