Ir para conteúdo

Pesquisar na Comunidade

Mostrando resultados para as tags ''iunix. tesao''.



Mais opções de pesquisa

  • Pesquisar por Tags

    Digite tags separadas por vírgulas
  • Pesquisar por Autor

Tipo de Conteúdo


Fóruns

  • A Cidade OTBR
    • OTServ Brasil
    • Atendimento
    • Taverna
  • Projetos Open Source
    • Canary
    • OTServBR-Global
    • Mehah OTClient
    • MyAAC
  • OpenTibia
    • Notícias e Discussões
    • Suporte - Dúvidas, Bugs, Erros
    • Downloads
    • Tutoriais
    • Show-Off
  • Outros
    • Design

Encontrado 1 registro

  1. NPC Treinador

    Script: NPC Treinador Autor: iuniX Ideia: Dreus_Exozol (Obrigadão brother) Testado em: TFS 0.4 Explicações: Bom, ele é um NPC que upa o teu char para você. Porem tem um certo custo e demora um certo tempo em que você não pode entrar no char. Scripts: Crie um arquivo chamado treiner.xml na pasta NPCS e coloque isso dentro: <?xml version="1.0" encoding="UTF-8"?> <npc name="iuniX, The Trainer" script="trainer.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="268" head="114" body="114" legs="114" feet="114" addons="3"/> </npc> Agora vá na pasta npc/scripts e crie um arquivo chamado trainer.lua e coloque isso daqui dentro: local price2 = 100000 -- Preço por hora local tipo_de_tempo = 3600 --[[ O tempo é dividido em: 3600 = horas 60 = minutos 1 = segundos 0 = instantaneo ]] local focuses = {} local function isFocused(cid) for i, v in pairs(focuses) do if(v == cid) then return true end end return false end local function addFocus(cid) if(not isFocused(cid)) then table.insert(focuses, cid) end end local function removeFocus(cid) for i, v in pairs(focuses) do if(v == cid) then table.remove(focuses, i) break end end end local function lookAtFocus() for i, v in pairs(focuses) do if(isPlayer(v)) then doNpcSetCreatureFocus(v) return end end doNpcSetCreatureFocus(0) end function onCreatureAppear(cid) end function doTrainPlayer (cid, time) setPlayerStorageValue(cid, 1338, os.time() + (time * tipo_de_tempo)) setPlayerStorageValue(cid, 1339, time) doRemoveCreature(cid) end function onCreatureDisappear(cid) if(isFocused(cid)) then selfSay("Hmph!") removeFocus(cid) if(isPlayer(cid)) then closeShopWindow(cid) end end end function onCreatureSay(cid, type, msg) if((msg == "hi") and not (isFocused(cid))) then selfSay("Welcome, ".. getCreatureName(cid) ..".", cid, true) selfSay("Do you want {train}?", cid) addFocus(cid) elseif((isFocused(cid)) and (msg == "train")) then selfSay("I can train you in one hour, maybe do you up some levels.", cid) selfSay("How long time do you want train? say: {10 hours}. Or say {price} to see my prices.", cid) talkstatus = 1 elseif isFocused(cid) and (talstatus == 1 ) and (msg == "price") then doPlayerPopupFYI(cid, price2 .. " gps - hour") elseif isFocused(cid) and (talkstatus == 1) then time = string.match(msg, "(.+) hours") selfSay("Do you want start the treining?. You must pay " .. price2 .." gold coins.", cid) talkstatus = 2 elseif isFocused(cid) and (msg == "yes") and (talkstatus == 2) then if time then if doPlayerRemoveMoney(cid, time * price2) then doTrainPlayer(cid, time) else selfSay("Sorry, but u don't have money. Say {price} to see my prices.", cid) end end elseif isFocused(cid) and (msg == "price") then doPlayerPopupFYI(cid, price2 .. " gps - hour") elseif((isFocused(cid)) and (msg == "bye")) then selfSay("Goodbye!", cid, true) removeFocus(cid) end end function onPlayerCloseChannel(cid) if(isFocused(cid)) then selfSay("Madafaquer!") removeFocus(cid) end end function onPlayerEndTrade(cid) selfSay("It was a pleasure doing business with you.", cid) end function onThink() for i, focus in pairs(focuses) do if(not isCreature(focus)) then removeFocus(focus) else local distance = getDistanceTo(focus) or -1 if((distance > 4) or (distance == -1)) then selfSay("Madafaquer!") removeFocus(cid) end end end lookAtFocus() end Agora vá em creaturescripts e abra o creaturescripts.xml e adicione isso: <event type="login" name="Trainer" event="script" value="trainer.lua"/> E vá na pasta creaturescripts/scripts e crie um arquivo chamado trainer.lua e coloque isso daqui dentro: local exp = 100000 function onLogin(cid) local time = getPlayerStorageValue(cid, 1339) if time > 0 then if getPlayerStorageValue(cid, 1338) > os.time() then doPlayerPopupFYI(cid, "You are training, please let your treiner finish.") addEvent(doRemoveThing, 500, cid) else setPlayerStorageValue(cid, 1338,-1) setPlayerStorageValue(cid, 1339, -1) doPlayerAddExp(cid, exp * time) doPlayerPopupFYI(cid, "Thanks for training with us.") end end return true end Configuração: NPC: local price2 = 100000 -- Preço por hora local tipo_de_tempo = 3600 --[[ O tempo é dividido em: 3600 = horas 60 = minutos 1 = segundos 0 = instantaneo ]] Onde estiver price2 você coloca o preço que será cobrado por tempo. Onde estiver tipo_de_tempo você coloca o tipo de tempo: Minutos, segundos, horas ou até instantaneamente. Creaturescripts: local exp = 100000 Aqui você deve colocar a quantidade de experiencia que ele irá ganhar por tempo. Agradecimentos: Obrigado ao Mock pela ajuda com o maldito os.time e ao Dreus_Exozol pela ideia
×