local healMonster = MoveEvent()
healMonster:type("stepin")
function healMonster.onStepIn(creature, item, position, fromPosition)
if not creature:isMonster() then
return true
end
local currentMaxHealth = creature:getMaxHealth()
local healthPercent = currentMaxHealth * 0.1
if creature:getName() == "Dragon" then
creature:addHealth(healthPercent)
position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
end
return true
end
healMonster:id(1000)
healMonster:register()
local healMonster = MoveEvent()
healMonster:type("stepin")
function healMonster.onStepIn(creature, item, position, fromPosition)
if not creature:isMonster() then
return true
end
local currentMaxHealth = creature:getMaxHealth()
local healthPercent = currentMaxHealth * 0.1
if creature:getName() == "Dragon" then
creature:addHealth(healthPercent)
position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
end
return true
end
healMonster:id(1000)
healMonster:register()
It didn't work. No errors shown on TFS either. I add the fire field id and put the script on data/scripts.Change 1000 to firefield id or you can use aid if it's a specific firefield. and calculate this * 0.1 to be the % you need. Also, don't forget the monster's name "Dragon".
Lua:local healMonster = MoveEvent() healMonster:type("stepin") function healMonster.onStepIn(creature, item, position, fromPosition) if not creature:isMonster() then return true end local currentMaxHealth = creature:getMaxHealth() local healthPercent = currentMaxHealth * 0.1 if creature:getName() == "Dragon" then creature:addHealth(healthPercent) position:sendMagicEffect(CONST_ME_MAGIC_BLUE) end return true end healMonster:id(1000) healMonster:register()
You must have done something wrong. I just tested it on my test server and it worked.
View attachment 70909
local healMonster = MoveEvent()
healMonster:type("stepin")
function healMonster.onStepIn(creature, item, position, fromPosition)
if not creature:isMonster() then
return true
end
local currentMaxHealth = creature:getMaxHealth()
local healthPercent = currentMaxHealth * 0.1
if creature:getName() == "Dragon" then
creature:addHealth(healthPercent)
position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
end
return true
end
healMonster:id(1487)
healMonster:register()
function onStepIn(creature, item, position, fromPosition)
if not creature:isMonster() then
return true
end
local currentMaxHealth = creature:getMaxHealth()
local healthPercent = currentMaxHealth * 0.1
if creature:getName() == "Dragon" then
creature:addHealth(healthPercent)
position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
end
return true
end
<movevent event="StepIn" itemid="1487" function="onStepInField" script="scriptname.lua" />
That's why it didn't show for me, I used a different fire field.
Try adding it as a movement script then add it with the existing fire field function.
Lua:function onStepIn(creature, item, position, fromPosition) if not creature:isMonster() then return true end local currentMaxHealth = creature:getMaxHealth() local healthPercent = currentMaxHealth * 0.1 if creature:getName() == "Dragon" then creature:addHealth(healthPercent) position:sendMagicEffect(CONST_ME_MAGIC_BLUE) end return true end
XML:<movevent event="StepIn" itemid="1487" function="onStepInField" script="scriptname.lua" /> <movevent event="AddItem" itemid="1487" function="onAddField" script="scriptname.lua" />