• 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 Spell is kinda buged, HELP please..

Hashirama479

World of Ninja
Joined
Dec 19, 2016
Messages
536
Solutions
6
Reaction score
74
as the title says the spell is kinda buged its working as supposed but theres a small bug, the damage is based on rebirths etc but there are 3 ues but just one of these 3 does damage you know? ( if you dont understand I can explain better xDD :D ) so can someone please fix it? :p im using tfs 0.4 rev3777

Code:
local acombat1 = createCombatObject()
local acombat2 = createCombatObject()
local acombat3 = createCombatObject()
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 43)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, 36)
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 43)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, 36)
local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 43)
setCombatParam(combat3, COMBAT_PARAM_DISTANCEEFFECT, 36)
function onGetFormulaValues(cid, level, maglevel)
local rebirths = getPlayerStorageValue(cid,85987)
local min = (math.floor(level / 4) + level * 2.8 + 50) * rebirths
local max = (math.floor(level / 4) + level * 3.8 + 50) * rebirths
return -min, -max
end

setCombatCallback(combat1, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
setCombatCallback(combat2, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
setCombatCallback(combat3, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")


local arr1 = {
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 3, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
}

local arr2 = { 
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 3, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
}

local arr3 = { 
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 3, 1, 0, 0},
{0, 0, 0, 1, 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)
setCombatArea(acombat1, area1)
setCombatArea(acombat2, area2)
setCombatArea(acombat3, area3)

function onTargetTile(cid, pos)
    doCombat(cid,combat1,positionToVariant(pos))
end
function onTargetTile2(cid, pos)
    doCombat(cid,combat2,positionToVariant(pos))
end
function onTargetTile3(cid, pos)
    doCombat(cid,combat3,positionToVariant(pos))
end

setCombatCallback(acombat1, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
setCombatCallback(acombat2, CALLBACK_PARAM_TARGETTILE, "onTargetTile2")
setCombatCallback(acombat3, CALLBACK_PARAM_TARGETTILE, "onTargetTile3")

local function onCastSpell1(parameters)
    doCombat(parameters.cid, acombat1, parameters.var)
end
local function onCastSpell2(parameters)
    doCombat(parameters.cid, acombat2, parameters.var)
end
local function onCastSpell3(parameters)
    doCombat(parameters.cid, acombat3, parameters.var)
end

function onCastSpell(cid, var)
local parameters = {cid = cid, var = var}
    addEvent(onCastSpell1, 0, parameters)
    addEvent(onCastSpell2, 200, parameters)
    addEvent(onCastSpell3, 400, parameters)
    return true
end
 
Ah yea true uhm hard to explain xD I just post the working spell xD

Code:
local acombat1 = createCombatObject()
local acombat2 = createCombatObject()
local acombat3 = createCombatObject()
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 43)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, 36)
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 43)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, 36)
local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 43)
setCombatParam(combat3, COMBAT_PARAM_DISTANCEEFFECT, 36)
function onGetFormulaValues(cid, level, maglevel)
local rebirths = getPlayerStorageValue(cid,85987)
local min = (math.floor(level / 4) + level * 3.5 + 50) * rebirths
local max = (math.floor(level / 4) + level * 3.8 + 50) * rebirths
return -min, -max
end
function onGetFormulaValues2(cid, level, maglevel)
local rebirths = getPlayerStorageValue(cid,85987)
local min = (math.floor(level / 4) + level * 3.5 + 50) * rebirths
local max = (math.floor(level / 4) + level * 3.8 + 50) * rebirths
return -min, -max
end
function onGetFormulaValues3(cid, level, maglevel)
local rebirths = getPlayerStorageValue(cid,85987)
local min = (math.floor(level / 4) + level * 3.5 + 50) * rebirths
local max = (math.floor(level / 4) + level * 3.8 + 50) * rebirths
return -min, -max
end

