Naldo Ghost 0 #1 Postado 17 Abril, 2009 Tipo: Npc . Versão: 8.1 . Criador: Eu . Nome: Ryan ;D ------------------------------- Bem esse npc faz charadas. Se vc acertar ganha um sov e é teleportado para o temple, mas se errar nao ganha nada hshaishaisuhia ;D Bem divertido! :laugh: Então abra a pasta data/npc e crie um arquivo .xml chamado Ryan.xml e cole isso dentro: <npc name="Ryan" script="data/npc/scripts/fire.lua" autowalk="25" floorchange="0" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="90" head="20" body="100" legs="50" feet="99" corpse="2212"/> </npc> Agora abra a pasta data/npc/scripts e crie um arquivo .lua chamado fire.lua e cole isso dentro: local focus = 0local 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) .. '! If you want to leave this place you must tell the moral of this riddle: How defeating an opponent? 1. Throw it. 2. Killing his family. 3. Find their weak point. ') 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, '1') then if pay(cid,0) then selfSay('Sorry!') travel(cid, 703, 600, 7) focus = 0 talk_start = 0 else selfSay('Sorry, you don\'t have enough money.') end elseif msgcontains(msg, '2') then if pay(cid,0) then selfSay('Sorry!') travel(cid, 703, 600, 7) focus = 0 talk_start = 0 else selfSay('Sorry, you don\'t have enough money.') end elseif msgcontains(msg, '3') then if pay(cid,0) then selfSay('Let\'s go!') travel(cid, 652, 598, 8) doPlayerAddItem(cid, 2390, 1) focus = 0 talk_start = 0 else selfSay('Sorry, you don\'t have enough money.') end 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 (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 Pronto ;D Compartilhar este post Link para o post
FakLess 0 #3 Postado 18 Abril, 2009 Sov? e não tem que pagar nada pro Npc? ou é so você ficar acertando a charada e fazendo grana? tchao Compartilhar este post Link para o post