roriscrave
Advanced OT User
- Joined
- Dec 7, 2011
- Messages
- 1,210
- Solutions
- 35
- Reaction score
- 206
Hi, i make one script, that i need to check a storage of Demon, when he have 50% of hp, and set this storage to 1:
but i get this error:
its not possible to set a storage to a monster?
I need to demon summon 5 fire elementals, when he have 50% hp, and summon only 1x
LUA:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
local health, maxHealth = creature:getHealth(), creature:getMaxHealth()
local percent = health/maxHealth * 100
if percent <= 50 and creature:getStorageValue(4954) ~= 1 then
creature:setStorageValue(4954, 1)
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
but i get this error:
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/test.lua:onHealthChange
data/creaturescripts/scripts/test.lua:4: attempt to call method 'getStorageValue' (a nil value)
stack traceback:
[C]: in function 'getStorageValue'
data/creaturescripts/scripts/test.lua:4: in function <data/creaturescripts/scripts/test.lua:1>
[C]: at 0x7ff79dda00d0
its not possible to set a storage to a monster?
I need to demon summon 5 fire elementals, when he have 50% hp, and summon only 1x