• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua [Spell] Exori all

yoiker

Member
Joined
Jan 21, 2012
Messages
194
Solutions
1
Reaction score
9
I wish someone could fix this spell to work in tfs 1.2 level and magic level is not much to ask if I would appreciate ..

Code:
local Config = {
Min = 0, 
Max = 0, 
Combo = 50 
}
local test = {
[1]={CONST_ME_ENERGYAREA, CONST_ANI_ENERGY, COMBAT_ENERGYDAMAGE}, 
[2]={CONST_ME_ICEATTACK, CONST_ANI_SMALLICE, COMBAT_ICEDAMAGE}, 
[3]={CONST_ME_MORTAREA, CONST_ANI_SUDDENDEATH, COMBAT_DEATHDAMAGE}, 
[4]={CONST_ME_FIREATTACK, CONST_ANI_FIRE, COMBAT_FIREDAMAGE}, 
[5]={CONST_ME_CARNIPHILA, CONST_ANI_EARTH, COMBAT_EARTHDAMAGE} 
}
local function ComboElectro(param) 
doSendMagicEffect(param.pos, test[1][1])
doSendDistanceShoot(getThingPos(param.cid), param.pos, test[1][2])
doAreaCombatHealth(param.cid, test[1][3], param.pos, 0, -getPlayerMagicLevel(cid)*2, -getPlayerMagicLevel(cid)*4, CONST_ME_NONE)
end
local function ComboTierra(param)
doSendMagicEffect(param.pos, test[5][1])
doSendDistanceShoot(getThingPos(param.cid), param.pos, test[5][2])
doAreaCombatHealth(param.cid, test[5][3], param.pos, 0, -getPlayerMagicLevel(cid)*2, -getPlayerMagicLevel(cid)*4, CONST_ME_NONE)
end
local function ComboDeath(param) 
doSendMagicEffect(param.pos, test[3][1])
doSendDistanceShoot(getThingPos(param.cid), param.pos, test[3][2])
doAreaCombatHealth(param.cid, test[3][3], param.pos, 0, -getPlayerMagicLevel(cid)*2, -getPlayerMagicLevel(cid)*4, CONST_ME_NONE)
end
local function ComboHielo(param)
doSendMagicEffect(param.pos, test[2][1])
doSendDistanceShoot(getThingPos(param.cid), param.pos, test[2][2])
doAreaCombatHealth(param.cid, test[2][3], param.pos, 0, -getPlayerMagicLevel(cid)*2, -getPlayerMagicLevel(cid)*4, CONST_ME_NONE)
end
local function ComboFuego(param) 
doSendMagicEffect(param.pos, test[4][1])
doSendDistanceShoot(getThingPos(param.cid), param.pos, test[4][2])
doAreaCombatHealth(param.cid, test[4][3], param.pos, 0, -getPlayerMagicLevel(cid)*2, -getPlayerMagicLevel(cid)*4, CONST_ME_NONE)
end
function spellCallback(param)
local p = test[math.random(#test)]
if math.random(1,50) == 1 then
ComboElectro (param)
addEvent (ComboTierra, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboElectro (param)
addEvent (ComboFuego, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboElectro (param)
addEvent (ComboDeath, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboElectro (param)
addEvent (ComboHielo, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboTierra (param)
addEvent (ComboHielo, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboTierra (param)
addEvent (ComboFuego, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboTierra (param)
addEvent (ComboDeath, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboTierra (param)
addEvent (ComboElectro, Config.Combo, param)
else
doSendMagicEffect(param.pos, p[1])
doSendDistanceShoot(getThingPos(param.cid), param.pos, p[2])
doAreaCombatHealth(param.cid, p[3], param.pos, 0, -getPlayerMagicLevel(cid)*2, -getPlayerMagicLevel(cid)*1, CONST_ME_NONE)
end
end
function onTargetTile(cid, pos)
local param = {}
param.cid = cid
param.pos = pos
spellCallback(param)
end
local combat = createCombatObject()
setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end

Please!
 
Such a messy script, would help if the script actually worked.
For instance, you can't have multiple conditions check if a random number is all equal to the same number.
Code:
elseif math.random(1,50) == 50 then
This means only 1 of the 1st two conditions will only have a chance to execute based on the random number or the else statement will execute so all those conditions you defined in between will never see the light of day.

Now I understand you did not write this script, you may have copy and pasted some of it from itself or someone else handed this to you.

Now it should work, (but not for 1.2).
Code:
local test = {
    [1] = { -- test[1]
        CONST_ME_ENERGYAREA,    -- test[1][1]
        CONST_ANI_ENERGY,        -- test[1][2]
        COMBAT_ENERGYDAMAGE        -- test[1][3]
    },
    [2] = { -- test[2]
        CONST_ME_ICEATTACK,        -- test[2][1]
        CONST_ANI_SMALLICE,        -- test[2][2]
        COMBAT_ICEDAMAGE        -- test[2][3]
    },
    [3] = { -- test[3]
        CONST_ME_MORTAREA,        -- test[3][1]
        CONST_ANI_SUDDENDEATH,    -- test[3][2]
        COMBAT_DEATHDAMAGE        -- test[3][3]
    },
    [4] = { -- test[4]
        CONST_ME_FIREATTACK,    -- test[4][1]
        CONST_ANI_FIRE,            -- test[4][2]
        COMBAT_FIREDAMAGE        -- test[4][3]
    },
    [5] = { -- test[5]
        CONST_ME_CARNIPHILA,    -- test[5][1]
        CONST_ANI_EARTH,        -- test[5][2]
        COMBAT_EARTHDAMAGE        -- test[5][3]
    }
}

local combat = createCombatObject()

function _random(v)
    return math.random(v)
end

function callBack(x)
    local position, cid, magicLevel = x.pos, x.cid, getPlayerMagicLevel(x.cid)
    local index = x.index > #test and _random(#test) or x.index
    doSendMagicEffect(position, test[index][1])
    doSendDistanceShoot(getThingPos(cid), position, test[index][2])
    doAreaCombatHealth(cid, test[index][3], position, 0, -magicLevel * 2, -magicLevel * (x.index > #test and 2 or 4), CONST_ME_NONE)
end

function onTargetTile(cid, pos)
    callBack({cid = cid, pos = pos, index = _random(#test + 1) })
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")


function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
Changed the scope of _random.
 
Last edited:
Such a messy script, would help if the script actually worked.
For instance, you can't have multiple conditions check if a random number is all equal to the same number.
Code:
elseif math.random(1,50) == 50 then
This means only 1 of the 1st two conditions will only have a chance to execute based on the random number or the else statement will execute so all those conditions you defined in between will never see the light of day.

Now I understand you did not write this script, you may have copy and pasted some of it from itself or someone else handed this to you.

Now it should work, (but not for 1.2).
Code:
local test = {
    [1] = { -- test[1]
        CONST_ME_ENERGYAREA,    -- test[1][1]
        CONST_ANI_ENERGY,        -- test[1][2]
        COMBAT_ENERGYDAMAGE        -- test[1][3]
    },
    [2] = { -- test[2]
        CONST_ME_ICEATTACK,        -- test[2][1]
        CONST_ANI_SMALLICE,        -- test[2][2]
        COMBAT_ICEDAMAGE        -- test[2][3]
    },
    [3] = { -- test[3]
        CONST_ME_MORTAREA,        -- test[3][1]
        CONST_ANI_SUDDENDEATH,    -- test[3][2]
        COMBAT_DEATHDAMAGE        -- test[3][3]
    },
    [4] = { -- test[4]
        CONST_ME_FIREATTACK,    -- test[4][1]
        CONST_ANI_FIRE,            -- test[4][2]
        COMBAT_FIREDAMAGE        -- test[4][3]
    },
    [5] = { -- test[5]
        CONST_ME_CARNIPHILA,    -- test[5][1]
        CONST_ANI_EARTH,        -- test[5][2]
        COMBAT_EARTHDAMAGE        -- test[5][3]
    }
}

local combat = createCombatObject()

function _random(v)
    return math.random(v)
end

function callBack(x)
    local position, cid, magicLevel = x.pos, x.cid, getPlayerMagicLevel(x.cid)
    local index = x.index > #test and _random(#test) or x.index
    doSendMagicEffect(position, test[index][1])
    doSendDistanceShoot(getThingPos(cid), position, test[index][2])
    doAreaCombatHealth(cid, test[index][3], position, 0, -magicLevel * 2, -magicLevel * (x.index > #test and 2 or 4), CONST_ME_NONE)
end

function onTargetTile(cid, pos)
    callBack({cid = cid, pos = pos, index = _random(#test + 1) })
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")


function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
Changed the scope of _random.

Perfect, this weekend I have time to use the computer prove your script weekdays only study and do not have time to play. Thank you very much for your answer!
 
Such a messy script, would help if the script actually worked.
For instance, you can't have multiple conditions check if a random number is all equal to the same number.
Code:
elseif math.random(1,50) == 50 then
This means only 1 of the 1st two conditions will only have a chance to execute based on the random number or the else statement will execute so all those conditions you defined in between will never see the light of day.

Now I understand you did not write this script, you may have copy and pasted some of it from itself or someone else handed this to you.

Now it should work, (but not for 1.2).
Code:
local test = {
    [1] = { -- test[1]
        CONST_ME_ENERGYAREA,    -- test[1][1]
        CONST_ANI_ENERGY,        -- test[1][2]
        COMBAT_ENERGYDAMAGE        -- test[1][3]
    },
    [2] = { -- test[2]
        CONST_ME_ICEATTACK,        -- test[2][1]
        CONST_ANI_SMALLICE,        -- test[2][2]
        COMBAT_ICEDAMAGE        -- test[2][3]
    },
    [3] = { -- test[3]
        CONST_ME_MORTAREA,        -- test[3][1]
        CONST_ANI_SUDDENDEATH,    -- test[3][2]
        COMBAT_DEATHDAMAGE        -- test[3][3]
    },
    [4] = { -- test[4]
        CONST_ME_FIREATTACK,    -- test[4][1]
        CONST_ANI_FIRE,            -- test[4][2]
        COMBAT_FIREDAMAGE        -- test[4][3]
    },
    [5] = { -- test[5]
        CONST_ME_CARNIPHILA,    -- test[5][1]
        CONST_ANI_EARTH,        -- test[5][2]
        COMBAT_EARTHDAMAGE        -- test[5][3]
    }
}

local combat = createCombatObject()

function _random(v)
    return math.random(v)
end

function callBack(x)
    local position, cid, magicLevel = x.pos, x.cid, getPlayerMagicLevel(x.cid)
    local index = x.index > #test and _random(#test) or x.index
    doSendMagicEffect(position, test[index][1])
    doSendDistanceShoot(getThingPos(cid), position, test[index][2])
    doAreaCombatHealth(cid, test[index][3], position, 0, -magicLevel * 2, -magicLevel * (x.index > #test and 2 or 4), CONST_ME_NONE)
end

function onTargetTile(cid, pos)
    callBack({cid = cid, pos = pos, index = _random(#test + 1) })
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")


function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
Changed the scope of _random.

Release two errors
Does not recognize getPlayerMagicLevel
line 36 'callback' line 44 and 43
 
Such a messy script, would help if the script actually worked.
For instance, you can't have multiple conditions check if a random number is all equal to the same number.
Code:
elseif math.random(1,50) == 50 then
This means only 1 of the 1st two conditions will only have a chance to execute based on the random number or the else statement will execute so all those conditions you defined in between will never see the light of day.

Now I understand you did not write this script, you may have copy and pasted some of it from itself or someone else handed this to you.

Now it should work, (but not for 1.2).
Code:
local test = {
    [1] = { -- test[1]
        CONST_ME_ENERGYAREA,    -- test[1][1]
        CONST_ANI_ENERGY,        -- test[1][2]
        COMBAT_ENERGYDAMAGE        -- test[1][3]
    },
    [2] = { -- test[2]
        CONST_ME_ICEATTACK,        -- test[2][1]
        CONST_ANI_SMALLICE,        -- test[2][2]
        COMBAT_ICEDAMAGE        -- test[2][3]
    },
    [3] = { -- test[3]
        CONST_ME_MORTAREA,        -- test[3][1]
        CONST_ANI_SUDDENDEATH,    -- test[3][2]
        COMBAT_DEATHDAMAGE        -- test[3][3]
    },
    [4] = { -- test[4]
        CONST_ME_FIREATTACK,    -- test[4][1]
        CONST_ANI_FIRE,            -- test[4][2]
        COMBAT_FIREDAMAGE        -- test[4][3]
    },
    [5] = { -- test[5]
        CONST_ME_CARNIPHILA,    -- test[5][1]
        CONST_ANI_EARTH,        -- test[5][2]
        COMBAT_EARTHDAMAGE        -- test[5][3]
    }
}

local combat = createCombatObject()

function _random(v)
    return math.random(v)
end

function callBack(x)
    local position, cid, magicLevel = x.pos, x.cid, getPlayerMagicLevel(x.cid)
    local index = x.index > #test and _random(#test) or x.index
    doSendMagicEffect(position, test[index][1])
    doSendDistanceShoot(getThingPos(cid), position, test[index][2])
    doAreaCombatHealth(cid, test[index][3], position, 0, -magicLevel * 2, -magicLevel * (x.index > #test and 2 or 4), CONST_ME_NONE)
end

function onTargetTile(cid, pos)
    callBack({cid = cid, pos = pos, index = _random(#test + 1) })
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")


function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
Changed the scope of _random.

Look, this is the magic in its original state is working properly what I want it to be magic level by level and damage

Code:
local Config = {
Min = 10, 
Max = 30,
Combo = 30
               }
local Test = {
  [1]={CONST_ME_ENERGYAREA, CONST_ANI_ENERGY, COMBAT_ENERGYDAMAGE}, -- Energy Stricke.
  [2]={CONST_ME_ICEATTACK, CONST_ANI_SMALLICE, COMBAT_ICEDAMAGE}, -- Ice Stricke.
  [3]={CONST_ME_MORTAREA, CONST_ANI_SUDDENDEATH, COMBAT_DEATHDAMAGE}, -- Death Stricke.
  [4]={CONST_ME_FIREATTACK, CONST_ANI_FIRE, COMBAT_FIREDAMAGE}, -- Flame Stricke.
  [5]={CONST_ME_CARNIPHILA, CONST_ANI_EARTH, COMBAT_EARTHDAMAGE} -- Terra Stricke.
               }
local function ComboElectro(param) -- Energy Stricke.
  doSendMagicEffect(param.pos, Test[1][1])
  doSendDistanceShoot(getThingPos(param.cid), param.pos, Test[1][2])
  doAreaCombatHealth(param.cid, Test[1][3], param.pos, 0, -Config.Min, -Config.Max, CONST_ME_NONE)
end
local function ComboTierra(param) -- Terra Stricke.
  doSendMagicEffect(param.pos, Test[5][1])
  doSendDistanceShoot(getThingPos(param.cid), param.pos, Test[5][2])
  doAreaCombatHealth(param.cid, Test[5][3], param.pos, 0, -Config.Min, -Config.Max, CONST_ME_NONE)
end
local function ComboDeath(param) -- Death Stricke.
  doSendMagicEffect(param.pos, Test[3][1])
  doSendDistanceShoot(getThingPos(param.cid), param.pos, Test[3][2])
  doAreaCombatHealth(param.cid, Test[3][3], param.pos, 0, -Config.Min, -Config.Max, CONST_ME_NONE)
end
local function ComboHielo(param) -- Ice Stricke.
  doSendMagicEffect(param.pos, Test[2][1])
  doSendDistanceShoot(getThingPos(param.cid), param.pos, Test[2][2])
  doAreaCombatHealth(param.cid, Test[2][3], param.pos, 0, -Config.Min, -Config.Max, CONST_ME_NONE)
end
local function ComboFuego(param) -- Flame Stricke.
  doSendMagicEffect(param.pos, Test[4][1])
  doSendDistanceShoot(getThingPos(param.cid), param.pos, Test[4][2])
  doAreaCombatHealth(param.cid, Test[4][3], param.pos, 0, -Config.Min, -Config.Max, CONST_ME_NONE)
end
function spellCallback(param)
local p = Test[math.random(#Test)]
if math.random(1,50) == 1 then
ComboElectro (param)
addEvent (ComboTierra, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboElectro (param)
addEvent (ComboFuego, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboElectro (param)
addEvent (ComboDeath, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboElectro (param)
addEvent (ComboHielo, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboTierra (param)
addEvent (ComboHielo, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboTierra (param)
addEvent (ComboFuego, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboTierra (param)
addEvent (ComboDeath, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboDeath (param)
ComboDeath (param)
addEvent (ComboDeath, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboHielo (param)
ComboHielo (param)
addEvent (ComboHielo, Config.Combo, param)
elseif math.random(1,50) == 50 then
ComboTierra (param)
addEvent (ComboElectro, Config.Combo, param)
    else
      doSendMagicEffect(param.pos, p[1])
      doSendDistanceShoot(getThingPos(param.cid), param.pos, p[2])
      doAreaCombatHealth(param.cid, p[3], param.pos, 0, -Config.Min, -Config.Max, CONST_ME_NONE)
    end
end
function onTargetTile(cid, pos)
  local param = {}
  param.cid = cid
  param.pos = pos
  spellCallback(param)
end
local combat = createCombatObject()
  setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
function onCastSpell(cid, var)
  return doCombat(cid, combat, var)
end
 
Back
Top