Postado Outubro 19, 2017 7 anos Olá,Caros Bom queria um script de npc de barco que em vez de utilizar dinheiro para viajar,utiliza-se um item ( Como se fosse um passe), mas este item não é consumido, se player tiver o Passe(ex: Passe ilha do fogo), Ele pode pegar o barco para ilha do fogo quantas vezes quiser com este passe,sem a necessidade de gastar gold a cada viagem.
Postado Outubro 19, 2017 7 anos Posta o TFS quando for pedir script Life is so meaningless, there is nothing worth a smile So goodbye, I'll miss you sugestões?
Postado Outubro 19, 2017 7 anos Autor 8 minutos atrás, rogaforyn2 disse: Posta o TFS quando for pedir script n sei o meu tfs
Postado Outubro 19, 2017 7 anos Solução Supondo ser a versão correta: Em npcs/scripts, crie um arquivo: ilhadofogo.lua Spoiler local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local npcTopic = {} 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 ilha_do_fogo = {x=1,y=1,z=1} -- posição para onde o player será levado local item = {1111, 1} --id do item, quantidade function creatureSayCallback(cid, type, msg) local msg = string.lower(msg) if not npcHandler:isFocused(cid) then if isInArray({"hi", "hello"}, msg) then npcHandler:addFocus(cid) npcHandler:say("Hi, ".. getPlayerName(cid).."! I can {travel} you to the Fire Island.", cid) npcTopic[cid] = 1 else return false end elseif msgcontains(msg, "travel") and npcTopic[cid] == 1 then npcHandler:say("I need ".. item[2] .. " " .. getItemNameById(item[1])..". Do you have it?", cid) npcTopic[cid] = 2 elseif msgcontains(msg, "yes") and npcTopic[cid] == 2 then if getPlayerItemCount(cid, item[1]) >= item[2] then doTeleportThing(cid, ilha_do_fogo) doSendMagicEffect(ilha_do_fogo, CONST_ME_TELEPORT) npcHandler:say("Beware, young adventurer!", cid) npcTopic[cid] = 0 else npcHandler:say("Sorry but you don't have the item I need.", cid) npcTopic[cid] = 0 end elseif msgcontains(msg, "no") and npcTopic[cid] == 2 then npcHandler:say("Ok, maybe on the next time.", cid) npcTopic[cid] = 0 elseif msgcontains(msg, "bye") then npcHandler:say("Bye.", cid) npcHandler:releaseFocus(cid) else npcHandler:say("What?", cid) npcTopic[cid] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) Um xml para o npc como base, edite como quiser: <?xml version="1.0" encoding="UTF-8"?> <npc name="Traveller" script="ilhadofogo.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="66"/> </npc> Contato: Email: [email protected] Discord: Dwarfer#2715
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.