function detect_event()
{
if (event_type == EVENT_DETECT)
{
if(you.gegner == 1) // Bsp. Um nur etwas zu tun wenn es ein Gegner ist.
{
you.health -= 25; // Ziehe dir Leben ab (je nach skill ^^)
ent_playsound(you, sword_hit, 75);
}
}
}
function zuschlagen()
{
var animation_perc = 0; // Animations Fortschritt
while(animation_perc < 50)
{
animation_perc += 10*time_step;
ent_animate(me,"attack",animation_perc,ANM_CYCLE);
wait(1);
}
c_scan(player.x, player.pan, vector(120,120,500),SCAN_ENTS|IGNORE_ME); // Hier checken
while(animation_perc < 100)
{
animation_perc += 10*time_step;
ent_animate(me,"attack",animation_perc,ANM_CYCLE);
wait(1);
}
}
action spieler()
{
player = my;
my.emask |= ENABLE_DETECT;
my.event = scan_event;
}