Jump to content
×
×
  • Create New...
  • 0

Training Spell - Spell usada X vezes vira outra spell


Question

Bom dia !

Eu tenho um script que tentei configurar de uma maneira mas deu erro.

 

Preciso que ele funcione da seguinte maneira: Quando utilizar a magia x vezes ela muda de efeito e aumenta o dano

 

local config = {
    effects_per_level = {
        [1] = 9, -- efeito no [level 1]
        [2] = 2, -- efeito no [level 2]
        [3] = 0 -- efeito no [level 3]
    },
    casts_to_up = 2, -- quantas vezes tem que soltar para alcançar o level 2
    storages = {level = 46890, cast = 46891} -- só modifique se necessário
}
    
local function getPlayerRasenganLevel(cid)
    return getPlayerStorageValue(cid, config.storages.level)
end

local function getPlayerRasenganCasts(cid)
    return getPlayerStorageValue(cid, config.storages.cast) > 0 and getPlayerStorageValue(cid, config.storages.cast) or 0
end

local function doPlayerRasenganUp(cid, round)
    return setPlayerStorageValue(cid, config.storages.cast, getPlayerRasenganCasts(cid) + round)
end

local combat = {}

local i = 1 
combat[i] = createCombatObject()
setCombatParam(combat[i] , COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat[i] , COMBAT_PARAM_EFFECT, config.effects_per_level[i])
local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)
function onGetFormulaValues(cid, level, skill, attack, factor)
	local skillTotal, levelTotal = skill + attack * 2, level / 5
	return -(skillTotal * 1.1 + levelTotal), -(skillTotal * 3 + levelTotal)
    return min, max
end

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

i = 2 
combat[i] = createCombatObject()
setCombatParam(combat[i] , COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat[i] , COMBAT_PARAM_EFFECT, config.effects_per_level[i])
local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)
function onGetFormulaValues(cid, level, skill, attack, factor)
	local skillTotal, levelTotal = skill + attack * 2, level / 5
	return -(skillTotal * 1.2 + levelTotal), -(skillTotal * 4 + levelTotal)
    return min, max
end

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

i = 3 do
combat[i] = createCombatObject()
setCombatParam(combat[i] , COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat[i] , COMBAT_PARAM_EFFECT, config.effects_per_level[i])
local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)
mbatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -1, -1, -1, 1, 1, 1, 1)
function onGetFormulaValues(cid, level, skill, attack, factor)
	local skillTotal, levelTotal = skill + attack * 2, level / 5
	return -(skillTotal * 1.3 + levelTotal), -(skillTotal * 5 + levelTotal)

local condition = createConditionObject(CONDITION_CURSED)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
setCombatCondition(combat, condition)

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

function onCastSpell(cid, var)
    if getPlayerRasenganLevel(cid) == -1 then setPlayerStorageValue(cid, config.storages.level, 1) end
    if getPlayerRasenganLevel(cid) ~= 2 then
        doPlayerRasenganUp(cid, 1)
        local casts, str = getPlayerRasenganCasts(cid), ''
        if casts == 1 then
            str = "First time casting Exori Gran! You need "..config.casts_to_up.." casts to advance to level 2 and improve its power!"
        elseif casts == (config.casts_to_up / 2) then
            str = "You reached 50% on Rasengan level 1. Now you need "..(config.casts_to_up/2).. " casts to advance to level 2."
        elseif casts == config.casts_to_up then
            str = "Congratulations! You advanced the Exori Gran from level 1 to level 2."
            setPlayerStorageValue(cid, config.storages.level, 2)
        end
        if str ~= '' then
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, str)
        end
    end
    return doCombat(cid, combat[getPlayerRasenganLevel(cid)], var)
end



 

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
Em 30/01/2021 em 13:18, Enenra disse:

Bom dia !

Eu tenho um script que tentei configurar de uma maneira mas deu erro.

 

Preciso que ele funcione da seguinte maneira: Quando utilizar a magia x vezes ela muda de efeito e aumenta o dano

 


local config = {
    effects_per_level = {
        [1] = 9, -- efeito no [level 1]
        [2] = 2, -- efeito no [level 2]
        [3] = 0 -- efeito no [level 3]
    },
    casts_to_up = 2, -- quantas vezes tem que soltar para alcançar o level 2
    storages = {level = 46890, cast = 46891} -- só modifique se necessário
}
    
local function getPlayerRasenganLevel(cid)
    return getPlayerStorageValue(cid, config.storages.level)
end

local function getPlayerRasenganCasts(cid)
    return getPlayerStorageValue(cid, config.storages.cast) > 0 and getPlayerStorageValue(cid, config.storages.cast) or 0
end

local function doPlayerRasenganUp(cid, round)
    return setPlayerStorageValue(cid, config.storages.cast, getPlayerRasenganCasts(cid) + round)
end

local combat = {}

local i = 1 
combat[i] = createCombatObject()
setCombatParam(combat[i] , COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat[i] , COMBAT_PARAM_EFFECT, config.effects_per_level[i])
local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)
function onGetFormulaValues(cid, level, skill, attack, factor)
	local skillTotal, levelTotal = skill + attack * 2, level / 5
	return -(skillTotal * 1.1 + levelTotal), -(skillTotal * 3 + levelTotal)
    return min, max
end

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

i = 2 
combat[i] = createCombatObject()
setCombatParam(combat[i] , COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat[i] , COMBAT_PARAM_EFFECT, config.effects_per_level[i])
local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)
function onGetFormulaValues(cid, level, skill, attack, factor)
	local skillTotal, levelTotal = skill + attack * 2, level / 5
	return -(skillTotal * 1.2 + levelTotal), -(skillTotal * 4 + levelTotal)
    return min, max
end

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

i = 3 do
combat[i] = createCombatObject()
setCombatParam(combat[i] , COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat[i] , COMBAT_PARAM_EFFECT, config.effects_per_level[i])
local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)
mbatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -1, -1, -1, 1, 1, 1, 1)
function onGetFormulaValues(cid, level, skill, attack, factor)
	local skillTotal, levelTotal = skill + attack * 2, level / 5
	return -(skillTotal * 1.3 + levelTotal), -(skillTotal * 5 + levelTotal)

local condition = createConditionObject(CONDITION_CURSED)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
setCombatCondition(combat, condition)

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

function onCastSpell(cid, var)
    if getPlayerRasenganLevel(cid) == -1 then setPlayerStorageValue(cid, config.storages.level, 1) end
    if getPlayerRasenganLevel(cid) ~= 2 then
        doPlayerRasenganUp(cid, 1)
        local casts, str = getPlayerRasenganCasts(cid), ''
        if casts == 1 then
            str = "First time casting Exori Gran! You need "..config.casts_to_up.." casts to advance to level 2 and improve its power!"
        elseif casts == (config.casts_to_up / 2) then
            str = "You reached 50% on Rasengan level 1. Now you need "..(config.casts_to_up/2).. " casts to advance to level 2."
        elseif casts == config.casts_to_up then
            str = "Congratulations! You advanced the Exori Gran from level 1 to level 2."
            setPlayerStorageValue(cid, config.storages.level, 2)
        end
        if str ~= '' then
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, str)
        end
    end
    return doCombat(cid, combat[getPlayerRasenganLevel(cid)], var)
end



 

seria possivel fazer um script desse pra poketibia?
ex: depois de usar o move X vezes, upa o skill, ganhando um ponto pra distribuir, diminuir cd, aumentar range, aumentar duração, aumentar dano...

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now