Postado Fevereiro 12, 2013 12 anos Bom, eu estava trabalhando em alguns scripts para um global meu, então vou postando aos poucos alguns NPC's que fiz ao longo do tempo.. e conforme eu for terminando.. OBS: Não cheguei a testar qualquer problema por favor reporte. <?xml version="1.0" encoding="utf-8"?> <npc name="Scrutinon" script="data/npc/scripts/Scrutinon.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100" /> <look type="0" head="0" body="0" legs="0" feet="0" addons="0" /> <voices> <voice text="Some things are not meant to be told, then." interval2="120" margin="1" yell="no" /> </voices> <parameters> <parameter key="message_greet" value="|PLAYERNAME|. I have been watching your fate for quite some time. It's about time you came here. Do you seek to enter the riven island of {Quirefang} or {travel} back from where you came?"/> <parameter key="message_farewell" value="I will see you again."/> </parameters> </npc> LUA: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local ab = {x=,y=,z=} local edron = {x=,y=,z=} local darashia = {x=,y=,z=} local venore = {x=,y=,z=} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end --returns how many msgs he have said already function cancelNPCTalk(events) local ret=1 for aux=1,table.getn(events) do if events[aux].done==FALSE then stopEvent(events[aux].event) else ret=ret+1 end end events=nil return(ret) end function doCreatureSayWithDelay(cid,text,type,delay,e) if delay<=0 then doCreatureSay(cid,text,type) else local func=function(pars) doCreatureSay(pars.cid,pars.text,pars.type) pars.e.done=TRUE end e.done=FALSE e.event=addEvent(func,delay,{cid=cid, text=text, type=type, e=e}) end end function doNPCTalkALot(msgs,interval) local e={} local ret={} if interval==nil then interval=3000 end --3 seconds is default time between messages for aux=1,table.getn(msgs) do e[aux]={} doCreatureSayWithDelay(getNpcCid(),msgs[aux],TALKTYPE_PRIVATE_NP,(aux-1)*interval,e[aux]) table.insert(ret,e[aux]) end return(ret) end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg,'Quirefang') then npcHandler:say("This island is cleft. Go there only prepared or you will meet your end. The surface of this forgotten rock is a barren wasteland full of hostile creatures. ...",cid) npcHandler:say("Its visage is covered with holes and tunnels in which its leggy inhabitants are hiding. Its bowels filled with the strangest creatures, waiting to feast on whatever dares to disturb their hive. ...",cid,3000) npcHandler:say("And you will find no shelter in Quirefang's black depths, where the creatures of the deep are fulfilling a dark prophecy. ...",cid,3000) npcHandler:say("It is impossible to reach it by ship or boat. However, there was one before you. A {visitor} who found a way to enter the island.",cid,3000) elseif msgcontains(msg,'visitor') and getPlayerStorageValue(cid,20039) == -1 then npcHandler:say("He travelled on the very ground to reach the hostile shores of {Quirefang}. He used something that turned the soil and carved a way to the island. ...",cid) npcHandler:say("You will need to follow his trail if you want to reach it.",cid,3000) setPlayerStorageValue(cid,20039,1) else npcHandler:say("He travelled on the very ground to reach the hostile shores of {Quirefang}. He used something that turned the soil and carved a way to the island. ...",cid) npcHandler:say("You will need to follow his trail if you want to reach it.",cid,3000) end elseif msgcontains(msg,'travel') then npcHandler:say("So you want to leave this place? As you may have noticed, most seafarers won't stay here... for long. So, do you want me to send you back to {Ab\'Dendriel}, {Darashia}, {Edron} or {Venore}?",cid) elseif msgcontains(msg,'Ab\'Dendriel') then doTeleportThing(cid, ab) npcHandler:say("I will see you again.",cid) elseif msgcontains(msg,'Darashia') then doTeleportThing(cid, darashia) npcHandler:say("I will see you again.",cid) elseif msgcontains(msg,'Edron') then doTeleportThing(cid, edron) npcHandler:say("I will see you again.",cid) elseif msgcontains(msg,'Venore') then doTeleportThing(cid, venore) npcHandler:say("I will see you again.",cid) end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Fevereiro 12, 2013 12 anos por didito (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.