Ir para conteúdo

Wise

Membro
  • Registro em

  • Última visita

Tudo que Wise postou

  1. Wise postou uma resposta no tópico em Suporte Tibia OTServer
    Começar um tempo na position? Você quer dizer, uma contagem com textos animados? Qual a lógica dessa quest? O player vai ficar lá até acabar o tempo e ser teleportado, mas como ele sai de lá se matar os montros antes do tempo acabar? O que ele ganha com isso? Só pra entender melhor seu pedido..que por enquanto não tem lógica pra mim.
  2. Você quer dizer..para que precise de premium account pra usar a talkaction? local price = 5 function onSay(cid, words, param, channel) if getTilePzInfo(getThingPos(cid)) then if isPlayerPzLocked(cid) then if isPremium(cid) then if doPlayerRemoveMoney(cid, price * 10000) then doRemoveCondition(cid, CONDITION_INFIGHT) else doPlayerSendCancel(cid, "You need "..price.." gold bars to remove your battle.") end else doPlayerSendCancel(cid, "You need premium account to use this command.") end else doPlayerSendCancel(cid, "You are not in battle.") end else doPlayerSendCancel(cid, "You can only remove your battle in a protection zone.") end return true end
  3. Wise postou uma resposta no tópico em Suporte Tibia OTServer
    Simplifique, use a função getCreaturePosition(cid) dentro dos parâmetros da outra função. Ela já retorna os valores de x, y, z da posição do uid, evitando códigos desnecessários.. Estou sem tempo, quando der eu refaço o script e edito aqui.
  4. Bom, pra quem ainda estiver com esse mesmo problema do script citado no tópico: eu respondi aqui.
  5. Simplifiquei o seu script, optando pelo uso de parâmetros: Ex: !buy mp Usando o parâmetro "mp" (sendo as siglas de mana potion), o player irá comprar 100 mana potions pelo custo de 5000 gold coins. Basta configurar na tabela do script (já ajustei conforme o seu estava). buypotions.lua (data/talkactions/scripts): local tab = { ["mp"] = {potion = {7620, 100}, cost = 5000}, -- ["siglas da poção"] = {potion = {itemID da poção, quantidade}, cost = custo pelas poções}, ["gmp"] = {potion = {7590, 100}, cost = 12000}, ["ghp"] = {potion = {7591, 100}, cost = 19000}, ["gsp"] = {potion = {8472, 100}, cost = 19000}, ["hp"] = {potion = {7618, 100}, cost = 4500}, ["shp"] = {potion = {7588, 100}, cost = 10000}, ["smp"] = {potion = {7589, 100}, cost = 8000}, ["uhp"] = {potion = {8473, 100}, cost = 31000} } function onSay(cid, words, param, channel) local sparam = string.lower(param) if param == "" then doPlayerSendCancel(cid, "Enter the acronym of the potion you want to buy.") end if not tab[sparam] then doPlayerSendCancel(cid, "Potion not found.") end if not isPlayerPzLocked(cid) then if doPlayerRemoveMoney(cid, tab[sparam].cost) then doPlayerAddItem(cid, tab[sparam].potion[1], tab[sparam].potion[2]) doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_BLUE) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You bought "..tab[sparam].potion[2].." "..getItemNameById(tab[sparam].potion[1]).."s.") else doPlayerSendCancel(cid, "You need "..tab[sparam].cost.." gold coins to buy these potions.") end else doPlayerSendCancel(cid, "You can only buy potions if you are out of battle.") end return true end A tag ficará então como sendo: talkactions.xml (data/talkactions): <talkaction words="!buy" script="buypotions.lua"/>
  6. Wise postou uma resposta no tópico em Suporte Tibia OTServer
    O aumento de velocidade e magic level, você pode editar em items.xml, aplicando as seguintes linhas no código referente ao item em questão: <attribute key="speed" value="30" /> <attribute key="magiclevelpoints" value="30" /> <attribute key="showattributes" value="1" /> Script do buff ao equipar o item: itembuff.lua (data/movements/scripts): local effect = {55, 1000} -- {effectNumber, delay em milissegundos} function buffEffect(cid, delay, effect) doSendMagicEffect(getThingPos(cid), effect) addEvent(buffEffect, delay, cid, effect, delay) end function onEquip(cid, item, slot) return buffEffect(cid, effect[2], effect[1]) end Tag - movements.xml (data/movements): <movevent type="Equip" itemid="ITEMID" slot="VALUE" event="script" value="itembuff.lua"/> Basta configurar a tag com o ITEMID e o VALUE do slot, que varia de acordo com o item (onde ele pode ser equipado). Aqui estão os valores, caso você não saiba como configurar: Values: head necklace backpack armor right-hand, left-hand two-handed, hand/shield legs feet ring ammo
  7. Pra quê essa talkaction se agora a sua protection zone já remove o battle automaticamente? E o outro membro disse que testou o meu script anterior e deu certo.
  8. battleonpz.lua (data/creaturescripts/scripts): function onThink(cid) if getTilePzInfo(getThingPos(cid)) then doRemoveCondition(cid, CONDITION_INFIGHT) end return true end Adicione o registro do creature event em login.lua (data/creaturescripts/scripts): registerCreatureEvent(cid, "BattleOnPz") Tag - creaturescripts.xml (data/creaturescripts): <event type="think" name="BattleOnPz" event="script" value="battleonpz.lua"/>
  9. Certo, mas qual a necessidade de checar uma storage? Essa storage faz parte de algum outro script do seu servidor? (pra quê essa verificação, só pra entender a lógica do seu pedido). function onEquip(cid, item, slot) local maxcount = 1 if getPlayerSlotItem(cid, slot).type > maxcount then doPlayerSendCancel(cid, "You can't equip more than "..maxcount.." "..getItemNameById(item.itemid).." at the same time.") return false end return true end
  10. Ué, não vejo erros na formulação do script. Por acaso a protection zone do seu servidor já não remove o battle do player automaticamente e você não percebeu? De qualquer forma, tente com essa estrutura: local price = 5 -- quantidade em crystal coins (gold bars, no caso) function onSay(cid, words, param, channel) if not getTilePzInfo(getThingPos(cid)) then return doPlayerSendCancel(cid, "You can only remove your battle in a protection zone.") end if not isPlayerPzLocked(cid) then return doPlayerSendCancel(cid, "You are not in battle.") end if not doPlayerRemoveMoney(cid, price * 10000) then return doPlayerSendCancel(cid, "You need "..price.." gold bars to remove your battle.") end doRemoveCondition(cid, CONDITION_INFIGHT) doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED) return true end E você não prefere que a protection zone remova automaticamente o battle do player assim que ele fique sobre ela? Posso fazer o script, se preferir.
  11. Vou ver, depois edito aqui.
  12. Ops, acabei me esquecendo de aplicar a função pra essa parte. Obrigado por adicionar, Nogard. Só um detalhe: Não precisa adicionar outra função de remoção do dinheiro, já que a própria checagem já remove (retornando true, caso tenha). Já editei o meu script. Adicione os códigos ao arquivo xml do npc: <npc name="Teleporter Man" script="data/npc/scripts/teleporterman.lua" walkinterval="0" floorchange="0"> <health now="150" max="150"/> <look typeex="1448"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. I can {teleport} you to an area." /> </parameters> </npc> Substitua o ID 1448 em look typeex pelo ID do item que você deseja (no caso, 1448, é a estátua do Oracle).
  13. Ops, falha minha. Confundi o que li e fiz errado. Agora deve dar: local price = 5 -- quantidade em crystal coins (gold bars, no caso) function onSay(cid, words, param, channel) if getTilePzInfo(getThingPos(cid)) then if isPlayerPzLocked(cid) then if doPlayerRemoveMoney(cid, price * 10000) then doRemoveCondition(cid, CONDITION_INFIGHT) else doPlayerSendCancel(cid, "You need "..price.." gold bars to remove your battle.") end else doPlayerSendCancel(cid, "You are not in battle.") end else doPlayerSendCancel(cid, "You can only remove your battle in a protection zone.") end return true end
  14. Disponha.
  15. E o que são esses scripts? O que acontece? Especifique. Como vou poder codificar se você não fala sobre eles?
  16. Fiz pra que o player seja teleportado para o templo da nova town ao falar com o NPC. mayor.lua (data/npc/scripts): local newtown = 5 -- new townID local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid if (msgcontains(msg, 'dweller')) then talkState[talkUser] = 1 selfSay('You want to become a dweller of this city?', cid) elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if (getPlayerTown(cid) ~= newtown) then doPlayerSetTown(cid, newtown) doTeleportThing(cid, getTownTemplePosition(newtown)) doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) selfSay('Now you are a dweller of '..getTownName(newtown)..' City.', cid) else talkState[talkUser] = 0 selfSay('You are already a dweller of this city.', cid) end elseif (msgcontains(msg, 'no') and talkState[talkUser] == 1) then talkState[talkUser] = 0 selfSay('Okay, you are just visiting.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Mayor.xml (data/npc): <npc name="Mayor" script="data/npc/scripts/mayor.lua" access="5" lookdir="1"> <health now="1000" max="1000"/> <look type="123" head="45" body="67" legs="89" feet="10" addons="1"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. I can make you a {dweller} of this city." /> </parameters> </npc>
  17. Wise postou uma resposta no tópico em Scripts tfs 0.4 (OLD)
    Ficou muito doido!! E ao mesmo tempo um script tão limpo..
  18. teleporterman.lua (data/npc/scripts): local tab = { pos = {x = 123, y = 456, z = 7}, -- posição x, y, z do local a teleportar o player item = {5432, 1}, -- {itemID, count} price = 15 -- quantidade em crystal coins } local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid if (msgcontains(msg, 'teleport')) then talkState[talkUser] = 1 selfSay('Are you sure?', cid) selfSay('Remember..you need '..tab.item[2]..' '..getItemNameById(tab.item[1])..' and '..tab.price..' crystal coins to be teleported.', cid) elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 10000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doTeleportThing(cid, tab.pos) doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) selfSay('Have a good trip.', cid) else talkState[talkUser] = 0 selfSay('I can not teleport you. You do not have the necessary items.', cid) end elseif (msgcontains(msg, 'no') and talkState[talkUser] == 1) then talkState[talkUser] = 0 selfSay('Okay, maybe another time.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Teleporter Man.xml (data/npc): <npc name="Teleporter Man" script="data/npc/scripts/teleporterman.lua" access="5" lookdir="1"> <health now="1000" max="1000"/> <look type="123" head="45" body="67" legs="79" feet="10" addons="1"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. I can {teleport} you to an area." /> </parameters> </npc>
  19. Wise postou uma resposta no tópico em Sistemas, Mods & Funções .lua
    Sensacional !! Elas vão ficar marcadas na história das funções desenvolvidas para o Open Tibia, com certeza. Parabéns, bro.
  20. Certo. Tente agora, refiz o script. Você pediu pra usar a talkaction somente estando dentro de uma protection zone, então está certo.
  21. professor.lua (data/npc/scripts): local tab = { city1 = {x = 123, y = 456, z = 7}, city2 = {x = 123, y = 456, z = 7}, city3 = {x = 123, y = 456, z = 7}, city4 = {x = 123, y = 456, z = 7}, city5 = {x = 123, y = 456, z = 7}, city6 = {x = 123, y = 456, z = 7} } local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local ts = talkState[talkUser] local tef = doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) if (msgcontains(msg, 'city 1')) then ts = 1 selfSay('Quer ir mesmo para a City 1? La voce encontrara pokemons tipo fogo.', cid) elseif (msgcontains(msg, 'city 2')) then ts = 2 selfSay('Quer ir mesmo para a City 2? La voce encontrara pokemons tipo agua.', cid) elseif (msgcontains(msg, 'city 3')) then ts = 3 selfSay('Quer ir mesmo para a City 3? La voce encontrara pokemons tipo grama.', cid) elseif (msgcontains(msg, 'city 4')) then ts = 4 selfSay('Quer ir mesmo para a City 4? La voce encontrara pokemons tipo eletrico.', cid) elseif (msgcontains(msg, 'city 5')) then ts = 5 selfSay('Quer ir mesmo para a City 5? La voce encontrara pokemons tipo fantasma.', cid) elseif (msgcontains(msg, 'city 6')) then ts = 6 selfSay('Quer ir mesmo para a City 6? La voce encontrara pokemons tipo psiquico.', cid) elseif (msgcontains(msg, 'yes')) then if (ts == 1) then doTeleportThing(cid, tab.city1) tef elseif (ts == 2) then doTeleportThing(cid, tab.city2) tef elseif (ts == 3) then doTeleportThing(cid, tab.city3) tef elseif (ts == 4) then doTeleportThing(cid, tab.city4) tef elseif (ts == 5) then doTeleportThing(cid, tab.city5) tef elseif (ts == 6) then doTeleportThing(cid, tab.city6) tef end selfSay('Ai esta.', cid) elseif (msgcontains(msg, 'no') and ts > 0) then ts = 0 selfSay('Okay.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Dava pra ter simplificado mais. Estou meio sem tempo, mas espero que ajude. Professor.xml (data/npc): <npc name="Professor" script="data/npc/scripts/professor.lua" access="5" lookdir="1"> <health now="1000" max="1000"/> <look type="166" head="0" body="0" legs="0" feet="0" addons="0"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|. Voce quer ir para qual cidade: {city 1}, {city 2}, {city 3}, {city 4}, {city 5} ou {city 6}?" /> </parameters> </npc>
  22. local price = 5 -- quantidade em crystal coins (gold bars, no caso) function onSay(cid, words, param, channel) if getTilePzInfo(getThingPos(cid)) then if isPlayerPzLocked(cid) then if doPlayerRemoveMoney(cid, price * 10000) then doRemoveCondition(cid, CONDITION_INFIGHT) else doPlayerSendCancel(cid, "You need "..price.." gold bars to remove your battle.") end else doPlayerSendCancel(cid, "You are not in battle.") end else doPlayerSendCancel(cid, "You can only remove your battle in a protection zone.") end return true end
  23. Dá pra simplificar bastante, amigo (mas a sua intenção de ajudar outro membro foi ótima): local tab = { ["Texto Um"] = {x = 123, y = 456, z = 7}, ["Texto Dois"] = {x = 123, y = 456, z = 7}, ["Texto Três"] = {x = 123, y = 456, z = 7} } function onThink(interval, lastExecution) for t, pos in pairs(tab) do doSendAnimatedText(pos, t, math.random(1, 255)) end return true end A função de enviar textos animados foi desabilitada a partir da versão 8.7, se não me engano.

Informação Importante

Confirmação de Termo