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:
And in same file, on Creature: onTargetCombat(target) function, i writed this lines:
Thanks for helping, have a good week.
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: