Enemy Control

Hello! I don't have lot of time it's why my current game is stopped. But i have a question:how to make an actor walk,punch,jump...without any key....like a CPU? And how to make him not very...stupid?



if(EnemyAttack==0)
{
if(right==1)
{
ChangeAnimation("EventActor", "EnemyPunchRight", FORWARD);
}
else
{
ChangeAnimation("EventActor", "EnemyPunchLeft", FORWARD);
}
EnemyAttack=1;
}
if(EnemyAttack==0)
{
if(right==1)
{
ChangeAnimation("EventActor", "EnemyKickRight", FORWARD);
}
else
{
ChangeAnimation("EventActor", "EnemyKickLeft", FORWARD);
}
EnemyAttack=1;
}
if(canjump==1)
{
yvelocity-=10;
canjump=0;
}
right=1;
ChangeAnimation("EventActor", "EnemyWalkRight", FORWARD);
right=0;
ChangeAnimation("EventActor", "EnemyWalkLeft", FORWARD);
ChangeAnimation("EventActor", "EnemyStandRight", FORWARD);
ChangeAnimation("EventActor", "EnemyStandLeft", FORWARD);
ChangeAnimation("EventActor", "EnemyStandRight", FORWARD);
ChangeAnimation("EventActor", "EnemyStandLeft", FORWARD);
EnemyAttack=0;
if(right==1)
{
if(EnemyAttack==0)
{
x+=3;
}
}
else
{
if(EnemyAttack==0)
{
x-=3;
}
}