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

TFS 1.X+ Monster attack damages other monsters

aqubjukr

Well-Known Member
Joined
Mar 13, 2013
Messages
200
Solutions
17
Reaction score
79
Location
Paraná, Brazil
I was wondering if can put in a spell, that a specific creature take damage with the players
Ps: The boss doesn't need to "go attack the monster", I just want the magic given to the player to also remove the monster's health

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DROWNDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)

local area = createCombatArea(AREA_SQUAREWAVE8)
combat:setArea(area)

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

Edit:
As I think it would be correct, but it isn't working:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DROWNDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)

local area = createCombatArea(AREA_SQUAREWAVE8)
combat:setArea(area)

function onTargetCreature(creature, target)

    if target:isMonster() then
        target:addHealth(- 10)
    end

    return true
end

combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end
 
Last edited:
Back
Top