Hello this is my first time here,
I have an issues about NPC especially for Grenade Avoidance.
Let take example:
NPC see grenade near them → They avoid it by going out of range–> The Script work!
but when about to shout because awareness of “Grenade!!”. It’s not working as expected. Here example:
Function GrenadeRun(){
while (true) {
if ( GrenadeDistance < AwareGrenadeRange ) {
//Shout grenade "GRENADE!" script
}
if ( GrenadeDistance < RunGrenadeRange ) {
//Run from grenade
}
yield;
}
}
The script result:
NPC run away from grenade but shout the “grenade!” frame-by-frame. Undesired result.
So i try this way:
Function GrenadeRun(){
while (true) {
if ( GrenadeDistance < AwareGrenadeRange ) {
//Shout grenade "GRENADE!" script
yield WaitForSeconds(1);
}
if ( GrenadeDistance < RunGrenadeRange ) {
//Run from grenade
}
yield;
}
}
The script result: The NPC shout “grenade!” is ok now but need to wait 1 second before start run away from grenade. Undesired result.
Another attempt:
Function GrenadeRun(){
while (true) {
if ( GrenadeDistance < AwareGrenadeRange ) {
//Shout grenade "GRENADE!" script
yield WaitForSeconds(1);
}
}
while (true) {
if ( GrenadeDistance < RunGrenadeRange ) {
//Run from grenade
}
yield;
}
}
The script result: The NPC only shout “GRENADE!” only. Not running from grenade
What i want is the NPC shout “Grenade!” per second and start to run simultaneously.
but i still cant figure it out. Thank you