Boa Noite, Xtibianos
Eu gostaria de um npc que só viaja-se se tivese "X" Item tipo eu quero ir para Fire Island ai tenho q ter um Demon Trphy.
Alguem poderia ajudar? ;d
Boa Noite, Xtibianos
Eu gostaria de um npc que só viaja-se se tivese "X" Item tipo eu quero ir para Fire Island ai tenho q ter um Demon Trphy.
Alguem poderia ajudar? ;d
+ Sign by PedrOkas
+ Kakashi Hatake
Copyright © 2011 Viitin, Inc. All rights reserved.[/b]
Este aki e do vodkart entao tudo aos creditos a ele
Abre o arquivo 050-function.lua que está dentro da pasta data/lib e adicione no fim do arquivo:
function doPlayerCountItems(cid, items) -- by Vodka local items = type(items) == "table" and items or {items} for i = 1, table.maxn(items) do if getPlayerItemCount(cid, items[i]) <= 0 then return false end end return true end
NPC Script:
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 local talkState = {} function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local list = {111,222,333,444,555,666,777} -- id dos itens local pos = {x=160, y=54, z=7} -- para onde ele vai if(msgcontains(msg, 'TRAVEL') or msgcontains(msg, 'travel')) then selfSay("Para viajar comigo você ter os 7 items,você tem eles? {yes} ", cid) talkState[talkUser] = 1 elseif(msgcontains(msg, "yes") and talkState[talkUser] >= 1)then if doPlayerCountItems(cid, list) then selfSay("Boa viagem!.", cid) doTeleportThing(cid, pos) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) else selfSay("desculpe,mas você não tem os itens!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("Then not", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Att,
Kissy
Va em npc/scripts e crie um arquivo itemtravel.lua e bote isto dentro:
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local pos = {x=152,y=58,z=7} -------------- Pos para onde o player sera levado local itemid = 2468 ----------------- Id do item que vai ser removido do player 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, "offer") or msgcontains(msg, "help") then selfSay("Eu posso te levar a TAL lugar por um "..getItemNameById(itemid).." item, fale {travel} se quizer viajar.", cid) talkState[cid] = 0 elseif msgcontains(msg, 'travel') then if doPlayerRemoveItem(cid, itemid, 1) then selfSay("Boa viagem.", cid) doTeleportThing(cid, pos) else selfSay("Voce nao tem o item nescessario.", cid) end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Depois crie um arquivo NOMEDONPC.lua e bote isto dentro:
<npc name="NOMEDONPC" script="data/npc/scripts/itemtravel.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="134" head="78" body="88" legs="0" feet="88" addons="3"/> <parameters> <parameter key="message_greet" value="Ola. Para mais informacoes de meus servicos diga {offer}." /> <parameter key="message_farewell" value="Tchau." /> <parameter key="message_walkaway" value="Tchau." /> </parameters> </npc>
NAO SE ESQUEÇA DE CONFIGURAR O LOCAL E O ITEMID NO SCRIPT....
Te Ajudei? Então REP+