I am trying to build a character spell that not only increase the skills (like Blood Rage), but would also start healing the player at less than 50% HP. And as low the HP is, more intense becomes the healing.
I got this after days of trying different strategies:
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, 60000)
condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 135)
condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 50)
condition:setParameter(CONDITION_PARAM_DISABLE_DEFENSE, true)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:addCondition(condition)
isPlayer(cid)
local healthmax = getCreatureMaxHealth(cid)
healing = getCreatureHealth(cid) / getCreatureMaxHealth(cid) *100
local condition = Condition(CONDITION_REGENERATION)
condition:setParameter(CONDITION_PARAM_SUBID, 1)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
condition:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
condition:setParameter(CONDITION_PARAM_HEALTHGAIN, healing)
condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 500)
combat:addCondition(condition)
function onCastSpell(creature, var)
return combat:execute(creature, var)
end
It is working when i set a fixed value for healing per tick, but when i try to use the formula based on the health %. Not working at all, no errors thou.
I have been researching for 3 days already, tried so many different ways, but nothing really fixed it.
I would really appreciate some help with this, some guidance maybe.
Thank you very much.
I got this after days of trying different strategies:
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, 60000)
condition:setParameter(CONDITION_PARAM_SKILL_MELEEPERCENT, 135)
condition:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 50)
condition:setParameter(CONDITION_PARAM_DISABLE_DEFENSE, true)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:addCondition(condition)
isPlayer(cid)
local healthmax = getCreatureMaxHealth(cid)
healing = getCreatureHealth(cid) / getCreatureMaxHealth(cid) *100
local condition = Condition(CONDITION_REGENERATION)
condition:setParameter(CONDITION_PARAM_SUBID, 1)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
condition:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
condition:setParameter(CONDITION_PARAM_HEALTHGAIN, healing)
condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 500)
combat:addCondition(condition)
function onCastSpell(creature, var)
return combat:execute(creature, var)
end
It is working when i set a fixed value for healing per tick, but when i try to use the formula based on the health %. Not working at all, no errors thou.
I have been researching for 3 days already, tried so many different ways, but nothing really fixed it.
I would really appreciate some help with this, some guidance maybe.
Thank you very much.