Oi ! só testei na minha versao 7.81 do narutibia ><
Esse é o meu primeiro script que eu consegui fazer !
e estou desponibilizando aqui *-*
Ele tem a função de teleportar um jogador para outro lugar.
Agr vc pode fechar suas city sem problemas !
1. Vai para a pasta data/npc ai vc cria um arquivo xml na pasta npc e Reomeia pro nome que vc quiser .
Adicione isso no xml
-Fica mais ou menos assim-
<?xml version="1.0"?> <npc name="Erza" script="data/npc/scripts/Erza.lua" access="5" lookdir="3"> <mana now="800" max="800"/> <health now="200" max="200"/> <look type="56" head="2" body="95" legs="60" feet="132"/> </npc>
Entendendo:]
Npc Name: Nome que vai aparecer no seu jogo quando vc sumonar ele
script="data/npc/scripts/Erza.lua: voce precisa mudar o nome erza pro arquivo lua que vc vai criar ainda. deixe pra dps
look type="56" : aqui é o numero da outfit que o npc vai usar , se quiser mudar só muda os numeros e mas nada
2. Agora que vc ja fez o xml , vamos dar sentido a ele , vai na pasta data/npc/scripts/ ela esta dentro da da pasta "npc" msm.
E crie um arquivo .lua (ctrl c - ctrl v) e coloca um nome e dps vc coloca la no .xml
script="data/npc/scripts/Nomedoseulua.lua" é só mudar aquela parte do nomedoseulua.lua" e colocar o que vc criou na pasta script no lua. voltando ao assunto apague tudo e coloca isso dentro do lua.
ffocus = 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)) and getDistanceToCreature(cid) < 4 then if getPlayerStorageValue(cid,853) < 1 then selfSay('Oi ' .. creatureGetName(cid) .. '-chan. Você quer ir se aventurar na Vila da Folha!? ') focus = cid talk_start = os.clock() else selfSay('Hey! Leave out of there! You are a renegade ninja!') focus = 0 talk_start = 0 end elseif string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Ei ' .. creatureGetName(cid) .. '-chan. Um minuto.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'yes') and focus == cid then Travel(cid, 0, 387, 114, 7) end if msgcontains(msg, 'brown bread') and focus == cid then buy(cid,2691,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 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 focus == 0 then randmove = math.random(1,50) if randmove == 1 then selfMove(0) end if randmove == 2 then selfMove(1) end if randmove == 3 then selfMove(2) end if randmove == 4 then selfMove(3) 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) > 3 then selfSay('Good bye then.') focus = 0 end end end end
você pode mudar a parte da travel para a codernada que vc quiser e a fala que ele ira diser quando a pessoa dizer "hi"
nao sei se fazer npc é script deculpa
se funcionou vc me diz.