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

summon get masters dmg

Nokturno

Not a human
Joined
Aug 7, 2009
Messages
563
Solutions
2
Reaction score
401
hello ppl, can someone help me with this.
im stuck trying to figure out how to call master's level and magiclevel values within a monster spell (summon)

dont now if is possible or it is better to do this in a creaturescript event?

I did that formula specting to get the values from the player, but when the monster cast it, theres no dmg, no console errors tho

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)


function onGetFormulaValues(cid)
local master = creature:getMaster()
local dmg1 = (master:getLevel() / 3) + (master:getMagicLevel() * 0.8)
local dmg2 = (master:getLevel() / 3) + (master:getMagicLevel() * 0.9)

-- local level = player:getLevel()
-- local maglevel = player:getMagicLevel()

    min = dmg1
    max = dmg2
    return -min, -max
end


combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")



function onCastSpell(creature, variant)

local target = creature:getTarget()
    if(not target) then
        return false
    end
local endPos = target:getPosition()

   combat:execute(creature, Variant(endPos))

    return true
end
 
Solution
Im pretty sure combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") doesnt apply for monster spells.
You have to do the spell without combat

something like this maybe (not really tested)
Lua:
function onCastSpell(cid, variant)
    local owner = cid:getMaster()
    local target = owner:getTarget()
    local min = (owner:getMagicLevel() / 5) * 1
    local max = (owner:getMagicLevel() / 1) * 2   
    
    doAreaCombatHealth(cid, COMBAT_PHYSICALDAMAGE, target:getPosition(), {1}, -min, -max, CONST_ME_HITAREA)
    return true
end
Lua:
function onGetFormulaValues(cid)
local master = creature:getMaster()

Pretty sure 'creature' doesn't exist in the code up there.

Change cid to creature, or change creature to cid.
 
Im pretty sure combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") doesnt apply for monster spells.
You have to do the spell without combat

something like this maybe (not really tested)
Lua:
function onCastSpell(cid, variant)
    local owner = cid:getMaster()
    local target = owner:getTarget()
    local min = (owner:getMagicLevel() / 5) * 1
    local max = (owner:getMagicLevel() / 1) * 2   
    
    doAreaCombatHealth(cid, COMBAT_PHYSICALDAMAGE, target:getPosition(), {1}, -min, -max, CONST_ME_HITAREA)
    return true
end
 
Solution
Back
Top