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

[Request]New base healing.

Dilio

Owner of Project Thala
Joined
Jun 8, 2008
Messages
188
Reaction score
7
Location
London, Ontario
Hi there. Well, I am currently using the new Base Healing, and I cannot figure out why I keep getting this error.

Error:
Code:
[16/06/2009 21:57:24] Lua Script Error: [Spell Interface] 
[16/06/2009 21:57:25] data/spells/scripts/healing/light healing.lua:onCastSpell

[16/06/2009 21:57:25] data/spells/scripts/healing/light healing.lua:16: bad argument #2 to 'random' (interval is empty)
[16/06/2009 21:57:25] stack traceback:
[16/06/2009 21:57:25] 	[C]: in function 'random'
[16/06/2009 21:57:25] 	data/spells/scripts/healing/light healing.lua:16: in function 'createFormula'
[16/06/2009 21:57:25] 	data/spells/scripts/healing/light healing.lua:3: in function <data/spells/scripts/healing/light healing.lua:1>

Here's my spell script:
Code:
function onCastSpell(cid, var)
	if getCreatureHealth(cid) ~= getCreatureMaxHealth(cid) then
		local heal = createFormula(cid, 0.5, 30, 0.6, 0)
		doCreatureAddHealth(cid, heal)
                doSendAnimatedText(getPlayerPosition(cid), heal, 66)
    end
    doSendMagicEffect(getPlayerPosition(cid), 12)  
    doRemoveCondition(cid, CONDITION_PARALYZE)
	return TRUE
end  

function createFormula(cid, min1, minRem, max1, maxRem)
    local base = ((getPlayerLevel(cid) * 2) + (getPlayerMagLevel(cid) * 3)) 
    local value = math.random(base * min1 + minRem, base * max1 + maxRem) 
    return math.min(value, getCreatureMaxHealth(cid) - getCreatureHealth(cid)) 
end

The problem is, I can cast it on a normal character on my account, but then any other player tries to cast it on their character, and it gets that error.

Thanks in advance.

Edit: I've managed to figure out the problem lies within the 2nd value of math.random, but even after rescripting the spell 30 different ways, it still hasn't been resolved.
 
Last edited:
Back
Top