Thanks, **Nathaniel3W and gamepainters. **
Heyya! I am grateful for your replies.
Using Nathaniel3W’s approach there are no more KFZp Accessed None’s when online. But why, I don’t know. I’ll be facing the same problem later, gamepainter, but I hadn’t thought of online replication vs offline in that way thanks for that!
Nathaniel3W, I had tunnel vision in my approach and absolutely your state suggestion works, thank you!
But, I still don’t know where to correctly place the timer - which is due to me not explaining myself properly in the first place.
Sorry, here goes again: The bot has asked the player for ID, and bot’s siren is going.
What I intend:
First option: If the player presents ID, the bot goes away.
Second: if player doesn’t show ID, the bot attacks.
Third, (but actually overriding factor): the bot wait for ID is timed, ie: if no ID shown by the player after a specific time, the bot attacks the player.
So currently in the (hopeful) code below the bot waits 5.0 to be presented with ID before attacking. “Hopeful code” well, this is what happens: All is good if the player shows ID within 5.0. If ID not shown the bot keeps chasing… forever, except if ID is shown. But, even if the player shows ID after 5.0 (as intended, the bot accepts it walks away), but what happens is: 5.0 after that - after bot and player separate - the player is shot. (fyi with a melee gun at a distance way beyond its range).
Well, what can I say, that’s what the amended code below instructs the bot to do. The problem here is with me the coder.
I’ve been trying different things, but the problem remains where to put the timer.
I’m confusing myself separating in my mind loop from timer. I know it’s easy but I can’t see it!!
begin:
GolikeBuggery(); //bot speed 340 so that it chases player. Player default speed = 320.
MoveToward(KFZp, Target); //KFZp = playerPawn
PlaySingleSirenSound();
if(KFZp.bIDShown)
{
KFZShowsID(); // Player shows bot ID, so all is fine, bot moves on
}
else if(!KFZp.bIDShown)
{
sleep(0.1); // low sleep number so the bot doesn't appear visibly halting during MoveToward actions.
setTimer(5.0,false,'KFZNoShowID'); // bot attacks player if ID not shown after 5.0, .
goto 'Begin';
}
}