Uncool Animation Problem

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Uncool Animation Problem

Post by metal_head »

So I modified the patrol order from the perfectai script so that the pawn talks to the player, then starts following the script points, than stops, checks if the player is near to the pawn and if true, proceeds to the next script point...The problem is that there's a strange bug, the walking animation is played once or twice, then the animation freezes like it's an AnimateStop() command...

Here's a vid of this, don't look at the level, it's far from done :D
http://www.mediafire.com/download.php?nngmdyem5t0


Also the pawn won't play it's death animation if it's attribute goes to zero, but Juutis explained me why is that in a previous topic...

My goal is to create a pawn that leads the way, opens locked doors etc. bu also shoots enemy pawns when they are in it's range.

Here's the script for the pawn's actions...the rest of the code is perfectai.

Code: Select all

Patrol[ ()
	{
		NextPoint();
		RotateToPoint("SG_TurnLeft", 190, false, "" );
                MoveToPoint("SG_Walk_N_Run", 200, "");
                                SetEventState("grunttalk1", true);
		Delay("SG_Idle", 3, "");
		NextPoint();
		RotateToPoint("SG_TurnLeft", 190, false, "" );
                MoveToPoint("SG_Walk_N_Run", 200, "");
		SetEventState("grunttalk2", true);
		NextPoint();
		RotateMoveToPoint("SG_Walk_N_Run", 130, 150, false, "");
		MoveToPoint("SG_Walk_N_Run", 200, "");
		NewOrder("PatrolCheck1");
	} ]

PatrolCheck1[ ()
{
CURRENTORDER = "PatrolCheck1";
PlayAnimation(STAND, true, "");
PlayerDistOrder(150, "Patrol1");
RestartOrder();
} ]

Patrol1[ ()
{
CURRENTORDER = "Patrol1";
NextPoint();
RotateMoveToPoint("SG_Walk_N_Run", 130, 150, false, "");
MoveToPoint("SG_Walk_N_Run", 200, "");
NewOrder("PatrolCheck2");
} ]

PatrolCheck2[ ()
{
CURRENTORDER = "PatrolCheck2";
PlayAnimation(STAND, true, "");
PlayerDistOrder(150, "Patrol2");
RestartOrder();
} ]

Patrol2[ ()
{
CURRENTORDER = "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, "" );
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, "");
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", 170, "");
SetCollision();
NewOrder("Patrol4");
} ]

Patrol4[ ()
{
Delay("SG_Idle", 1, "");
NextPoint();
RotateToPoint("SG_TurnLeft", 190, false, "" );
MoveToPoint("SG_Walk_N_Run", 200, "");
} ]
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: Uncool Animation Problem

Post by Juutis »

The problem seems to be the PlayAnimation() command in your PatrolCheck orders. Dunno exactly what's going on but for me changing the PatrolCheck orders to this format fixed the problem:

Code: Select all

PatrolCheck1[ ()
{
CURRENTORDER = "PatrolCheck1";
PlayerDistOrder(150, "Patrol1");
LoopAnimation(STAND, 0, "");
} ]
Pain is only psychological.
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: Uncool Animation Problem

Post by metal_head »

Oh thanks!!! It's OK now, but still there's something that bothers me (it's not really big problem though). After the first patrol check order, when the character starts running again, there's some sort of a glitch while looping the walking animation, it's for about 0.05 seconds, but it's still visible, the normal animation doesn't have that glitch...any ideas?
Post Reply