Page 1 of 1

enemy AI

PostPosted: Sat Oct 13, 2007 11:34 pm
by elite
hi, could someone tell me how to make enemy AI. Because i need the enemy to "wander" around the level and shott you when it sees you. This is a prety advanced question, should i have put this in the advanced forum area? :D
thanks
twigser

Re: enemy AI

PostPosted: Sun Oct 14, 2007 4:17 am
by DilloDude
It really depends on your exact setup. There is no 'universal' AI where you can just tell an enemy what it can do and what it hopes to achieve and it will sort it out. For your situation, I'd would do something based along these lines:
ENEMY:
check health and other important data. Get distance to player. If distance < some value,( turn towards player. Shoot at player if aiming in general direction. ) else move aboout randomly.
Of course you can add other effects (such as weaving about to avoid your shots if you're aiming at him). If you need more help, I can give you some proper code. Just describe the situation and tell me what actor variables you have available.

Re: enemy AI

PostPosted: Sun Oct 14, 2007 6:16 am
by elite
have you ever played the game worms? the layout is kinda like that.

Re: enemy AI

PostPosted: Sun Oct 14, 2007 11:52 am
by Kalladdolf
worms is very, VERY advanced and difficult to make :shock:
I tried it once, but had to give it up.

Re: enemy AI

PostPosted: Mon Oct 15, 2007 1:42 pm
by Bee-Ant
Make an actor called "PlayerArea", with Filed region parent with player
If your enemies are colliding with it make your enemies shoot you..maybe :

Enemy>CollisionEvent>PlayerArea>ScriptEditor>
Code: Select all
shoot=1;

Enemy>CollisionFinishEvent>PlayerArea>ScriptEditor>
Code: Select all
shoot=0;

Enemy>DrawActor>ScripEditor>
Code: Select all
if(shoot==1)
{
    //shoot action
}


If you want to move this topic to the Advance Topic, so you're advance user, if you're advance user you must know what I mean... :D