Ir para conteúdo

Killua

Conde
  • Total de itens

    904
  • Registro em

  • Última visita

  • Dias Ganhos

    13

Tudo que Killua postou

  1. Tópico fechado a pedido do usuário.
  2. Killua

    Item summon

    Tá cheio de erros. http://www.xtibia.com/forum/topic/230174-simples-pet-sistema/
  3. Cara seu script está completamente errado. Como vc se inscreve no OMS sem nem testar o código?? Pra começar, você esqueceu de um then e um end. getCreatureSummons(cid) retorna uma tabela, como você quer usar uma tabela como cid?? Nessa linha: if getPlayerLevel(cid) > mst[2] or mst[3] < getPlayerLevel(cid) then Você deveria usar and e não or, para garantir que o player vai estar entre os leveis definidos.
  4. Duuh, você deve checar se o item está na posição antes de removê-lo, pois, se ele não estiver, vai dar erro. Tópico movido para a seção de dúvidas e pedidos resolvidos.
  5. Tópico movido para a seção de dúvidas e pedidos resolvidos.
  6. local config = { playerCount = 2001, -- Global storage for counting the players left/entered in the event goblet = 5805, -- id of the gold goblet you'll get when finishing the event. rewards = {2159}, -- You will get this + a gold goblet with your name on. -- {moneyId, count, using? 1 for using moneyReward, 0 for not using.} moneyReward = {2159, 10, 1}, -- Should be same as in the globalevent! -- The zombies will spawn randomly inside this area fromPosition = {x = 1150, y = 1024, z = 7}, -- top left cornor of the playground toPosition = {x = 1178, y = 1040, z = 7}, -- bottom right cornor of the playground id_trofeis = {5805, 7370, 7371}, -- Bote os 3 id dos trofeis, separados por vírgula. Tem que ser em order (primeiro o de ouro, dps prata e dps bronze) quant_points = {{10, 14}, {5, 9}, {1, 5}} } function onStatsChange(cid, attacker, type, combat, value) if isPlayer(cid) and isMonster(attacker) then if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then if getGlobalStorageValue(config.playerCount) >= 4 then doBroadcastMessage(getPlayerName(cid) .. " have been eated by Zombies!", MESSAGE_STATUS_CONSOLE_RED) local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) setGlobalStorageValue(config.playerCount, getGlobalStorageValue(config.playerCount)-1) elseif getGlobalStorageValue(config.playerCount) <= 3 then if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then local desc_ = getGlobalStorageValue(config.playerCount) == 3 and 2 or 3 if getGlobalStorageValue(config.playerCount) == 1 then local goblet = doPlayerAddItem(cid, config.id_trofeis[1], 1) doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(cid) .. " for winning the Zombie event.") else local goblet = doPlayerAddItem(cid, config.id_trofeis[desc_], 1) local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(cid) .. " for winning the Zombie event.") end doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) for _,items in ipairs(config.rewards) do doPlayerAddItem(cid, items, 1) end if getGlobalStorageValue(config.playerCount) == 1 then doPlayerAddItem(cid, config.moneyReward[1], math.random(config.quant_points[1][1], config.quant_points[1][2])) else local quant = getGlobalStorageValue(config.playerCount) == 3 and math.random(config.quant_points[3][1], config.quant_points[3][2]) or math.random(config.quant_points[2][1], config.quant_points[2][2]) doPlayerAddItem(cid, config.moneyReward[1], quant) end end if getGlobalStorageValue(config.playerCount) == 1 then doBroadcastMessage(getPlayerName(cid) .. " won the Zombie event! Congratulations!", MESSAGE_STATUS_WARNING) for x = config.fromPosition.x, config.toPosition.x do for y = config.fromPosition.y, config.toPosition.y do for z = config.fromPosition.z, config.toPosition.z do areapos = {x = x, y = y, z = z, stackpos = 253} getMonsters = getThingfromPos(areapos) if isMonster(getMonsters.uid) then doRemoveCreature(getMonsters.uid) end end end end end end return false end end return true end
  7. local config = { playerCount = 2001, -- Global storage for counting the players left/entered in the event goblet = 5805, -- id of the gold goblet you'll get when finishing the event. rewards = {2159}, -- You will get this + a gold goblet with your name on. -- {moneyId, count, using? 1 for using moneyReward, 0 for not using.} moneyReward = {2159, 10, 1}, -- Should be same as in the globalevent! -- The zombies will spawn randomly inside this area fromPosition = {x = 1150, y = 1024, z = 7}, -- top left cornor of the playground toPosition = {x = 1178, y = 1040, z = 7}, -- bottom right cornor of the playground id_trofeis = {5805, 7370, 7371}, -- Bote os 3 id dos trofeis, separados por vírgula. Tem que ser em order (primeiro o de ouro, dps prata e dps bronze) quant_points = {{10, 14}, {8, 10}, {6, 8}} } function onStatsChange(cid, attacker, type, combat, value) if isPlayer(cid) and isMonster(attacker) then if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then if getGlobalStorageValue(config.playerCount) >= 4 then doBroadcastMessage(getPlayerName(cid) .. " have been eated by Zombies!", MESSAGE_STATUS_CONSOLE_RED) local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) setGlobalStorageValue(config.playerCount, getGlobalStorageValue(config.playerCount)-1) elseif getGlobalStorageValue(config.playerCount) <= 3 then if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then doBroadcastMessage(getPlayerName(cid) .. " won the Zombie event! Congratulations!", MESSAGE_STATUS_WARNING) local desc_ = getGlobalStorageValue(config.playerCount) == 3 and 2 or 3 if getGlobalStorageValue(config.playerCount) == 1 then local goblet = doPlayerAddItem(cid, config.id_trofeis[1], 1) doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(cid) .. " for winning the Zombie event.") else local goblet = doPlayerAddItem(cid, config.id_trofeis[desc_], 1) local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(cid) .. " for winning the Zombie event.") end doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) for _,items in ipairs(config.rewards) do doPlayerAddItem(cid, items, 1) end if getGlobalStorageValue(config.playerCount) == 1 then doPlayerAddItem(cid, config.moneyReward[1], math.random(config.quant_points[1][1], config.quant_points[1][2])) else local quant = getGlobalStorageValue(config.playerCount) == 3 and math.random(config.quant_ponts[3][1], config.quant_ponts[3][2]) or math.random(config.quant_ponts[2][1], config.quant_ponts[2][2]) doPlayerAddItem(cid, config.moneyReward[1], quant) end end for x = config.fromPosition.x, config.toPosition.x do for y = config.fromPosition.y, config.toPosition.y do for z = config.fromPosition.z, config.toPosition.z do areapos = {x = x, y = y, z = z, stackpos = 253} getMonsters = getThingfromPos(areapos) if isMonster(getMonsters.uid) then doRemoveCreature(getMonsters.uid) end end end end end return false end end return true end na tabela quant_points vc vai por, o tanto {minimo, maximo} de points que os vencedores podem ganhar. Em ordem, primeiro o q fica em primeiro lugar, depois em segundo etc
  8. Não tem como ser o mesmo erro, já que aquele acusava o if_teofeis. Me mande o script e o erro pqra eu ver REP = Curtir
  9. Abre o script da ctrl+f procura if_trofeis e substitui por id_trofeis foi um erro de digitação. Essa coisa de ganhar menos eu mudo qd chegar em casa
  10. Use assim mas preste atenção, vc deve configurar a tabela id_trofeis corretamente: local config = { playerCount = 2001, -- Global storage for counting the players left/entered in the event goblet = 5805, -- id of the gold goblet you'll get when finishing the event. rewards = {2159}, -- You will get this + a gold goblet with your name on. -- {moneyId, count, using? 1 for using moneyReward, 0 for not using.} moneyReward = {2159, 10, 1}, -- Should be same as in the globalevent! -- The zombies will spawn randomly inside this area fromPosition = {x = 1150, y = 1024, z = 7}, -- top left cornor of the playground toPosition = {x = 1178, y = 1040, z = 7}, -- bottom right cornor of the playground id_trofeis = {5805} -- Bote os 3 id dos trofeis, separados por vírgula. Tem que ser em order (primeiro o de ouro, dps prata e dps bronze) } function onStatsChange(cid, attacker, type, combat, value) if isPlayer(cid) and isMonster(attacker) then if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then if getGlobalStorageValue(config.playerCount) >= 4 then doBroadcastMessage(getPlayerName(cid) .. " have been eated by Zombies!", MESSAGE_STATUS_CONSOLE_RED) local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) setGlobalStorageValue(config.playerCount, getGlobalStorageValue(config.playerCount)-1) elseif getGlobalStorageValue(config.playerCount) <= 3 then if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then doBroadcastMessage(getPlayerName(cid) .. " won the Zombie event! Congratulations!", MESSAGE_STATUS_WARNING) local desc_ = getGlobalStorageValue(config.playerCount) == 3 and 2 or 3 if getGlobalStorageValue(config.playerCount) == 1 then local goblet = doPlayerAddItem(cid, config.id_trofeis[1], 1) doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(cid) .. " for winning the Zombie event.") else local goblet = doPlayerAddItem(cid, if_trofeis[desc_], 1) local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(cid) .. " for winning the Zombie event.") end doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".") doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT) for _,items in ipairs(config.rewards) do doPlayerAddItem(cid, items, 1) end if config.moneyReward[3] == 1 then doPlayerAddItem(cid, config.moneyReward[1], math.random(10, 14)) end end for x = config.fromPosition.x, config.toPosition.x do for y = config.fromPosition.y, config.toPosition.y do for z = config.fromPosition.z, config.toPosition.z do areapos = {x = x, y = y, z = z, stackpos = 253} getMonsters = getThingfromPos(areapos) if isMonster(getMonsters.uid) then doRemoveCreature(getMonsters.uid) end end end end end return false end end return true end
  11. Tópico movido para a seção de dúvidas e pedidos resolvidos.
  12. Assim vc está chamando uma função já existente, como doBroadcastMessage por exemplo O armazenamento de dados dessa maneira funciona do mesmo modo que meu segundo exemplo, apesar de ser usado como o primeiro. É um modo bem úti.
  13. Usando addEvent O uso do addEvent tem inúmeras utilidades e pode ser complicado para algumas pessoas, inclusive era para mim quando eu estava começando a aprender LUA. Para que serve o addEvent? Para "chamar" uma função após um periodo de tempo, ou seja, executar uma função após um tempo estipulado. O addEvent tem como parâmetros: callback, delay e ... addEvent(callback, delay, ...) Onde callback é a função que será chamada, delay é o tempo (em milissegundos) até que se chame essa função e ... são os parâmetros que a função chamada utiliza. Exemplo: addEvent(doBroadcastMessage, 1000, "Bom dia", 23) Aqui, após 1 segundo (1000 ms), a função doBroadcastMessage(message, type) será executada com os parâmetros message = "Bom dia" e type = 23. O addEvent pode ser usado de duas maneiras: Chamando uma função existente ou criando uma nova função. Para chamar uma função existente, basta usar como acima, para usá-lo para criar uma nova função, usa-se assim, por exemplo: addEvent(function() if isCreature(cid) then doPlayerAddItem(cid, 2160, 10) doPlayerSendTextMessage(cid, 25, "Voce ganhou 10k.") end end, 1000) Assim é basicamente a mesma coisa, mas pude colocar várias funções dentro de um único addEvent, e mantive o delay 1000 (1 segundo). Obs: Precisei usar 2 ends, um para fechar function() e outro para fechar o if. Atenção! Além disso, existe uma outra diferença entre as duas formas de uso, vou tentar explicar da melhor maneira possível: Quando usamos o addEvent com uma função já existente (1o exemplo), as informações usadas serão as geradas no momento em que o evento foi chamado, por exemplo: function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) > 10 then doPlayerSendTextMessage(cid, 25, "Uma pedra sera criada na sua posiçao dentro de 2 segundos.") addEvent(doCreateItem, 2000, 1308, 1, getThingPos(cid)) end return true end Se usarmos assim, a pedra irá ser criada na posição onde o jogador se encontrava no momento em que "deu use" e não onde ele etará 2 segundos depois. Se você quiser que a pedra seja criada na nova posição do jogador (pos de 2 segundos depois), você deve fazer uma nova checagem, criando uma função: function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) > 10 then doPlayerSendTextMessage(cid, 25, "Uma pedra sera criada na sua posiçao dentro de 2 segundos.") addEvent(function() if isCreature(cid) then doCreateItem(1308, 1, getThingPos(cid)) end end, 2000) end return true end Atenção novamente: A checagem if isCreature(cid) que utilizei, é muito importante para um addEvent que envolva criaturas. Se você executasse o addEvent sem a checagem e o player logasse ou morresse antes desses 2 segundos se passarem, daria um erro na distro e interromperia o resto do script. Espero ter sido claro, qualquer dúvida, podem postar.
  14. Vc esqueceu de criar a variável storage rs. Os monstros poderiam ser colocados todos em uma 'so tabela: {"Rat", "Demon", "Hydra", "Dragon"} E pq vc multiplicou time por 1? Oo Bom script, du.
  15. Tópico movido para a seção de dúvidas e pedidos resolvidos.
  16. Tópico movido para a seção de dúvidas e pedidos resolvidos.
  17. Essa parte funciona assim: Dentro da tabela outfits, tem várias outras tabelas e os "nomes" delas são [1], [2], [3] e [4], cada uma contendo dois elementos nas suas tabelas ( {137, 129}, por exemplo ). voc é o nome que ele deu pra variável que tem o valor de getPlayerVocation(cid), que retorna o número da vocação do player. Ou seja, se ele for paladin, a variável irá retornar 3 e vai passar a ter esse valor e a partir daí voc = 3. A parte if outfits[voc] faz o seguinte: Ela checa se dentro da tabela outfits existe uma tabela com o mesmo número da vocação do player. Exemplo: Se, como dito acima, o player for paladin, voc será igual a 3 (voc = 3), portanto, vai ser checado se existe a tabela [3]. Se ela existir, o player receberá o outfit de cujo número está contido na tabela [3], no caso {139, 131}. Mas essa tabela possui dois números: 139 e 131. O primeiro feminino e o segundo masculino. O sexo do player é checado nesta linha: doPlayerAddOutfit(cid,outfits[voc][getPlayerSex(cid) == 0 and 1 or 2],0) Que diz: se o sexo do player for 0 (feminino), adicione o outfit de número correspondente ao primeiro elemento da tabela, caso contrário, adicione o outfit correspondente ao segundo elemento da tabela. Para entender isso, você precisa entender duas coisas: Chamar elementos de tabelas e simular if-else com and-or. Para entender isso, sugiro que leia esses 2 tutoriais: Tutorial Sobre Arrays e [simular if-else com and-or]. Tentei ser o mais claro possível, espero que tenha entendido.
  18. Killua

    Erro quest.

    Tópico movido para a seção de dúvidas e pedidos resolvidos.
  19. Olá amigo, finalmente mais um interessado rs. O seu erro foi confundir else com elseif. Quando se usa o else, não se pode colocar uma segunda condição (else getPlayerSex(cid) == 1). Isso só pode ser feito com o elseif, igual vc fez em elseif getPlayerVocation(cid) == 4. O else simplesmente diz oq será feito caso a condição anterior não seja aceita e também não exige um then, por exemplo: Se você usar: if getPlayerVocation(cid) == 1 then if getPlayerSex(cid) == 0 then doPlayerAddOutfit(cid, 137, 0) else doPlayerAddOutfit(cid, 129, 0) end end O script vai ser entendido da seguinte forma: Se o player tiver voc = 1, ele vai prosseguir. Em seguida, vai checar se o player tem sexo = 0, se tiver, vai adicionar o outfit 137, caso contrário, adicionará o outfit 129. Obviamente se o player não for do sexo 0, ele será do sexo 1, já que só existem esses 2... Portanto, o script vai interpretar tudo corretamente. Espero que tenha entendido, abraços.
  20. Killua

    Ncp de Teleport

    Tópico movido para a seção de dúvidas e pedidos resolvidos.
  21. Tópico movido para a seção de dúvidas e pedidos resolvidos.
  22. Boa, meus parabens.
  23. function onUse(cid, item, fromPosition, itemEx, toPosition) if item.itemid == 8303 and isKnight(cid) then setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 1000) doSendAnimatedText(getThingPos(cid), "+1000hp", 93) doRemoveItem(item.uid, 1) elseif item.iteimd == 8301 and isPaladin(cid) then setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 500) setCreatureMaxMana(cid, getCreatureMaxMana(cid) + 500) doSendAnimatedText(getThingPos(Cid), "+500mp", 90) doRemoveItem(item.uid, 1) elseif item.itemid == 8302 then if isSorcerer(cid) or isDruid(cid) then setCreatureMaxMana(cid, getCreatureMaxMana(cid) + 2000) doSendAnimatedText(cid, "+2000mp", 93) doRemoveItem(item.uid, 1) end end return true end
  24. Novo script adicionado.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...