• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Creaturescripts - attempt to perform arithmetic

Cadyan

Well-Known Member
Joined
Mar 30, 2008
Messages
844
Reaction score
63
How can I fix this? I am using:
-Mystic Spirit 0.2.15 (9.86)
-TFS 1.0 (10.21)

Code:
function onLogin(cid)
local a = getPlayerStorageValue(cid, 10009)
return true
end

local hp = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(hp, CONDITION_PARAM_TICKS, -1)
setConditionParam(hp, CONDITION_PARAM_STAT_MAXHITPOINTS, 0+a)
setConditionParam(hp, CONDITION_PARAM_BUFF, true)

function onLogin(cid)
    doAddCondition(cid, hp)
return true
end

[15/12/2013 04:27:12] Lua Script Error: [Test Interface]
[15/12/2013 04:27:12] data/creaturescripts/scripts/hp.lua
[15/12/2013 04:27:12] data/creaturescripts/scripts/hp.lua:32: attempt to perform arithmetic on global 'a' (a nil value)
[15/12/2013 04:27:12] stack traceback:
[15/12/2013 04:27:12] [C]: in function '__add'
[15/12/2013 04:27:12] data/creaturescripts/scripts/hp.lua:8: in main chunk
[15/12/2013 04:27:12] Warning: [Event::checkScript] Can not load script. /scripts/hp.lua
 
Last edited:
I have been fiddling around with it in attempt to make it work. I am having a hard time, so any help would be appreciated.
 
Last edited:
If you want it so the player has it always just use
Code:
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + getPlayerStorageValue(cid, 10009))
instead of a condition.
 
Back
Top