TH

Npc Que Vende Rings!

Por thedarkhell, 15 de abr. de 2007 em NPCs, monsters e raids

script
10
4.1k
thedarkhellT
15 de abril de 2007 às 14:46

e um npc comum com addon

fiz ele no map dorion 7.9 do xedegux intao eu n testei em outros servidores

ele vendi roh,tr,lr,sr,ar,cr e uns ae q eu achu q eskeci ^^

 

tomara de ajude lah vai

 

<?xml version="1.0"?>

 

<npc name="Senhor Dos Aneis" script="data/npc/scripts/rings.lua" access="3" lookdir="3">

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

<look type="146" head="0" body="40" legs="114" feet="0" corpse="3128"/>

</npc>

 

 

agora o script dele

 

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 (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then

selfSay('Hello ' .. creatureGetName(cid) .. '! I sell life ring (2k), ring of healing (4k), club ring (2k), axe ring (3k), power ring (3k), energy ring (5k), time ring (6k) and sword ring (3k).')

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, 'life ring') then

buy(cid,2168,1,3000)

elseif msgcontains(msg, 'sword ring') then

buy(cid,2207,1,2000)

elseif msgcontains(msg, 'ring of healing') then

buy(cid,2214,1,4000)

elseif msgcontains(msg, 'club ring') then

buy(cid,2209,1,2000)

elseif msgcontains(msg, 'axe ring') then

buy(cid,2208,1,3000)

elseif msgcontains(msg, 'power ring') then

buy(cid,2166,1,3000)

elseif msgcontains(msg, 'energy ring') then

buy(cid,2167,1,5000)

elseif msgcontains(msg, 'time ring') then

buy(cid,2169,1,6000)

 

 

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

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

focus = 0

talk_start = 0

end

end

end

 

 

function onCreatureChangeOutfit(creature)

 

end

 

 

function onThink()

 

if focus > 0 then

x, y, z = creatureGetPosition(focus)

myx, myy, myz = selfGetPosition()

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

selfTurn(0)

end

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

selfTurn(2)

end

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

selfTurn(1)

end

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

selfTurn(3)

end

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

selfTurn(1)

end

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

selfTurn(3)

end

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

selfTurn(2)

end

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

selfTurn(0)

end

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

selfTurn(1)

end

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

selfTurn(3)

end

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

selfTurn(2)

end

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

selfTurn(0)

end

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

selfTurn(1)

end

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

selfTurn(3)

end

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

selfTurn(2)

end

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

selfTurn(0)

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

 

 

TOMARA Q VC USEM NO SERVE DE VCS ^^

2 semanas depois...
BfalcaoB
29 de abril de 2007 às 11:21

Po cara muito util para aqueles ots que nao veem com npc de rings.

Valeu ae

SideboneS
30 de abril de 2007 às 14:31

Rox, mas tipo, como faz pra mudar o valor q vende cada um? e como faz pra vender só axe/sword/club e life ring?

Vlw :laughing:

thedarkhellT
30 de abril de 2007 às 19:08
Rox, mas tipo, como faz pra mudar o valor q vende cada um? e como faz pra vender só axe/sword/club e life ring?

Vlw :laughing:

 

 

e simples

 

if msgcontains(msg, 'life ring') then

buy(cid,2168,1,3000)

elseif msgcontains(msg, 'sword ring') then

buy(cid,2207,1,2000)

elseif msgcontains(msg, 'ring of healing') then

buy(cid,2214,1,4000)

elseif msgcontains(msg, 'club ring') then

buy(cid,2209,1,2000)

elseif msgcontains(msg, 'axe ring') then

buy(cid,2208,1,3000)

elseif msgcontains(msg, 'power ring') then

buy(cid,2166,1,3000)

elseif msgcontains(msg, 'energy ring') then

buy(cid,2167,1,5000)

elseif msgcontains(msg, 'time ring') then

buy(cid,2169,1,6000)

 

aki vc muda td q vc ker o cid n muda ,, o premero numero e o id do item tbm n muda o 1 e a quantidade e o 3 numero e o preçu tipow se vc por 10000 vai ser 10k ser por 1000 vai ser um

 

espero ter ajudado

1 mês depois...
skynagerloasS
24 de maio de 2007 às 21:08

Tópico contendo somente 1 NpC,

essa seção é para DataPacks com 3 ou mais Npcs,

~o{Tópico Movido}o~,

Abraços.

6 meses depois...
jmazzacaroJ
30 de novembro de 2007 às 09:56

cara nao entendi aonde eu boto cada coisa vc pode me explicar me mandando um email para johann_castor@hotmail.com

2 meses depois...
tavaxT
02 de janeiro de 2008 às 14:40

eu estava pensando fazer esse npc mas tinha um perguiça enorme de o fazer XD vlw

4 semanas depois...
amarant_072A
28 de janeiro de 2008 às 14:48

hey vc sabe como q cria um npc de quests , ex: vc da pra ele 100 carlin sword ai vc ganha uma soft boots se vc souber fala cmg

3 meses depois...
TwopacT
02 de abril de 2008 às 17:31

Ty vo ussa ele no ot

:smile_positivo:

2 anos depois...
24 de julho de 2010 às 07:32

eu to com problemas pois o meu nao fala nada =X