Original Post
In an utopian world, game logic is written like this: As you probably all know, in reality it doesn't work like this. The problem is that the game state is evaluated every frame, so you'd have to make a state machine to make this kind of behaviour. edit: this counts especially for the FindNearestEnemy() and FireAt() commands, which take at least several frames to execute. It seems like scripting is a viable option, but what kind of scripting languages would supply this behaviour? (Ie, a command that takes multiple frames). And how is this implemented? Thanks for any help, and apologies if my description is a bit unclear, ask me and I'll try to elaborate.
Enemy *myEnemy;
while (!dead)
{
myEnemy = FindNearestEnemy();
MoveWithinRange(myEnemy->location, 10);
FireAt(myEnemy);
if (dead)
{
Say("Did j00 killed teh mighty AI!");
Respawn(locations[rand()%10]);
}
}