• 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 doTargetCombatHealth(...) bug

Aeronx

Intermediate OT User
Joined
Dec 17, 2015
Messages
745
Solutions
9
Reaction score
125
Hello otlanders!

I've been doing so much testing with doTargetCombatHealth(), and I dont know if its a bug, intended, and if there's a work around for it.

So far, this is the basic mass healing spell.
LUA:
function onTargetCreature(creature, target)
    local player = creature:getPlayer()
    local min = ((player:getLevel() / 5) + (player:getMagicLevel() * 4.6) + 100)
    local max = ((player:getLevel() / 5) + (player:getMagicLevel() * 9.6) + 125)

    local master = target:getMaster()
    if target:isMonster() and not master or master and master:isMonster() then
        return true
    end

    doTargetCombatHealth(0, target, COMBAT_HEALING, min, max, CONST_ME_NONE)
    return true
end

local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))
combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end

So, if you register on 2 players a creaturescript, something like this:

LUA:
function onHealthChange(creature, attacker, ...)    
     print(attacker:getName() .. " heals " .. creature:getName())
end

You can easily print the creature that recives the healing, but you wont get any attacker (the player casting the mass healing spell in this case)

so, this bring back my question from before.. is this intended? its a bug? any way around it?
Thank you in advance!

NOTE: tested doTargetCombatHealth(creature:getId(),...) aswell, so thats not it :p
 
Last edited:
That means its COMBAT_PARAM_AGGRESSIVE its false by default, or am i mistaken? Just by adding COMBAT_PARAM_AGGRESSIVE, true, should fix the problem. But it didnt hehe

Correct me if im mistaken. Thank you guys for your time!
 
Back
Top