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

Solved Utura Gran like spell

Northnorial

Member
Joined
May 30, 2009
Messages
742
Reaction score
5
Location
Germany
I'm currently using this Utura Gran like spell. Basically a spell that heals over time.

Code:
healRegen = {}

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF_SPELL, true)
setCombatCondition(combat, condition)

function regen(cid,var,n)
n = n or 0
    if isPlayer(cid) then
        doCreatureAddHealth(cid, 500)
        if (n < 20) then
            healRegen[cid] = addEvent(regen, 3000, cid, var, n+1)
        end
    end
return true
end

function onCastSpell(cid, var)
    if healRegen[cid] then
        stopEvent(healRegen[cid])
    end
    doCombat(cid, combat, var)
    healRegen[cid] = addEvent(regen, 250, cid, var, 0)
return true
end

The problem I have is the following, when a player logs out after using the spell I get this error message:
Code:
[01/11/2014  16:47:54] Lua Script Error: [Spell Interface]
[01/11/2014  16:47:54] in a timer event called from:
[01/11/2014  16:47:54] data/spells/scripts/healing/utura gran.lua:onCastSpell

[01/11/2014  16:47:54] luaDoCreatureAddHealth(). Creature not found

I know what it is supposed to mean, but I don't know how to fix it. Haalp plis.
 
Are you still using the same server?
Code:
if isPlayer(cid) == TRUE then

On your server, without == TRUE is just looks if it's not nil or true and this function returns a number 1 (= TRUE) or 0 (= FALSE) and both numbers are not nil.

Also change return true to return TRUE.
 
Back
Top