Ir para conteúdo
  • Cadastre-se

(Resolvido)Ajuda calculo de mana gasta spell


Ir para solução Resolvido por Snowsz,

Posts Recomendados

Queria modificar o "exori" pra ele gastar mana de acordo com o lvl do jogador

3*lvl

 

Tipo se o cara for lvl 30 ele gasta 90 de mana, simples :P

 

    <instant name="Berserk" words="exori" maglv="5" lvl="35" prem="0" needweapon="1" exhaustion="2000" needlearn="1" event="script" value="attack/berserk.lua">
        <vocation id="4"/>
        <vocation id="8"/>
    </instant>

 

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill + attack, level / 5
    return -(skillTotal * 0.5 + levelTotal), -(skillTotal * 2.5 + levelTotal)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
 
Link para o post
Compartilhar em outros sites

 

Queria modificar o "exori" pra ele gastar mana de acordo com o lvl do jogador

3*lvl

 

Tipo se o cara for lvl 30 ele gasta 90 de mana, simples :P

    <instant name="Berserk" words="exori" maglv="5" lvl="35" prem="0" needweapon="1" exhaustion="2000" needlearn="1" event="script" value="attack/berserk.lua">
        <vocation id="4"/>
        <vocation id="8"/>
    </instant>
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill + attack, level / 5
    return -(skillTotal * 0.5 + levelTotal), -(skillTotal * 2.5 + levelTotal)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
 

Usa esse script, na primeira linha você modifica quanto de mana por level será gasto:

 

local manaporlevel = 50

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill + attack, level / 5
    return -(skillTotal * 0.5 + levelTotal), -(skillTotal * 2.5 + levelTotal)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
    if getPlayerMana(cid) >= (getPlayerLevel(cid)*manaporlevel) then
        doPlayerAddManaSpent(cid, -(getPlayerLevel(cid)*manaporlevel))
        return doCombat(cid, combat, var)
    end
    return doPlayerSendCancel(cid, "You don't have mana. ["..tostring(getPlayerLevel(cid)*manaporlevel).."]")
end
 
                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

Link para o post
Compartilhar em outros sites

 

Usa esse script, na primeira linha você modifica quanto de mana por level será gasto:

 

local manaporlevel = 50

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill + attack, level / 5
    return -(skillTotal * 0.5 + levelTotal), -(skillTotal * 2.5 + levelTotal)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
    if getPlayerMana(cid) >= (getPlayerLevel(cid)*manaporlevel) then
        doPlayerAddManaSpent(cid, -(getPlayerLevel(cid)*manaporlevel))
        return doCombat(cid, combat, var)
    end
    return doPlayerSendCancel(cid, "You don't have mana. ["..tostring(getPlayerLevel(cid)*manaporlevel).."]")
end
 

 

 

Deu ruim brodi

local manaporlevel = 3

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, maglevel)
    min = ( (maglevel * 30) * 0.5 ) * -1
    max = ( (maglevel * 30) * 1.0 ) * -1
    return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
    if getPlayerMana(cid) >= (getPlayerLevel(cid)*manaporlevel) then
        doPlayerAddManaSpent(cid, -(getPlayerLevel(cid)*manaporlevel))
        return doCombat(cid, combat, var)
    end
    return doPlayerSendCancel(cid, "You don't have mana. ["..tostring(getPlayerLevel(cid)*manaporlevel).."]")
end

 

jSdFWgv.png

Link para o post
Compartilhar em outros sites
  • Solução

Deu ruim brodi

local manaporlevel = 3

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, maglevel)
    min = ( (maglevel * 30) * 0.5 ) * -1
    max = ( (maglevel * 30) * 1.0 ) * -1
    return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
    if getPlayerMana(cid) >= (getPlayerLevel(cid)*manaporlevel) then
        doPlayerAddManaSpent(cid, -(getPlayerLevel(cid)*manaporlevel))
        return doCombat(cid, combat, var)
    end
    return doPlayerSendCancel(cid, "You don't have mana. ["..tostring(getPlayerLevel(cid)*manaporlevel).."]")
end

jSdFWgv.png

local manaporlevel = 3

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, maglevel)
    min = ( (maglevel * 30) * 0.5 ) * -1
    max = ( (maglevel * 30) * 1.0 ) * -1
    return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
    if getPlayerMana(cid) >= (getPlayerLevel(cid)*manaporlevel) then
        doPlayerAddMana(cid, -(getPlayerLevel(cid)*manaporlevel))
        return doCombat(cid, combat, var)
    end
    return doPlayerSendCancel(cid, "You don't have mana. ["..tostring(getPlayerLevel(cid)*manaporlevel).."]")
end
                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

Link para o post
Compartilhar em outros sites
local manaporlevel = 3

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, maglevel)
    min = ( (maglevel * 30) * 0.5 ) * -1
    max = ( (maglevel * 30) * 1.0 ) * -1
    return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
    if getPlayerMana(cid) >= (getPlayerLevel(cid)*manaporlevel) then
        doPlayerAddMana(cid, -(getPlayerLevel(cid)*manaporlevel))
        return doCombat(cid, combat, var)
    end
    return doPlayerSendCancel(cid, "You don't have mana. ["..tostring(getPlayerLevel(cid)*manaporlevel).."]")
end

 

Tyyy

Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo