Hello guys, I have this script and don't remember where I get it, but I'm trying to edit one thing on it, but the way I tried, I get error on TFS.
That's the script, it increases 1500 health to my max health points for 5 seconds.
What I want to edit is to increase health according to player max health. Example:
Player has 1000 of max health, so when the player uses the spell, increase 10% of his max health, so it would be 1100 for 5 seconds.
So I tried to do this, but it doesn't "player":
What am I doing wrong?
That's the script, it increases 1500 health to my max health points for 5 seconds.
Lua:
local time = 5 * 1000 -- 5 seconds
local gainedHealth = 1500 -- how much health the player will get
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTS, gainedHealth)
condition:setParameter(CONDITION_PARAM_SKILL_SWORDPERCENT, -150)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
condition:setParameter(CONDITION_PARAM_TICKS, time)
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:addCondition(condition)
function onCastSpell(creature, variant)
combat:execute(creature, variant)
return true
end
What I want to edit is to increase health according to player max health. Example:
Player has 1000 of max health, so when the player uses the spell, increase 10% of his max health, so it would be 1100 for 5 seconds.
So I tried to do this, but it doesn't "player":
Code:
local time = 5 * 1000 -- 5 seconds
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTS, gainedHealth)
condition:setParameter(CONDITION_PARAM_SKILL_SWORDPERCENT, -130)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
condition:setParameter(CONDITION_PARAM_TICKS, time)
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:addCondition(condition)
function onCastSpell(creature, variant, player)
local gainedHealth = player:getMaxHealth() * 2 -- how much health the player will get
combat:execute(creature, variant, player)
return true
end
What am I doing wrong?