S
SnicketyLemon
Guest
Hey guys, just a heads up: I am new at gamemaker code and this is my first time posting on GMC.
So: im having troubles with getting the enemy characters to say their lines when they switch states from unaware to alert. When they switch to alert state he is supposed to say "enemy sighted!" but I cannot figure out how to word or where to place the code.
Here is where I placed the code:
Heres the code I attempted to use:
I tried moving it all around the code, starting with the bottom, but to no avail :/
Im not sure if the code is even correct, so if anyone has any suggestions, I welcome them!
So: im having troubles with getting the enemy characters to say their lines when they switch states from unaware to alert. When they switch to alert state he is supposed to say "enemy sighted!" but I cannot figure out how to word or where to place the code.
Here is where I placed the code:
Code:
///Are we alert?
if(my_target!=noone)
{
found_him=true;
}
if(my_target!=noone)
{
found_him_timer=0;
}
if(found_him)
{
alert_status=true;
}
if(alert_status&&my_target==noone)
{
found_him_timer++;
}
if(alert_status&&found_him_timer>=200)
{
alert_status=false;
found_him_timer=0;
found_him=false
}
//Follow if we see the player
if(alert_status)
{
patrol=false;
follow=true;
}
//If alert status is cleared, switch to patrol.
if(!alert_status)
{
follow=false;
lb=grid*15;
rb=grid*15;
patrol=true;
}
Code:
//play spot sound
if(found_him&&!alert_status)
{
audio_emitter_pitch(audio_spot_em,1);
audio_play_sound_on(audio_spot_em,sound_spot,0,6);
}
Im not sure if the code is even correct, so if anyone has any suggestions, I welcome them!