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

Lua How to block player heal monster? TFS 1.0

fironfox

New Member
Joined
Dec 14, 2012
Messages
42
Reaction score
1
I need an solution to block players to use spells, runes to heal monster, can make this? if yes, how?
all my attempts not succeed :/
 
Last edited:
CONDITION_PACIFIED
Next time if you say you've made an attempt please provide some examples of what you have tried, code or explanation.

Simply saying you have tried and showing what you have tried are two different aMinals :p
 
Take a look at the code for mass healing, where you can't heal monsters, but players only. It's for 1.2 TFS, dunno if it works for 1.0. Try it.
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

local healMonsters = false

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

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

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

combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end
 
Back
Top