• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Is there a way to convert this script to tfs 0.4 8.60

samuel157

/root
Joined
Mar 19, 2010
Messages
447
Solutions
3
Reaction score
49
Location
São Paulo, Brazil
GitHub
Samuel10M
test spell.gif
Is there a way to convert this script to tfs 0.4 8.60

Lua:
local arrs = {
    {
        {0, 1, 0},
        {1, 2, 1},
        {0, 1, 0}
    },
    
    {
        {0, 1, 1, 1, 0},
        {1, 1, 0, 1, 1},
        {1, 0, 2, 0, 1},
        {1, 1, 0, 1, 1},
        {0, 1, 1, 1, 0}
    },
    
    {
        {0, 0, 1, 0, 1, 0, 0},
        {0, 1, 0, 1, 0, 1, 0},
        {1, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 2, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 1},
        {0, 1, 0, 0, 0, 1, 0},
        {0, 0, 1, 1, 1, 0, 0}
    },
    
    {
        {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
        {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
        {0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0},
        {0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0},
        {1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1},
        {1, 1, 0, 0, 0, 2, 0, 0, 0, 1, 1},
        {1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1},
        {0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0},
        {0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0},
        {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
        {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0}
    }
}

local combat = {}

for i = 1, 4 do
    combat[i] = Combat()
    combat[i]:setParameter(COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
    combat[i]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
    combat[i]:setArea(createCombatArea(arrs[i]))


    function onGetFormulaValues(player, level, magicLevel)
        local min = (level / 5) + (maglevel * 10)
        local max = (level / 5) + (maglevel * 14)
        return -min, -max
    end
    
    function onTargetTile(creature, position)
        creature:getPosition():sendDistanceEffect(position, CONST_ANI_HOLY)
    end
    
    
    combat[i]:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
    combat[i]:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")
end


local function castSpell(creatureId, variant, counter)
    local creature = Creature(creatureId)
    if not creature then
        return
    end
    
    if counter == 0 then
        combat[1]:execute(creature, variant)
    elseif counter == 100 then
        combat[2]:execute(creature, variant)
    elseif counter == 250 then
        combat[3]:execute(creature, variant)
    elseif counter == 500 then
        combat[4]:execute(creature, variant)
    end
    
    if counter < 500 then
        addEvent(castSpell, 50, creatureId, variant, counter + 50)
    end
end

function onCastSpell(creature, variant)
    castSpell(creatureId, variant, 0)
    return true
end
 
Back
Top