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

Traning monk regen Soul

drafenous

New Member
Joined
Nov 8, 2017
Messages
7
Reaction score
1
Hi There!
I'm trying to make my Training Monks to regen a player soul points every 2 minutes hitting.
But I dont know why, then just regenerating 2 points and stop... Anybody can help me?

In data/events/scripts/creature.lua i have writed this lines:

Lua:
local soulBonus = {
    target = 'Training Monk',
    period = 120000, -- time on miliseconds
    events = {}
}

local soulCondition = Condition(CONDITION_SOUL, CONDITIONID_DEFAULT)
soulCondition:setTicks(4 * 60 * 1000)
soulCondition:setParameter(CONDITION_PARAM_SOULGAIN, 1)

local function addSoul(name)
    local player = Player(name)
    if not player then
        soulBonus.events[name] = nil
    else
        local target = player:getTarget()
        if not target or target:getName() ~= soulBonus.target then
            soulBonus.events[name] = nil
        else
            local vocation = player:getVocation()
            if player:getSoul() < vocation:getMaxSoul() then
                soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000)
                player:addCondition(soulCondition)
            end
        end
    end
end

And in same file, on Creature: onTargetCombat(target) function, i writed this lines:

Lua:
    if self:isPlayer() then
        if target and target:getName() == soulBonus.target then
            local name = self:getName()
            if not soulBonus.events[name] then
                soulBonus.events[name] = addEvent(addSoul, soulBonus.period, name)
            end
        end
    end

Thanks for helping, have a good week.
 
Last edited:
You can try this one, I just tested it and it works properly for 1.2/1.3
 
Back
Top