Ir para conteúdo

Vorkhon

Campones
  • Total de itens

    52
  • Registro em

  • Última visita

Posts postados por Vorkhon

  1. Fala pessoal! Eu quero fazer um script que ao matar 1000 dragons ou dragon lords, apareça um Boss na area X. E não quero que possa acumular, o script como ta se eu matar 3000 dragons o boss aparece acumulado 3 vezes. Eu quero que só possa aparecer outro depois que ele morrer.

  2. Pessoal meu código deu problema novamente. O que esta acontecendo é o seguinte. Quando o NPC reborna, o player fica com a vida total igual a (LVL*HP por Level) + Uma vida fake. Essa vida fake é a que aparece na configuração do código (nesse caso 185). Então um personagem que ganha 15 de hp por lvl e fizer o reborn para level 8, ele vai ficar com 105(15x7)+185 = 290 de hp, porém o 185 é fake. Se o player se curar, ou tomar dano ele perde esses 185 pra sempre, e fica com 105 de hp definitivo.

     

    Minha dúvida no script é como fazer o HP rebornado ser fixo. Eu quero que quando rebornado ele seja lvl 8 com exatos 185/40 hp/mana e que de para healar, tomar dano, e morrer sem que de bug na vida.

    obs: lembrando que tudo inclui a mana também

  3. 11 horas atrás, koete disse:

    O que acontece é que o sistema ta integrado em remover hp, você tem que checar os limites criados no sistema do wolf e coloca-los ai no script do seu npc. Pode postar tambem o script do dodge fazendo um favor?

    Claro é esse daqui:

     

    local storagedodge = 98798644 -- storage do dodge
    local cor = 198 -- cor do texto
    local effect = 31 -- id do magic effect 
    local msg = "Dodge!" -- msg
     
    local dodge = { 
        {min = 1, max = 10, chance = 6}, -- se o dodge tiver entre 1 e 2 tem 10% de chance de da dodge.
        {min = 11, max = 20, chance = 9}, -- vocês pode adicionar mas se quiserem
        {min = 21, max = 40, chance = 12},
        {min = 41, max = 50, chance = 15},
        {min = 51, max = 70, chance = 18},
        {min = 71, max = 90, chance = 21},
        {min = 91, max = 100, chance = 24},
        {min = 101, max = math.huge, chance = 30}
    }
     
    function onStatsChange(cid, attacker, type, combat, value)
        if not isCreature(cid) then
            return false
        end
        for _, tudo in pairs(dodge) do
            if getPlayerStorageValue(cid, storagedodge) >= tudo.min and getPlayerStorageValue(cid, storagedodge) <= tudo.max then
                local chancex = math.random(1, 100)
                if chancex <= tudo.chance then
                    if combat ~= COMBAT_HEALING then
                        doSendMagicEffect(getCreaturePosition(cid), effect)
                        doSendAnimatedText(getCreaturePosition(cid), msg, cor)
                        return false
                    end
                end
            end
        end
        return true
    end

     

  4. 8 horas atrás, koete disse:
      Ocultar conteúdo
    
    
    local combat = createCombatObject()
    
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
    local condition = createConditionObject(CONDITION_OUTFIT)
    setConditionParam(condition, CONDITION_PARAM_TICKS, 6000)
    for i = 5474, 5474 do
    addOutfitCondition(condition, {lookTypeEx = i})
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
    setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -60, -1, -60, 5, 5, 4, 7)
    end
    setCombatCondition(combat, condition)
    
    
    function VorkhonParar(cid)
    if isCreature(cid) == false then
    return false
    end
    doCreatureSetNoMove(cid, true)
    end
    
    function VorkhonMover(cid)
    if isCreature(cid) == false then
    return false
    end
    doCreatureSetNoMove(cid, false)
    end
    
    
    
    
    
    function onCastSpell(cid, var)
    local target = getCreatureTarget(cid)
    VorkhonParar(target)
    addEvent(VorkhonMover, 6 * 1000, target)
    return doCombat(cid, combat, var)
    end

     

     

     

    Testa dessa forma.

    Maravilha! Funcionou amigo!

  5. Pessoal eu to querendo fazer um NPC basico que tenha um dialogo simples que vai explicar algo sobre um boss. Ai quando o player matar esse boss quando der Hi para o npc novamente vai mudar o dialogo inicial dele e o player vai ganha experiencia. 

  6. Fala pessoal. Seguinte eu uso o sistema de Dodge do Wolf funcionando certinho e uso esse scrip que postei de um NPC que reborna. O que aconteceu foi o seguinte, quando fui testar o npc para uma classe nova com meu GM. Eu mudei de classe, mas quando foi alterar a minha HP pra reborn meu personagem deu Dodge, nao tomou dano e esta completamente bugado. Ele fica imovel sem o nome aparecer. Alguem sabe alguma solução pra isso?

  7. 5 horas atrás, koete disse:

    Usa isso em seu script, pra na hora que ele for retornar ele vai checar antes se ainda há a criatura se não houver então ele vai retornar false e não vai dar o erro.

    
    if isCreature(cid) == false then
    return false
    end

     

    Cara eu não manjo muito onde colocar direitinho. Mas botei em varios lugares e não ta dando certo. Eu entendi a logica do código, mas não ta dando. No creature cid não tem que especifica nada? Minha spell eu fiz de target ao inves de wave, nao sei se muda algo. Segue como eu fiz:
     

    local combat = createCombatObject()
    
    setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
    local condition = createConditionObject(CONDITION_OUTFIT)
    setConditionParam(condition, CONDITION_PARAM_TICKS, 6000)
    for i = 5474, 5474 do
    addOutfitCondition(condition, {lookTypeEx = i})
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
    setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -60, -1, -60, 5, 5, 4, 7)
    end
    setCombatCondition(combat, condition)
    
    function onCastSpell(cid, var)
    local target = getCreatureTarget(cid)
    if isCreature(cid) == false then
    return false
    end
    doCreatureSetNoMove(target, true)
    addEvent(doCreatureSetNoMove, 6 * 1000, target, false)
    return doCombat(cid, combat, var)
    end

     

  8. 22 horas atrás, koete disse:

    A imagem das knifes voando ou a imagem de quando elas hitam? 

    Se for elas voando na vdd você tem que descobrir o valor certo do shoteffect. 

    No caso de aparecer algum efeito na hora do hit você não colocou pra aparecer. 

     

    Qual dos efeitos n aparecem?

    Não aparece as Knifes voando. Eu já tentei por o Código delas 9, e tentei outros efeitos. É algum erro no script. Olha como ta agora, ta dando o hit mas sem imagem nenhuma:

     

    local acombat1 = createCombatObject() 
    local acombat2 = createCombatObject() 
    
    local combat1 = createCombatObject()
    setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_THROWINGKNIFE)
    setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -4.0, 0, -5.0, 0)
    
    local combat2 = createCombatObject()
    setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_THROWINGKNIFE)
    setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -4.0, 0, -5.0, 0)
     
    arr1 = {
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 3, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    }
    
    arr2 = {
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 3, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    }
     
    local area1 = createCombatArea(arr1)
    local area2 = createCombatArea(arr2)
    setCombatArea(combat1, area1)
    setCombatArea(combat2, area2)
    
    function onTargetTile(cid, pos)
    doCombat(cid,combat1,positionToVariant(pos))
    end
    
    function onTargetTile2(cid, pos) 
    doCombat(cid,combat2,positionToVariant(pos)) 
    end 
    
    setCombatCallback(acombat1, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
    setCombatCallback(acombat2, CALLBACK_PARAM_TARGETTILE, "onTargetTile2") 
     
    local function onCastSpell1(parameters)
    doCombat(parameters.cid, combat1, parameters.var)
    end
    
    local function onCastSpell2(parameters)
    doCombat(parameters.cid, combat2, parameters.var)
    
    end
    
    function onCastSpell(cid, var)
    local parameters = { cid = cid, var = var}
    addEvent(onCastSpell1, 0, parameters)
    addEvent(onCastSpell2, 200, parameters)
    
    return TRUE
    
    
    end

     

  9. 7 horas atrás, koete disse:

    Usa dessa forma. 

     

      Ocultar conteúdo
    
    
    local config = {
        
        item = 2150, -- ID do item necessario para rebornar
        count = 1, -- Count do item a cima
        
        life = 100, -- Life ao rebornar
        mana = 50, -- Mana ao rebornar
        level = 8, -- Level ao rebornar
        voc = 2, -- Voc ao rebornar
        storage = 30023
    }
    
    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, 'reborn')) then
            if doPlayerRemoveItem(cid, config.item, config.count) then
    setCreatureMaxHealth(cid, config.life)
      
          
          
          if getCreatureHealth(cid) > config.life then
            doCreatureAddHealth(cid, -(getCreatureHealth(cid) - config.life))
          else
            doCreatureAddHealth(cid, config.life)
          end
          		
          
          
                setCreatureMaxMana(cid, config.mana)
                doPlayerSetVocation(cid, config.voc)
                doCreatureSetStorage(cid, config.storage, -1)
                doPlayerAddExp(cid, -(getPlayerExperience(cid)-getExperienceForLevel(1)))
          		selfSay('Parabens, voce rebornou', cid)
                return TRUE
            else
                selfSay("Oh! Então traga para mim {".. config.count .." ".. getItemInfo(config.item).name .."}", cid) 
                return TRUE
            end
        end
    end
    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())

     

     

    Funcionou perfeitamente. Muito obrigado!

  10. 8 horas atrás, koete disse:

    para paralizar você pode usar a função.

    
    doCreatureSetNoMove(cid, true)

    True paraliza, false desparaliza.

    você varia entre os alvos no Cid, cid vai apralizar vc usa um target como getCreatureTarget(cid) que ira paralizar seu target. 

    No final faça um retorno pra poder desparalizar seu personagem depois de um tempo. 

    Funcionou amigo! Mas só uma coisa. Se o alvo morre, ele tenta "desparalizar" e acaba desparalizando o nada e da um errinho na distro, tem como fazer isso não acontecer?

  11. Quando eu uso essa spell de multiplos hits e caminho durante a execução dela ela fica mudando de direção. É uma wave direcionada que vai e volta. Eu já experimentei tirar o direction mas mesmo assim ela fica doida quando o personagem anda.

     

    Segue o script:

     

    local combat1 = createCombatObject()
    setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat1, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
    setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -3, -5, -2, -7)
    
    local combat2 = createCombatObject()
    setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
    setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -3, -5, -2, -7)
    
    local combat3 = createCombatObject()
    setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
    setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -3, -5, -2, -7)
    
    local combat4 = createCombatObject()
    setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat4, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
    setCombatFormula(combat4, COMBAT_FORMULA_LEVELMAGIC, -3, -5, -2, -7)
    
    local combat5 = createCombatObject()
    setCombatParam(combat5, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat5, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    setCombatFormula(combat5, COMBAT_FORMULA_LEVELMAGIC, -5, -5, -5, -12)
    
    local combat6 = createCombatObject()
    setCombatParam(combat6, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat6, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    setCombatFormula(combat6, COMBAT_FORMULA_LEVELMAGIC, -5, -5, -5, -12)
    
    local combat7 = createCombatObject()
    setCombatParam(combat7, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat7, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    setCombatFormula(combat7, COMBAT_FORMULA_LEVELMAGIC, -5, -5, -5, -12)
    
    local combat8 = createCombatObject()
    setCombatParam(combat8, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat8, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    setCombatFormula(combat8, COMBAT_FORMULA_LEVELMAGIC, -5, -5, -5, -12)
    
    local combat9 = createCombatObject()
    setCombatParam(combat9, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
    setCombatParam(combat9, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
    setCombatFormula(combat9, COMBAT_FORMULA_LEVELMAGIC, -5, -5, -5, -12)
    
    arr1 = {
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    }
    
    arr2 = {
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    }
    
    arr3 = {
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    }
    
    
    arr4 = {
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    }
    
    arr5 = {
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    }
    
    arr6 = {
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    }
    
    arr7 = {
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    }
    
    arr8 = {
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    }
    
    arr9 = {
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    }
    
    
    
    local area1 = createCombatArea(arr1)
    local area2 = createCombatArea(arr2)
    local area3 = createCombatArea(arr3)
    local area4 = createCombatArea(arr4)
    local area5 = createCombatArea(arr5)
    local area6 = createCombatArea(arr6)
    local area7 = createCombatArea(arr7)
    local area8 = createCombatArea(arr8)
    local area9 = createCombatArea(arr9)
    setCombatArea(combat1, area1)
    setCombatArea(combat2, area2)
    setCombatArea(combat3, area3)
    setCombatArea(combat4, area4)
    setCombatArea(combat5, area5)
    setCombatArea(combat6, area6)
    setCombatArea(combat7, area7)
    setCombatArea(combat8, area8)
    setCombatArea(combat9, area9)
    
    local function onCastSpell1(parameters)
    doCombat(parameters.cid, combat1, parameters.var)
    end
    
    local function onCastSpell2(parameters)
    doCombat(parameters.cid, combat2, parameters.var)
    end
    local function onCastSpell3(parameters)
    doCombat(parameters.cid, combat3, parameters.var)
    end
    
    local function onCastSpell4(parameters)
    doCombat(parameters.cid, combat4, parameters.var)
    end
    
    local function onCastSpell5(parameters)
    doCombat(parameters.cid, combat5, parameters.var)
    end
    
    local function onCastSpell6(parameters)
    doCombat(parameters.cid, combat6, parameters.var)
    end
    local function onCastSpell7(parameters)
    doCombat(parameters.cid, combat7, parameters.var)
    end
    
    local function onCastSpell8(parameters)
    doCombat(parameters.cid, combat8, parameters.var)
    end
    
    local function onCastSpell9(parameters)
    doCombat(parameters.cid, combat9, parameters.var)
    end
    
    
    function onCastSpell(cid, var)
    local parameters = { cid = cid, var = var}
    addEvent(onCastSpell1, 100, parameters)
    addEvent(onCastSpell2, 200, parameters)
    addEvent(onCastSpell3, 300, parameters)
    addEvent(onCastSpell4, 400, parameters)
    addEvent(onCastSpell5, 500, parameters)
    addEvent(onCastSpell6, 600, parameters)
    addEvent(onCastSpell7, 700, parameters)
    addEvent(onCastSpell8, 800, parameters)
    addEvent(onCastSpell9, 900, parameters)
    
    return TRUE
    end

     

  12. Valeu cara! Mano pra dar a mensagem de erro só fazer assim? 

     

    local reqVocLvl = {
    	--[voc]
    	[1] 	= {lvl = 10, pos={x=000,y=000,z=00},
    	[2] 	= {lvl = 20, pos={x=000,y=000,z=00},
    	[3] 	= {lvl = 30, pos={x=000,y=000,z=00},
    	[4] 	= {lvl = 40, pos={x=000,y=000,z=00},
    }
    
    function onUse(cid, item, frompos, item2, topos)
    local voc = getPlayerVocation(cid)
    
    if(reqVocLvl[voc] and reqVocLvl[voc].lvl <= getPlayerLevel(cid))then 
    	
    doTeleportThing(cid,reqVocLvl[voc].pos) 
    else
    doPlayerSendCancel(cid,"Only X can pass through that door.")                                                                 
    end
    return true
    end

     

  13. Eu baixei a ultima versão do OTClient, e no entergame.lua não esta aparecendo a linha que tinha nos anteriores. "function EnterGame.setUniqueServer(host, port, protocol, windowWidth, windowHeight)". 

     

    Como faz para por IPFixo no otclientv8-master?

     

    EnterGame = { }
    
    -- private variables
    local loadBox
    local enterGame
    local enterGameButton
    local clientBox
    local protocolLogin
    local server = nil
    local versionsFound = false
    
    local customServerSelectorPanel
    local serverSelectorPanel
    local serverSelector
    local clientVersionSelector
    local serverHostTextEdit
    local rememberPasswordBox
    local protos = {"740", "760", "772", "792", "800", "810", "854", "860", "870", "961", "1000", "1077", "1090", "1096", "1098", "1099", "1100", "1200", "1220"}
    
    local checkedByUpdater = {}
    
    -- private functions
    local function onProtocolError(protocol, message, errorCode)
      if errorCode then
        return EnterGame.onError(message)
      end
      return EnterGame.onLoginError(message)
    end
    
    local function onSessionKey(protocol, sessionKey)
      G.sessionKey = sessionKey
    end
    
    local function onCharacterList(protocol, characters, account, otui)
      if rememberPasswordBox:isChecked() then
        local account = g_crypt.encrypt(G.account)
        local password = g_crypt.encrypt(G.password)
    
        g_settings.set('account', account)
        g_settings.set('password', password)
      else
        EnterGame.clearAccountFields()
      end
    
      for _, characterInfo in pairs(characters) do
        if characterInfo.previewState and characterInfo.previewState ~= PreviewState.Default then
          characterInfo.worldName = characterInfo.worldName .. ', Preview'
        end
      end
    
      if loadBox then
        loadBox:destroy()
        loadBox = nil
      end
        
      CharacterList.create(characters, account, otui)
      CharacterList.show()
    
      g_settings.save()
    end
    
    local function onUpdateNeeded(protocol, signature)
      return EnterGame.onError(tr('Your client needs updating, try redownloading it.'))
    end
    
    local function onProxyList(protocol, proxies)
      for _, proxy in ipairs(proxies) do
        g_proxy.addProxy(proxy["host"], proxy["port"], proxy["priority"])
      end
    end
    
    local function parseFeatures(features)
      for feature_id, value in pairs(features) do
          if value == "1" or value == "true" or value == true then
            g_game.enableFeature(feature_id)
          else
            g_game.disableFeature(feature_id)
          end
      end  
    end
    
    local function validateThings(things)
      local incorrectThings = ""
      local missingFiles = false
      local versionForMissingFiles = 0
      if things ~= nil then
        local thingsNode = {}
        for thingtype, thingdata in pairs(things) do
          thingsNode[thingtype] = thingdata[1]
          if not g_resources.fileExists("/things/" .. thingdata[1]) then
            incorrectThings = incorrectThings .. "Missing file: " .. thingdata[1] .. "\n"
            missingFiles = true
            versionForMissingFiles = thingdata[1]:split("/")[1]
          else
            local localChecksum = g_resources.fileChecksum("/things/" .. thingdata[1]):lower()
            if localChecksum ~= thingdata[2]:lower() and #thingdata[2] > 1 then
              if g_resources.isLoadedFromArchive() then -- ignore checksum if it's test/debug version
                incorrectThings = incorrectThings .. "Invalid checksum of file: " .. thingdata[1] .. " (is " .. localChecksum .. ", should be " .. thingdata[2]:lower() .. ")\n"
              end
            end
          end
        end
        g_settings.setNode("things", thingsNode)
      else
        g_settings.setNode("things", {})
      end
      if missingFiles then
      
        incorrectThings = incorrectThings .. "\nYou should open data/things and create directory " .. versionForMissingFiles .. 
        ".\nIn this directory (data/things/" .. versionForMissingFiles .. ") you should put missing\nfiles (Tibia.dat and Tibia.spr) " ..
        "from correct Tibia version."
      end
      return incorrectThings
    end
    
    local function onTibia12HTTPResult(session, playdata)
      local characters = {}
      local worlds = {}
      local account = {
        status = 0,
        subStatus = 0,
        premDays = 0
      }
      if session["status"] ~= "active" then
        account.status = 1
      end
      if session["ispremium"] then
        account.subStatus = 1 -- premium
      end
      if session["premiumuntil"] > g_clock.seconds() then
        account.subStatus = math.floor((session["premiumuntil"] - g_clock.seconds()) / 86400)
      end
        
      local things = {
        data = {G.clientVersion .. "/Tibia.dat", ""},
        sprites = {G.clientVersion .. "/Tibia.spr", ""},
      }
      
      local incorrectThings = validateThings(things)
      if #incorrectThings > 0 then
        g_logger.error(incorrectThings)
        if Updater and not checkedByUpdater[G.clientVersion] then
          checkedByUpdater[G.clientVersion] = true
          return Updater.check({
            version = G.clientVersion,
            host = G.host
          })
        else
          return EnterGame.onError(incorrectThings)
        end
      end
      
      onSessionKey(nil, session["sessionkey"])
      
      for _, world in pairs(playdata["worlds"]) do
        worlds[world.id] = {
          name = world.name,
          port = world.externalportunprotected or world.externalportprotected or world.externaladdress,
          address = world.externaladdressunprotected or world.externaladdressprotected or world.externalport
        }
      end
      
      for _, character in pairs(playdata["characters"]) do
        local world = worlds[character.worldid]
        if world then
          table.insert(characters, {
            name = character.name,
            worldName = world.name,
            worldIp = world.address,
            worldPort = world.port
          })
        end
      end
      
      -- proxies
      if g_proxy then
        g_proxy.clear()
        if playdata["proxies"] then
          for i, proxy in ipairs(playdata["proxies"]) do
            g_proxy.addProxy(proxy["host"], tonumber(proxy["port"]), tonumber(proxy["priority"]))
          end
        end
      end
      
      g_game.setCustomProtocolVersion(0)
      g_game.chooseRsa(G.host)
      g_game.setClientVersion(G.clientVersion)
      g_game.setProtocolVersion(g_game.getClientProtocolVersion(G.clientVersion))
      g_game.setCustomOs(-1) -- disable
      if not g_game.getFeature(GameExtendedOpcode) then
        g_game.setCustomOs(5) -- set os to windows if opcodes are disabled
      end
      
      onCharacterList(nil, characters, account, nil)  
    end
    
    local function onHTTPResult(data, err)  
      if err then
        return EnterGame.onError(err)
      end
      if data['error'] and data['error']:len() > 0 then
        return EnterGame.onLoginError(data['error'])
      elseif data['errorMessage'] and data['errorMessage']:len() > 0 then
        return EnterGame.onLoginError(data['errorMessage'])
      end
      
      if type(data["session"]) == "table" and type(data["playdata"]) == "table" then
        return onTibia12HTTPResult(data["session"], data["playdata"])
      end  
      
      local characters = data["characters"]
      local account = data["account"]
      local session = data["session"]
     
      local version = data["version"]
      local things = data["things"]
      local customProtocol = data["customProtocol"]
    
      local features = data["features"]
      local settings = data["settings"]
      local rsa = data["rsa"]
      local proxies = data["proxies"]
    
      local incorrectThings = validateThings(things)
      if #incorrectThings > 0 then
        g_logger.info(incorrectThings)
        return EnterGame.onError(incorrectThings)
      end
      
      -- custom protocol
      g_game.setCustomProtocolVersion(0)
      if customProtocol ~= nil then
        customProtocol = tonumber(customProtocol)
        if customProtocol ~= nil and customProtocol > 0 then
          g_game.setCustomProtocolVersion(customProtocol)
        end
      end
      
      -- force player settings
      if settings ~= nil then
        for option, value in pairs(settings) do
          modules.client_options.setOption(option, value, true)
        end
      end
        
      -- version
      G.clientVersion = version
      g_game.setClientVersion(version)
      g_game.setProtocolVersion(g_game.getClientProtocolVersion(version))  
      g_game.setCustomOs(-1) -- disable
      
      if rsa ~= nil then
        g_game.setRsa(rsa)
      end
    
      if features ~= nil then
        parseFeatures(features)
      end
    
      if session ~= nil and session:len() > 0 then
        onSessionKey(nil, session)
      end
      
      -- proxies
      if g_proxy then
        g_proxy.clear()
        if proxies then
          for i, proxy in ipairs(proxies) do
            g_proxy.addProxy(proxy["host"], tonumber(proxy["port"]), tonumber(proxy["priority"]))
          end
        end
      end
      
      onCharacterList(nil, characters, account, nil)  
    end
    
    
    -- public functions
    function EnterGame.init()
      if USE_NEW_ENERGAME then return end
      enterGame = g_ui.displayUI('entergame')
      
      serverSelectorPanel = enterGame:getChildById('serverSelectorPanel')
      customServerSelectorPanel = enterGame:getChildById('customServerSelectorPanel')
      
      serverSelector = serverSelectorPanel:getChildById('serverSelector')
      rememberPasswordBox = enterGame:getChildById('rememberPasswordBox')
      serverHostTextEdit = customServerSelectorPanel:getChildById('serverHostTextEdit')
      clientVersionSelector = customServerSelectorPanel:getChildById('clientVersionSelector')
      
      if Servers ~= nil then 
        for name,server in pairs(Servers) do
          serverSelector:addOption(name)
        end
      end
      if serverSelector:getOptionsCount() == 0 or ALLOW_CUSTOM_SERVERS then
        serverSelector:addOption(tr("Another"))    
      end  
      for i,proto in pairs(protos) do
        clientVersionSelector:addOption(proto)
      end
    
      if serverSelector:getOptionsCount() == 1 then
        enterGame:setHeight(enterGame:getHeight() - serverSelectorPanel:getHeight())
        serverSelectorPanel:setOn(false)
      end
      
      local account = g_crypt.decrypt(g_settings.get('account'))
      local password = g_crypt.decrypt(g_settings.get('password'))
      local server = g_settings.get('server')
      local host = g_settings.get('host')
      local clientVersion = g_settings.get('client-version')
    
      if serverSelector:isOption(server) then
        serverSelector:setCurrentOption(server, false)
        if Servers == nil or Servers[server] == nil then
          serverHostTextEdit:setText(host)
        end
        clientVersionSelector:setOption(clientVersion)
      else
        server = ""
        host = ""
      end
      
      enterGame:getChildById('accountPasswordTextEdit'):setText(password)
      enterGame:getChildById('accountNameTextEdit'):setText(account)
      rememberPasswordBox:setChecked(#account > 0)
        
      g_keyboard.bindKeyDown('Ctrl+G', EnterGame.openWindow)
    
      if g_game.isOnline() then
        return EnterGame.hide()
      end
    
      scheduleEvent(function()
        EnterGame.show()
      end, 100)
    end
    
    function EnterGame.terminate()
      if not enterGame then return end
      g_keyboard.unbindKeyDown('Ctrl+G')
      
      enterGame:destroy()
      if loadBox then
        loadBox:destroy()
        loadBox = nil
      end
      if protocolLogin then
        protocolLogin:cancelLogin()
        protocolLogin = nil
      end
      EnterGame = nil
    end
    
    function EnterGame.show()
      if not enterGame then return end
      enterGame:show()
      enterGame:raise()
      enterGame:focus()
      enterGame:getChildById('accountNameTextEdit'):focus()
    end
    
    function EnterGame.hide()
      if not enterGame then return end
      enterGame:hide()
    end
    
    function EnterGame.openWindow()
      if g_game.isOnline() then
        CharacterList.show()
      elseif not g_game.isLogging() and not CharacterList.isVisible() then
        EnterGame.show()
      end
    end
    
    function EnterGame.clearAccountFields()
      enterGame:getChildById('accountNameTextEdit'):clearText()
      enterGame:getChildById('accountPasswordTextEdit'):clearText()
      enterGame:getChildById('accountTokenTextEdit'):clearText()
      enterGame:getChildById('accountNameTextEdit'):focus()
      g_settings.remove('account')
      g_settings.remove('password')
    end
    
    function EnterGame.onServerChange()
      server = serverSelector:getText()
      if server == tr("Another") then
        if not customServerSelectorPanel:isOn() then
          serverHostTextEdit:setText("")
          customServerSelectorPanel:setOn(true)  
          enterGame:setHeight(enterGame:getHeight() + customServerSelectorPanel:getHeight())
        end
      elseif customServerSelectorPanel:isOn() then
        enterGame:setHeight(enterGame:getHeight() - customServerSelectorPanel:getHeight())
        customServerSelectorPanel:setOn(false)
      end
      if Servers and Servers[server] ~= nil then
        serverHostTextEdit:setText(Servers[server])
      end
    end
    
    function EnterGame.doLogin()
      if g_game.isOnline() then
        local errorBox = displayErrorBox(tr('Login Error'), tr('Cannot login while already in game.'))
        connect(errorBox, { onOk = EnterGame.show })
        return
      end
      
      G.account = enterGame:getChildById('accountNameTextEdit'):getText()
      G.password = enterGame:getChildById('accountPasswordTextEdit'):getText()
      G.authenticatorToken = enterGame:getChildById('accountTokenTextEdit'):getText()
      G.stayLogged = true
      G.server = serverSelector:getText():trim()
      G.host = serverHostTextEdit:getText()
      G.clientVersion = tonumber(clientVersionSelector:getText())  
     
      if not rememberPasswordBox:isChecked() then
        g_settings.set('account', G.account)
        g_settings.set('password', G.password)  
      end
      g_settings.set('host', G.host)
      g_settings.set('server', G.server)
      g_settings.set('client-version', G.clientVersion)
      g_settings.save()
    
      local server_params = G.host:split(":")
      if G.host:lower():find("http") ~= nil then
        if #server_params >= 4 then
          G.host = server_params[1] .. ":" .. server_params[2] .. ":" .. server_params[3] 
          G.clientVersion = tonumber(server_params[4])
        elseif #server_params >= 3 then
          if tostring(tonumber(server_params[3])) == server_params[3] then
            G.host = server_params[1] .. ":" .. server_params[2] 
            G.clientVersion = tonumber(server_params[3])
          end
        end
        return EnterGame.doLoginHttp()      
      end
      
      local server_ip = server_params[1]
      local server_port = 7171
      if #server_params >= 2 then
        server_port = tonumber(server_params[2])
      end
      if #server_params >= 3 then
        G.clientVersion = tonumber(server_params[3])
      end
      if type(server_ip) ~= 'string' or server_ip:len() <= 3 or not server_port or not G.clientVersion then
        return EnterGame.onError("Invalid server, it should be in format IP:PORT or it should be http url to login script")  
      end
      
      local things = {
        data = {G.clientVersion .. "/Tibia.dat", ""},
        sprites = {G.clientVersion .. "/Tibia.spr", ""},
      }
      
      local incorrectThings = validateThings(things)
      if #incorrectThings > 0 then
        g_logger.error(incorrectThings)
        if Updater and not checkedByUpdater[G.clientVersion] then
          checkedByUpdater[G.clientVersion] = true
          return Updater.check({
            version = G.clientVersion,
            host = G.host
          })
        else
          return EnterGame.onError(incorrectThings)
        end
      end
    
      protocolLogin = ProtocolLogin.create()
      protocolLogin.onLoginError = onProtocolError
      protocolLogin.onSessionKey = onSessionKey
      protocolLogin.onCharacterList = onCharacterList
      protocolLogin.onUpdateNeeded = onUpdateNeeded
      protocolLogin.onProxyList = onProxyList
    
      EnterGame.hide()
      loadBox = displayCancelBox(tr('Please wait'), tr('Connecting to login server...'))
      connect(loadBox, { onCancel = function(msgbox)
                                      loadBox = nil
                                      protocolLogin:cancelLogin()
                                      EnterGame.show()
                                    end })
    
      if G.clientVersion == 1000 then -- some people don't understand that tibia 10 uses 1100 protocol
        G.clientVersion = 1100
      end
      -- if you have custom rsa or protocol edit it here
      g_game.setClientVersion(G.clientVersion)
      g_game.setProtocolVersion(g_game.getClientProtocolVersion(G.clientVersion))
      g_game.setCustomProtocolVersion(0)
      g_game.setCustomOs(-1) -- disable
      g_game.chooseRsa(G.host)
      if #server_params <= 3 and not g_game.getFeature(GameExtendedOpcode) then
        g_game.setCustomOs(2) -- set os to windows if opcodes are disabled
      end
    
      -- extra features from init.lua
      for i = 4, #server_params do
        g_game.enableFeature(tonumber(server_params[i]))
      end
      
      -- proxies
      if g_proxy then
        g_proxy.clear()
      end
      
      if modules.game_things.isLoaded() then
        g_logger.info("Connecting to: " .. server_ip .. ":" .. server_port)
        protocolLogin:login(server_ip, server_port, G.account, G.password, G.authenticatorToken, G.stayLogged)
      else
        loadBox:destroy()
        loadBox = nil
        EnterGame.show()
      end
    end
    
    function EnterGame.doLoginHttp()
      if G.host == nil or G.host:len() < 10 then
        return EnterGame.onError("Invalid server url: " .. G.host)    
      end
    
      loadBox = displayCancelBox(tr('Please wait'), tr('Connecting to login server...'))
      connect(loadBox, { onCancel = function(msgbox)
                                      loadBox = nil
                                      EnterGame.show()
                                    end })                                
                                  
      local data = {
        type = "login",
        account = G.account,
        accountname = G.account,
        email = G.account,
        password = G.password,
        accountpassword = G.password,
        token = G.authenticatorToken,
        version = APP_VERSION,
        uid = G.UUID,
        stayloggedin = true
      }
      
      HTTP.postJSON(G.host, data, onHTTPResult)
      EnterGame.hide()
    end
    
    function EnterGame.onError(err)
      if loadBox then
        loadBox:destroy()
        loadBox = nil
      end
      local errorBox = displayErrorBox(tr('Login Error'), err)
      errorBox.onOk = EnterGame.show
    end
    
    function EnterGame.onLoginError(err)
      if loadBox then
        loadBox:destroy()
        loadBox = nil
      end
      local errorBox = displayErrorBox(tr('Login Error'), err)
      errorBox.onOk = EnterGame.show
      if err:lower():find("invalid") or err:lower():find("not correct") or err:lower():find("or password") then
        EnterGame.clearAccountFields()
      end
    end

     

  14. 17 horas atrás, lSainty disse:

    Tenta colocar isso:

    
    doCreatureAddHealth(cid, -(getCreatureHealth(cid) - config.life))

    Abaixo dessa linha:

    
    setCreatureMaxHealth(cid, config.life)

     

    Não deu cara. Ele fica com vida red, mas quando toma dano a vida fica bem bugada. E quando player morre ele já nasce morrendo kkkk.

  15. Primeiramente desculpa aos ADMs se for a área errada. 

     

    1) Eu quero saber se é possível eu deixar o Ambient Light travado, meu objetivo é deixar o jogo mais "Dark". Queria travar em 30-40%. Uso um Baiak e tenho sources. Por enquanto eu não queria optar pelo OTClient, pois estou com problema em transferir o dat e spr do meu serer. Só se for o único metodo mesmo.

  16. Eu estou fazendo um servidor puxado pra RPG, e gostaria de uma spell que fizesse convince creature sem runa. Então consegui chegar nesse código. Eu gostaria de pedir 2 coisas:

     

    1) Que a mana gasta seja de acordo com o custo de mana do monstro. Só consegui fazer custo fixo.

    2) Que tenha limite de 2 "summons"

     

  • Quem Está Navegando   0 membros estão online

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