Hi,
I'm trying to make this spells work, but I'm having problem with syntax.
I'm trying to make this spells work, but I'm having problem with syntax.
Lua:
local time = 20 * 1000 -- 20 seconds
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_STAT_MAXHITPOINTS, gainedHealth)
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 maxHealth = player:getMaxHealth()
local gainedHealth = (maxHealth / 2) -- how much health the player will get
combat:execute(creature, variant, player)
return true
end
I tried to call "player" inside the function, but still not recognizing. Can somebody explain it to me?Lua Script Error: [Spell Interface]
data/spells/scripts/increasehealth.luanCastSpell
data/spells/scripts/increasehealth.lua:15: attempt to index local 'player' (a nil value)
stack traceback:
[C]: in function '__index'
data/spells/scripts/increasehealth.lua:15: in function <data/spells/scripts/increasehealth.lua:14>