Ola, (só faltava eu postar um NPC meu mesmu) xD
Agora vou postar uma "compilação" e um NPC feito por mim e uma action tbm feita por mim =P
Em que consiste a Blind Man Quest?
A Blind Man Quest consiste em uma quest em que voce fala com um homem cego que esta dentro de uma cave (ou otro lugar qualquer), depois voce pede ajuda pra ele e ele vai te pedir umas 3 coisas em trocas (money, 1 bread e holy scarab), depois de voce dar as 3 coisas voce podera controlar ele, (se vc naum tiver tudo pra dar pra ele na hora, vc podi dar uma coisa de cada vez) vc só vai poder controlar ele até vc passar u teleport, dps de passar u teleport ele ja naum te ajuda mais.
Qual teleport?
Teleport são 3 tiles no chão, 2 para 2 players e um para o NPC, voce tem que CONTROLAR o NPC até o tile dele.
Como controlar o NPC?
Primeiro negocie com ele e diz pra ele up (cima), down (baixo), left (esquerda) e right (direita) e ele se movimentaram, mas lembrando que ele é cego e pode tropeçar muitas vezes (complicando as coisas) e se voce ficar muito tempo sem falar com ele, ele vai voltar para o inicio.
comeceremos pelo npc
1º na pasta data/npc/scripts crie um arquivo com nome blind.lua e adicione o seguinte dentro dele:
----------Blind Man Quest by Colex-------------focus = 0talk_start = 0target = 0following = falseattacking = falseox = 540 ----posição X dele oy = 518 ----posição Y deleoz = 7 ----posição Z delemax = 500 dealing = 0money = 100 ---Dinheiro necessario para pagar pro blind manfunction onThingMove(creature, thing, oldpos, oldstackpos)endfunction onCreatureAppear(creature)endfunction onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') focus = 0 talk_start = 0 endendfunction onCreatureTurn(creature)endfunction msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))endfunction onCreatureSay(cid, type, msg) msg = string.lower(msg) if (msgcontains(msg, 'hi') or msgcontains(msg, 'hello')) and (focus == 0) and getDistanceToCreature(cid) < 6 and getPlayerStorageValue(cid,1430) < 3 then selfSay('Hello foreigner, i have some secrets of this room my friend.') focus = cid talk_start = os.clock() elseif (msgcontains(msg, 'hi') or msgcontains(msg, 'hello')) and (focus == 0) and getDistanceToCreature(cid) < 6 and getPlayerStorageValue(cid,1430) >= 3 then selfSay('Go away dude, I have already helped you.') focus = 0 elseif (msgcontains(msg, 'hi') or msgcontains(msg, 'hello')) and (focus ~= cid) and getDistanceToCreature(cid) < 6 then selfSay('So you are not alone!') elseif (msgcontains(msg, 'secret') or msgcontains(msg, 'secrets')) and (focus == cid) and getDistanceToCreature(cid) < 6 then selfSay('WEll well well, so the outsider want to know my secrets, Ok! In this room you can find a quest,but you only can do it with my help, because i have the key.') talk_start = os.clock() elseif (msgcontains(msg, 'quest') or msgcontains(msg, 'help') or msgcontains(msg, 'mission')) and (focus == cid) and getDistanceToCreature(cid) < 6 then if getPlayerStorageValue(cid,1430) == 2 then selfSay('I\'m already on your comand, say up, down, left, right to movement me!') talk_start = os.clock() dealing = 0 elseif getPlayerStorageValue(cid,1430) < 2 then selfSay('I help you, but first you have to give me a bread beacause im hungry, pay me ' .. money .. ' gps because i need to live and give me a holy scarab beacause we need it to make the quest, Deal?') talk_start = os.clock() dealing = 1 end elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sure')) and (focus == cid) and getPlayerStorageValue(cid,1430) < 2 and dealing == 1 then talk_start = os.clock() if getPlayerStorageValue(cid,1430) == -1 then if pay(cid,money) then selfSay('Now give me the bread') setPlayerStorageValue(cid,1430,0) else selfSay('Are you kiding me? Give me the money.') end elseif getPlayerStorageValue(cid,1430) > 2 then selfSay('You have already paid me, now give me the rest, bread and holy scarab.') elseif getPlayerStorageValue(cid,1430) == 2 then selfSay('I am already on your command!') end elseif getPlayerStorageValue(cid,1430) == 0 and msgcontains(msg, 'bread') and (focus == cid) then if doPlayerRemoveItem(cid,2689) > -1 then selfSay('Hummm, Oh My God, so gooood, thanks, now i want the holy scarab.') setPlayerStorageValue(cid,1430,1) else selfSay('Stop your jokes and give me the bread, im fuckin hungry!') end elseif getPlayerStorageValue(cid,1430) == 1 and msgcontains(msg, 'holy scarab') and (focus == cid) then if doPlayerRemoveItem(cid,2140) > -1 then selfSay('Right, now we can make the quest, say: up, down, right, left, so i can walk beacause i am blind.') setPlayerStorageValue(cid,1430,2) else selfSay('I WANT THE HOLY SCARAB!!!!') end elseif msgcontains(msg, 'no') and (focus == cid) then selfSay('Ok outsider, I wish you know what you are doing!') talk_start = os.clock() end if getPlayerStorageValue(cid,1430) == 2 and (focus == cid) then if msgcontains(msg, 'right') then selfMove(1) moveQuest(ox, oy, max) talk_start = os.clock() elseif msgcontains(msg, 'up') then selfMove(2) moveQuest(ox, oy, max) talk_start = os.clock() elseif msgcontains(msg, 'left') then selfMove(3) moveQuest(ox, oy, max) talk_start = os.clock() elseif msgcontains(msg, 'down') then selfMove(0) moveQuest(ox, oy, max) talk_start = os.clock() end end if (msgcontains(msg, 'bye') or msgcontains(msg, 'good bye')) and (focus == cid) and getDistanceToCreature(cid) < 6 then selfSay('Good bye outsider!') focus = 0 talk_start = 0 dealing = 0 endendfunction onCreatureChangeOutfit(creature)endfunction onThink() if focus <= 0 then moveToPosition(ox, oy, oz) end if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Holy ######, that foreigner left me alone.') dealing = 0 end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 6 then selfSay('Where are you, i can\'t hear your voice.') focus = 0 dealing = 0 end endend
2º agora na pasta data/npc/scripts/lib abre o arquivo npc.lua e adiciona as seguintes linhas:
function moveQuest(ox,oy,max)maxx = ox + maxmaxy = oy + maxminx = ox - maxminy = oy - maxcx, cy, cz = selfGetPosition()randmove = math.random(1,6)falas = math.random(1,7)if randmove == 1 thennx = cx + 1ny = cyendif randmove == 2 thennx = cx - 1ny = cyendif randmove == 3 thenny = cy + 1nx = cxendif randmove == 4 thenny = cy - 1nx = cxendif randmove >= 5 thennx = cxny = cyendif((nx < maxx) and (ny < maxy) and (nx > minx) and (ny > miny)) thenmoveToPosition(nx, ny, cz) if (nx ~= cx) or (ny ~= cy) then if falas == 1 then selfSay('Ouch') elseif falas == 2 then selfSay('Holy ######, My Feet, fuckin stone!!!') elseif falas == 3 then selfSay('Hey, Where are you, say something.') elseif falas == 4 then selfSay('Shit, I think i\'m lost.') elseif falas == 5 then selfSay('Wow, with this luck i\'ll fall.') elseif falas == 6 or falas == 7 then return 1 end endelsemoveToPosition(ox, oy, cz)endend
3º e último passo na parte do NPC, na pasta data/npc cria um arquivo nomeado por Blind Man.xml e dentro dele adicione:
<?xml version="1.0"?><npc name="Blind Man" script="data/npc/scripts/blind.lua" access="3"> <look type="129" head="114" body="119" legs="114" feet="114"/></npc>
Agora vamos para as Actions
1º faça um novo documento com nome blind.lua na pasta data/actions/scripts e adicione o seguinte code:
-----Blind Man Quest by colex-----function onUse(cid, item, frompos, item2, topos)pos1 = {x=546, y=518, z=7, stackpos=253} --coordenadas de onde o player 1 te ke ficarplayer1 = getThingfromPos(pos1)pos2 = {x=546, y=520, z=7, stackpos=253} --cordenadas de onde o player 2 tem ke ficarplayer2 = getThingfromPos(pos2)npcpos = {x=551, y=518, z=7, stackpos=253} --cordenadas de onde o npc tem que ficarnpc = getThingfromPos(npcpos) final1 = {x=548, y=520, z=7} ----para onde sera teleportado o player 1final2 = {x=548, y=521, z=7} ----para onde sera teleportado o player 2 if item.itemid == 1945 and item.uid == 5996 then if player1.itemid == cid then if player2.itemid == cid then if getPlayerStorageValue(player2.uid,1430) <= 2 and getPlayerStorageValue(player1.uid,1430) <= 2 then if npc.itemid == cid then if getPlayerAccess(npc.uid) >= 0 then doPlayerSendCancel(cid,"That person does not have the key.") else doTeleportThing(player1.uid,final1) doTeleportThing(player2.uid,final2) doPlayerSendTextMessage(player1.uid,22,"You were teleported with the help of Blind Man.") doPlayerSendTextMessage(player2.uid,22,"You were teleported with the help of Blind Man.") doTransformItem(item.uid,item.itemid+1) setPlayerStorageValue(player1.uid,1430,3) setPlayerStorageValue(player2.uid,1430,3) end else doPlayerSendCancel(cid,"You are missing one person.") end else doPlayerSendCancel(cid,"One or both of you have already made the quest, so he cannot continue.") end else doPlayerSendCancel(cid,"You are missing one person.") end else doPlayerSendCancel(cid,"You are not in the right place.") endelseif item.itemid == 1946 and item.uid == 5996 thendoTransformItem(item.uid,item.itemid-1)endreturn 1end
2º na pasta data/actions no arquivo actions.xml adicione a seguinte tag:
<action uniqueid="5996" script="blind.lua" />
Imagem Para Um Melhor Entendimento
Alguma Duvida?
Algum Comentario bom, mau, péssimo?
Críticas construtivas?
Clique no botão que se encontra no canto inferior direito Responder
e escreva algo do genero "és o maior, tens prai 5 metros!"
=P
va flw
postem u ke kiserem, com criticas construtivas, to aceitando tudo xD
aproveitem...
cya~~