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

Lua Change health of summon.

lazarocp

Kryx
Joined
May 3, 2014
Messages
20
Solutions
1
Reaction score
0
Is there any function in tfs 1.2 equivalent to "setHealth ()"

Example usage

Local health = [556]
Monster: setHealth (health)
 
Solution
If you don't want to edit monster's max health at all:
Lua:
local hp = 500
monster:addHealth(hp - monster:getHealth())

If you want to edit max hp in case where the desired value is higher than monster's current max hp:
Lua:
local hp = 500
if hp > monster:getMaxHealth() then
    monster:setMaxHealth(hp)
end
monster:addHealth(hp - monster:getHealth())
If you don't want to edit monster's max health at all:
Lua:
local hp = 500
monster:addHealth(hp - monster:getHealth())

If you want to edit max hp in case where the desired value is higher than monster's current max hp:
Lua:
local hp = 500
if hp > monster:getMaxHealth() then
    monster:setMaxHealth(hp)
end
monster:addHealth(hp - monster:getHealth())
 
Solution
Back
Top