Created on by DiNaSoR

Lava damage

Hello, this is a small tutorial giving back to the awesome Moddota community.

Today we going to create Lava area when a hero step on that lava he will get damaged per sec until he die.

First you need to create a block and assign trigger texture to it

Then convert the mesh to Entity and name it plus assign this Entity script to lavatrigger.lua <-- you can name it whatever you want.

next we go to Outputs tabs in top and click on it add the following in the picture.

Now go to your vscript folder and create a file called lavatrigger.lua and put this script inside.

local LAVA_DAMAGE_TICK_RATE = 2
local LAVA_DAMAGE_AMOUNT = 100
function lavatrigger(trigger)
local ent = trigger.activator
if not ent then return end
local hp = ent:GetHealth()
if hp >= LAVA_DAMAGE_AMOUNT then
ent:SetHealth(hp - LAVA_DAMAGE_AMOUNT)
else
ent:ForceKill(true)
end
return LAVA_DAMAGE_TICK_RATE
end

here is the final result!😄

NOTE We can spice this a little bit with particles effect and sound will explain that next time.