• 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!

DMG Spell = (1000000*maglvl)*resets how?

Solution
First:
it shouldn't be like this:
Code:
return (5000000)*getPlayerResets(name),(5100000)*getPlayerResets(name)
but rather like this(this function expecting name right?):
Code:
return (5000000)*getPlayerResets(getCreatureName(cid)),(5100000)*getPlayerResets(getCreatureName(cid))

Second:
using high numbers like 5000000 or 1000000 while doing multiplication to them can easily overflow int32_t data range which is 2147483647 and then you will have negative value which will turn the dmg into healing

Third:
you should precache the "resets" value because doing mysql query which speed depends on hardware used is not good for performance and can result in lags
I'll just leave it here
Code:
function getPlayerResets(name)           
return db.getResult("SELECT resets FROM players WHERE name="..db.escapeString(name)..""):getDataInt("resets")        
end

getPlayerResets(name)
 
I'll just leave it here
Code:
function getPlayerResets(name)          
return db.getResult("SELECT resets FROM players WHERE name="..db.escapeString(name)..""):getDataInt("resets")       
end

getPlayerResets(name)

Yea i know but it not work me ;/ I try with this function and my spell deals 0 dmg ;/

Code:
-- SpellCreator generated.
function getPlayerResets(name)         
return db.getResult("SELECT resets FROM players WHERE name="..db.escapeString(name)..""):getDataInt("resets")       
end
-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{3}}))
function getDmg_Brush(cid, level, maglevel)
    return (5000000)*getPlayerResets(name),(5100000)*getPlayerResets(name) 
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")local combat0_Brush_2 = createCombatObject()
setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FLAMMINGARROW)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_2,createCombatArea({{0, 1, 0},
{1, 2, 1},
{0, 1, 0}}))
function getDmg_Brush_2(cid, level, maglevel)
    return (5000000)*getPlayerResets(name),(5100000)*getPlayerResets(name) 
end
setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")

-- Areas/Combat for 100ms
local combat1_Brush_3 = createCombatObject()
setCombatParam(combat1_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT)
setCombatParam(combat1_Brush_3, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat1_Brush_3, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatArea(combat1_Brush_3,createCombatArea({{1, 0, 1},
{0, 2, 0},
{1, 0, 1}}))
function getDmg_Brush_3(cid, level, maglevel)
    return (5000000)*getPlayerResets(name),(5100000)*getPlayerResets(name) 
end
setCombatCallback(combat1_Brush_3, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_3")

-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
    if (isCreature(cid)) then
        doCombat(cid, c, var)
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
                i = i + 2
            end       
        end
    end
end

function onCastSpell(cid, var)
    local startPos = getCreaturePosition(cid)
    RunPart(combat0_Brush,cid,var)
    RunPart(combat0_Brush_2,cid,var)
    addEvent(RunPart,100,combat1_Brush_3,cid,var)
    return true
end
 
First:
it shouldn't be like this:
Code:
return (5000000)*getPlayerResets(name),(5100000)*getPlayerResets(name)
but rather like this(this function expecting name right?):
Code:
return (5000000)*getPlayerResets(getCreatureName(cid)),(5100000)*getPlayerResets(getCreatureName(cid))

Second:
using high numbers like 5000000 or 1000000 while doing multiplication to them can easily overflow int32_t data range which is 2147483647 and then you will have negative value which will turn the dmg into healing

Third:
you should precache the "resets" value because doing mysql query which speed depends on hardware used is not good for performance and can result in lags
 
Solution
First:
it shouldn't be like this:
Code:
return (5000000)*getPlayerResets(name),(5100000)*getPlayerResets(name)
but rather like this(this function expecting name right?):
Code:
return (5000000)*getPlayerResets(getCreatureName(cid)),(5100000)*getPlayerResets(getCreatureName(cid))

Second:
using high numbers like 5000000 or 1000000 while doing multiplication to them can easily overflow int32_t data range which is 2147483647 and then you will have negative value which will turn the dmg into healing

Third:
you should precache the "resets" value because doing mysql query which speed depends on hardware used is not good for performance and can result in lags

Okey thanks :D I have one more question, how to add dmg*mlvl?

return (5000000*maglvl)? or what
 
Back
Top