• 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 Summon spell heal when not attacked

Tampek

ECHO 'Zarkonia.online';
Joined
Dec 29, 2015
Messages
478
Solutions
5
Reaction score
33
Location
Spain
Summon spell for heal creature only when no have fight during X minutes.

Here is script for White pale heal all hp when he go low hp, well i think it can reworked to heal monster when no have fight...

Code:
local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 88888)
setConditionParam(condition, CONDITION_PARAM_TICKS, 15 * 60 * 1000)
setConditionParam(condition, CONDITION_PARAM_HEALTHGAIN, 0.01)
setConditionParam(condition, CONDITION_PARAM_HEALTHTICKS, 15 * 60 * 1000)

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)

    if isCreature(cid) == true and getCreatureName(cid) == "White Pale" then
        if getCreatureCondition(cid, CONDITION_REGENERATION, 88888) == false then
            doAddCondition(cid, condition)
            doCreatureAddHealth(cid, 400)
            return false
        end
    else
        return false
    end
    return true
end

anyone know how rework?
 
Last edited:
I think he means he wants to do a do a SPELL which HEALS THE SUMMON. Could be wrong tho, if so - just mix light healing with onHit Summon.
I completely understand what he wants, but that does not refrain him from reading the rules and obeying them.
 
Code:
local condition = Condition(CONDITION_REGENERATION)
condition:setParameter(CONDITION_PARAM_TICKS, 2 * 60 * 1000) -- when will condition end?
condition:setParameter(CONDITION_PARAM_HEALTHGAIN, 300) -- how many hp every 15 seconds?
condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 15 * 1000) -- 15 sec
 
function onThink(creature)
    if creature:hasCondition(CONDITION_REGENERATION) then
        return false
    end
 
    -- the simpliest idea IMO, is to check for master condition infight, because if summon is in fight, master is too (usually).
    local master = creature:getMaster()
    if master and master:hasCondition(CONDITION_INFIGHT) then
        return false
    end
 
    creature:addCondition(condition)

    return true
end
 
Last edited:
Back
Top