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

TFS 1.X+ tfs 1.2 get Monster storage is possible?

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:

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
 

Similar threads

Back
Top