Following Script Points AND Shooting Enemies
Posted: Fri Jul 03, 2009 11:37 am
Hey, I was thinking if it's possible to make perfectai.s follow follow script points, than when an enemy is in the range, shoot it and proceed...actually this is already done, the thing that's not done is having multiple commands in the Patrol order, rather than only NextPoint(); RotateMoveToPoint(); MoveToPoint and RestartOrder();
This is the Patrol order I modified:
It's not only one order though, there are several, if the script goest to attack mode, it will forget which is the current order being executed...ok, I can fix this by simply creating a variable, which in every order gets the name of the order. Yeah, but if before the monster has seen an enemy it has reached he SetEventState(); command of the Patrol5 order, when the monster shoots the enemy it will go back to Patrol5 (using the variable and NewOrder();), but it will get back to the begining, which means that it will execute everything again. HALO has that cool thing, the troopers talk to you, then they say follow me, and than the trooper starts following some path, shooting every enemy arround him, he even talks, moving his mouth while walking (but that's not important). I need this, because I'm planing to use this on many places in the game, after all everyone in Metal Force help each other . For example, in the 4-th part of the first level you meet up with your pals (Jenity and Bolt) and than you gotta find a shuttle and evacuate, but for this you'll all need to go through the level together, my plan was for them to run infront of you, than stop at some places, checking if you're near enough and than proceed if you are, also they shoot enemies on their way so they don't die when they pass
Any suggestions for this guys?
This is the Patrol order I modified:
Code: Select all
Patrol[ ()
{
NextPoint();
RotateToPoint("SG_TurnLeft", 190, false, "" );
MoveToPoint("SG_Walk_N_Run", 200, "");
Delay("SG_Idle", 3, "Grunt/3.wav");
NextPoint();
RotateToPoint("SG_TurnLeft", 190, false, "" );
MoveToPoint("SG_Walk_N_Run", 200, "");
SetEventState("razpad", true);
NextPoint();
RotateMoveToPoint("SG_Walk_N_Run", 130, 150, false, "");
MoveToPoint("SG_Walk_N_Run", 200, "");
NewOrder("PatrolCheck1");
} ]
PatrolCheck1[ ()
{
PlayerDistOrder(150, "Patrol1");
LoopAnimation(STAND, 0, "");
} ]
Patrol1[ ()
{
NextPoint();
RotateMoveToPoint("SG_Walk_N_Run", 130, 150, false, "");
MoveToPoint("SG_Walk_N_Run", 200, "");
Delay("SG_Walk_N_Stop", 0.85, "");
NewOrder("PatrolCheck2");
} ]
PatrolCheck2[ ()
{
PlayerDistOrder(150, "Patrol2");
LoopAnimation(STAND, 0, "");
} ]
Patrol2[ ()
{
NextPoint();
RotateMoveToPoint("SG_Walk_N_Run", 130, 150, false, "");
MoveToPoint("SG_Walk_N_Run", 200, "");
Delay("SG_Walk_N_Stop", 0.85, "");
NextPoint();
RotateToPoint("SG_TurnLeft", 190, false, "" );
MoveToPoint("SG_Walk_N", 90, "");
Delay("SG_Holster", 1.65, "");
Delay("Push_Button_Low", 1.7, "");
SetEventState("gen1dtrig", true);
LowLevel("CheckIfOk");
} ]
CheckIfOk[ ()
{
if (GetEventState("gen14ever"))
{
HighLevel("PatrolCheck3");
}
} ]
PatrolCheck3[ ()
{
PlayerDistOrder(200, "Patrol3");
} ]
Patrol3[ ()
{
Delay("SG_Draw", 1, "");
NextPoint();
RotateToPoint("SG_TurnLeft", 190, false, "" );
MoveToPoint("SG_Walk_N_Run", 200, "");
NextPoint();
RotateMoveToPoint("SG_Walk_N_Run", 130, 150, false, "");
MoveToPoint("SG_Walk_N_Run", 200, "");
Delay("SG_Walk_N_Stop", 0.85, "");
Delay("SG_Radio_Call", 5.18, "");
NextPoint();
RotateMoveToPoint("SG_Walk_N_Run", 130, 150, false, "");
MoveToPoint("SG_Walk_N_Run", 200, "");
Delay("SG_Holster", 1.65, "");
Delay("SG_Reload", 2.33, "");
SetEventState("bombspawn", true);
NextPoint();
RotateToPoint("SG_TurnLeft", 210, false, "" );
MoveToPoint("SG_Walk_N_Run", 200, "");
NextPoint();
SetNoCollision();
MoveToPoint("SG_Roll_N", 150, "");
SetCollision();
Delay("SG_Idle", 1, "");
NextPoint();
RotateToPoint("SG_TurnLeft", 190, false, "" );
MoveToPoint("SG_Walk_N_Run", 200, "");
Delay("SG_Walk_N_Stop", 0.85, "");
Delay("SG_Idle", 0.85, "");
LowLevel("CheckIfOk2");
} ]
CheckIfOk2[ ()
{
if (GetEventState("gen24ever"))
{
HighLevel("PatrolCheck4");
}
} ]
PatrolCheck4[ ()
{
PlayerDistOrder(200, "Patrol5");
} ]
Patrol5[ ()
{
NextPoint();
RotateToPoint("SG_TurnLeft", 190, false, "" );
MoveToPoint("SG_Walk_N_Run", 200, "");
NextPoint();
RotateMoveToPoint("SG_Walk_N_Run", 130, 150, false, "");
SetEventState("wayblock", true);
MoveToPoint("SG_Walk_N_Run", 200, "");
} ]
}
Any suggestions for this guys?