• 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.2 Looking for healing monsters spell

henkas

Well-Known Member
Joined
Jul 8, 2015
Messages
993
Solutions
5
Reaction score
55
Hi im using this healing spell that suppose to heal monsters so like monster healing each other

Lua:
local config = {
    level = 500,
    magicLevel = 300
}
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))
function onTargetCreature(creature, target)
    if creature:isPlayer() or target:isPlayer() or not creature:isFriend(target) then
        return false
    end
    local min = (config.level / 5) + (config.magicLevel * 4.6) + 100
    local max = (config.level / 5) + (config.magicLevel * 9.6) + 125
    doTargetCombatHealth(creature, target, COMBAT_HEALING, min, max, CONST_ME_HEARTS)
    return true
end
combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end
but shit doesnt work
 
Try to add some debug-code to check if it is being called. As an example, it put some prints on your code.


Lua:
local config = {
    level = 500,
    magicLevel = 300
}

local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

function onTargetCreature(creature, target)

    if creature:isPlayer() or target:isPlayer() or not creature:isFriend(target) then
        print('onTargetCreature is returning false')
        return false
    end

    local min = (config.level / 5) + (config.magicLevel * 4.6) + 100
    local max = (config.level / 5) + (config.magicLevel * 9.6) + 125

    doTargetCombatHealth(creature, target, COMBAT_HEALING, min, max, CONST_ME_HEARTS)
    print('onTargetCreature is returning true')
    
    return true
end

combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(creature, variant)
        print('onCastSpellis is being called')
    return combat:execute(creature, variant)
end


Btw, a monster healing other friend one is an interesting idea :)
 
Might be a sources issue...

I had to exit my sources so monstes couldn't hurt each other with spells. Eg having monsters in an area that use fireball spells and not being immune to fire would cause them to kill each other.

Obvious, but you tried just making an AOE type defence spell? Or does this heal the players too?
 
Back
Top