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

Assistance in a summon healing player script TFS 1.3

Mr Noxi

Noxus Otserver
Joined
May 13, 2010
Messages
272
Solutions
3
Reaction score
94
Location
Sweden
Soo this is my code

Am trying to have the summons i summon to heal the player, am trying to set it to heal 10% of the health of the player but no mater what number i put in i always get 100% of the health back from the summons,

any idea whats wrong here?

Code below

"
Lua:
    local config = {
    condition = "yes", -- put no if you dont want him to remove the conditions (fire, poison, etc).
    }
    
function onThink(cid, target)
if math.random(1, 100) <= 100 then -- here you can edit chance of reciving heal, higher number than 12 = more heal chances
    local master = getCreatureMaster(cid)
    if master then
        local conditions = {CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY, CONDITION_PARALYZE, CONDITION_DRUNK, CONDITION_DROWN, CONDITION_CURSED}
        local party = getPartyMembers(master)
        local pos = getCreaturePosition(master)
        if not getPlayerParty(master) then
            doCreatureAddHealth(master, cid:getMaxHealth() * 0.01)
            doSendMagicEffect(pos, 12)
            if (config.condition == "yes") then
                for i, todos in ipairs(conditions) do
                    doRemoveCondition(master, todos)
                end
            end
            return true
        end
        for _, miembros in pairs(party) do
            doCreatureAddHealth(miembros, config.heal)
            pos = getCreaturePosition(miembros)
            doSendMagicEffect(pos, 12)
            if (config.contidion == "yes") then
                for i, todos in ipairs(conditions) do
                    doRemoveCondition(miembros, todos)
                end
            end
        end
    end
    return true
end
end
 
Solution
ezgif.com-gif-maker(2).gif

Try:
Lua:
local config = {
    removeConditions = true, -- put false if you dont want him to remove the conditions (fire, poison, etc).
    healthAddPercentage = 1/100, -- %
    healChance = 100 -- %
}

function onThink(cid, target)
    if math.random(1, 100) > config.healChance then
        return true
    end

    local master = cid:getMaster()
    if not master then
        return true
    end

    local conditions = {CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY, CONDITION_PARALYZE, CONDITION_DRUNK, CONDITION_DROWN, CONDITION_CURSED}
    local party = master:getParty()
    local pos   = master:getPosition()

    if not party then
        master:addHealth(master:getMaxHealth() * config.healthAddPercentage)...
ezgif.com-gif-maker(2).gif

Try:
Lua:
local config = {
    removeConditions = true, -- put false if you dont want him to remove the conditions (fire, poison, etc).
    healthAddPercentage = 1/100, -- %
    healChance = 100 -- %
}

function onThink(cid, target)
    if math.random(1, 100) > config.healChance then
        return true
    end

    local master = cid:getMaster()
    if not master then
        return true
    end

    local conditions = {CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY, CONDITION_PARALYZE, CONDITION_DRUNK, CONDITION_DROWN, CONDITION_CURSED}
    local party = master:getParty()
    local pos   = master:getPosition()

    if not party then
        master:addHealth(master:getMaxHealth() * config.healthAddPercentage)
        pos:sendMagicEffect(12)
        if (config.removeConditions) then
            for i, todos in ipairs(conditions) do
                doRemoveCondition(master, todos)
            end
        end
        return true
    end

    for _, member in pairs(party:getMembers()) do
        member:addHealth(member:getMaxHealth() * config.healthAddPercentage)
        member:getPosition():sendMagicEffect(12)
        if (config.removeContidions) then
            for i, todos in ipairs(conditions) do
                doRemoveCondition(member, todos)
            end
        end
    end

    return true
end
 
Solution
Worked like a charm, i appreciate the help!

U think its possible to add same set up but for mana refill also?
 
Back
Top