setCombatCallback(combat1, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
setCombatCallback(combat2, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues2")
setCombatCallback(combat3, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues3")


local arr1 = {
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 3, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
}

local arr2 = { 
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 3, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
}

local arr3 = { 
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 3, 1, 0, 0},
{0, 0, 0, 1, 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)
setCombatArea(acombat1, area1)
setCombatArea(acombat2, area2)
setCombatArea(acombat3, area3)

function onTargetTile(cid, pos)
    doCombat(cid,combat1,positionToVariant(pos))
end
function onTargetTile2(cid, pos)
    doCombat(cid,combat2,positionToVariant(pos))
end
function onTargetTile3(cid, pos)
    doCombat(cid,combat3,positionToVariant(pos))
end

setCombatCallback(acombat1, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
setCombatCallback(acombat2, CALLBACK_PARAM_TARGETTILE, "onTargetTile2")
setCombatCallback(acombat3, CALLBACK_PARAM_TARGETTILE, "onTargetTile3")

local function onCastSpell1(parameters)
    doCombat(parameters.cid, acombat1, parameters.var)
end
local function onCastSpell2(parameters)
    doCombat(parameters.cid, acombat2, parameters.var)
end
local function onCastSpell3(parameters)
    doCombat(parameters.cid, acombat3, parameters.var)
end

function onCastSpell(cid, var)
local reb = getPlayerStorageValue(cid,85987)
    if reb < 100 then
        doPlayerSendCancel(cid,"You need to be rebirth 100 for this spell!")
        return false
    end
local parameters = {cid = cid, var = var}
    addEvent(onCastSpell1, 0, parameters)
    addEvent(onCastSpell2, 200, parameters)
    addEvent(onCastSpell3, 400, parameters)
    return true
end
 
Ah yea true uhm hard to explain xD I just post the working spell xD

Code:
local acombat1 = createCombatObject()
local acombat2 = createCombatObject()
local acombat3 = createCombatObject()
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 43)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, 36)
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 43)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, 36)
local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 43)
setCombatParam(combat3, COMBAT_PARAM_DISTANCEEFFECT, 36)
function onGetFormulaValues(cid, level, maglevel)
local rebirths = getPlayerStorageValue(cid,85987)
local min = (math.floor(level / 4) + level * 3.5 + 50) * rebirths
local max = (math.floor(level / 4) + level * 3.8 + 50) * rebirths
return -min, -max
end
function onGetFormulaValues2(cid, level, maglevel)
local rebirths = getPlayerStorageValue(cid,85987)
local min = (math.floor(level / 4) + level * 3.5 + 50) * rebirths
local max = (math.floor(level / 4) + level * 3.8 + 50) * rebirths
return -min, -max
end
function onGetFormulaValues3(cid, level, maglevel)
local rebirths = getPlayerStorageValue(cid,85987)
local min = (math.floor(level / 4) + level * 3.5 + 50) * rebirths
local max = (math.floor(level / 4) + level * 3.8 + 50) * rebirths
return -min, -max
end

setCombatCallback(combat1, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
setCombatCallback(combat2, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues2")
setCombatCallback(combat3, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues3")


local arr1 = {
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 3, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
}

local arr2 = {
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 3, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
}

local arr3 = {
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 3, 1, 0, 0},
{0, 0, 0, 1, 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)
setCombatArea(acombat1, area1)
setCombatArea(acombat2, area2)
setCombatArea(acombat3, area3)

function onTargetTile(cid, pos)
    doCombat(cid,combat1,positionToVariant(pos))
end
function onTargetTile2(cid, pos)
    doCombat(cid,combat2,positionToVariant(pos))
end
function onTargetTile3(cid, pos)
    doCombat(cid,combat3,positionToVariant(pos))
end

setCombatCallback(acombat1, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
setCombatCallback(acombat2, CALLBACK_PARAM_TARGETTILE, "onTargetTile2")
setCombatCallback(acombat3, CALLBACK_PARAM_TARGETTILE, "onTargetTile3")

local function onCastSpell1(parameters)
    doCombat(parameters.cid, acombat1, parameters.var)
end
local function onCastSpell2(parameters)
    doCombat(parameters.cid, acombat2, parameters.var)
end
local function onCastSpell3(parameters)
    doCombat(parameters.cid, acombat3, parameters.var)
end

function onCastSpell(cid, var)
local reb = getPlayerStorageValue(cid,85987)
    if reb < 100 then
        doPlayerSendCancel(cid,"You need to be rebirth 100 for this spell!")
        return false
    end
local parameters = {cid = cid, var = var}
    addEvent(onCastSpell1, 0, parameters)
    addEvent(onCastSpell2, 200, parameters)
    addEvent(onCastSpell3, 400, parameters)
    return true
end
if you're creating the same object with the same damage and effects you can just run one 3 times instead of running 3 different ones 1 time with addevent
 
Back
Top