#cmps_x = old hp stored
#cmps_y = check for hp change
#cmps_z = new hp difference

#copy new hp
#scale new hp by 100 to capture 2 decimals

execute store result storage td.output hp_after float 1 run data get entity @s Health 100
execute store result score @s cmps_y run data get storage td.output hp_after

#if has been hurt=true
execute if score @s cmps_x < @s cmps_y run scoreboard players set #hit_true burst 1

#if hurt=true then run math and rename
execute if score #hit_true burst matches 1 run function survivalplus:tools/trap/dummy/dmgvalue

#get new old hp
#scale new old hp by 100 to capture 2 decimals

execute store result storage td.output hp_before float 1 run data get entity @s Health 100
execute store result score @s cmps_x run data get storage td.output hp_before

#reset if true
scoreboard players reset #hit_true