Best thing:
use the events event_impact and event_entity of the enemy and check the z value of the you entity:
Code:
function enemy_event()
{
if(event_type == event_impact || event_type == event_entity)
{
if(you == player)
{
if(you.z > my.z) { my.health = 0; }
else { you.health -= my.damage; }
}
}
}
action enemy_act
{
my.enable_impact = on;
my.enable_entity = on;
my.event = enemy_event;
my.health = 100;
my.damage = 5;
while(my.health > 0)
{
// do whatever
}
//Die part:
wait(1);
ent_remove(me);
}