Character moving weirdness with eAnywhere [SOLVED]

Started by DoorKnobHandle, Wed 05/08/2009 13:35:01

Previous topic - Next topic

DoorKnobHandle

I have the following problem:

I let a character walk around in a room. The room has no walkable area, it's a cutscene and I want precise movement, so I use the character.Walk command with eAnywhere. There are also two more characters following this one on the very same path. All characters are set to non-solid. The first character always stops for a few seconds in one spot of the screen.

Here's my room script, I use a simple waypoint system there to define paths as you can see:

Code: ags

int current_waypoint[3];

function room_FirstLoad()
{
	cFirst.Walk ( 120, 195, eNoBlock, eAnywhere );
	cSecond.Walk ( 120, 195, eNoBlock, eAnywhere );
	cThird.Walk ( 120, 195, eNoBlock, eAnywhere );
}

function room_RepExec()
{
	if ( current_waypoint[0] == 0 && cFirst.x > 115 )
	{
		cFirst.Walk ( 247, 150, eNoBlock, eAnywhere );
		current_waypoint[0] = 1;
	}
	if ( current_waypoint[1] == 0 && cSecond.x > 115 )
	{
		cSecond.Walk ( 247, 150, eNoBlock, eAnywhere );
		current_waypoint[1] = 1;
	}
	if ( current_waypoint[2] == 0 && cThird.x > 115 )
	{
		cThird.Walk ( 247, 150, eNoBlock, eAnywhere );
		current_waypoint[2] = 1;
	}
	
	if ( current_waypoint[0] == 1 && cFirst.x > 245 )
	{
		cFirst.Walk ( 130, 140, eNoBlock, eAnywhere );
		current_waypoint[0] = 2;
	}
	if ( current_waypoint[1] == 1 && cSecond.x > 245 )
	{
		cSecond.Walk ( 130, 140, eNoBlock, eAnywhere );
		current_waypoint[1] = 2;
	}
	if ( current_waypoint[2] == 1 && cThird.x > 245 )
	{
		cThird.Walk ( 130, 140, eNoBlock, eAnywhere );
		current_waypoint[2] = 2;
	}
}



Here's what I have tried:

Erasing the other two characters -> doesn't make a difference.
Checking differences between the characters -> there are NONE, even if I said cFirst and cThird for example to the EXACT SAME VIEW (so that ALL their properties except for the ID, even their starting location, are absolutely equal), cThird walks flawlessly, cFirst stops for a few seconds.

I'm out of ideas and starting to wonder whether this might a bug in AGS.

The main question is: what could make a lone character walking a room with eAnyways stop for a few moments anyway? I can't think of anything. Even when there is an EXACT copy of the character at same position at all times and he makes the walk perfectly. I've triple checked my code and it seems flawless as well.

Anybody see anything wrong?

Shane 'ProgZmax' Stevens

These are all non-blocked calls, which means that they can be interrupted by other calls and code at any time.  Try switching them to blocked walks and see if the pause stops.  Since it's a cutscene there's really no reason to have them non-block walking, anyway, unless you want some kind of randomness.

DoorKnobHandle

They have to be non-blocking because I also count the frames in that room and if that number is at 10 seconds (GetGameSpeed ( ) * 10), I draw a title card onto the room etc. I'm really sure there's no code in there that would stop a character from moving.

Pumaman

Can you upload something that demonstrates the problem?

Pumaman

Thanks for uploading. The code in your actual room script isn't quite the same as what you posted here, because you have this:

Code: ags

	if ( timer > GetGameSpeed ( ) * 12 )
		// remove
		
	if ( current_waypoint[0] == 0 && cChief.x > 115 )
	{
		cChief.Walk ( 247, 150, eNoBlock, eAnywhere );
		current_waypoint[0] = 1;
	}
	if ( current_waypoint[1] == 0 && cIndy.x > 115 )
	{
		cIndy.Walk ( 247, 150, eNoBlock, eAnywhere );
		current_waypoint[1] = 1;
	}
	if ( current_waypoint[2] == 0 && cDrummer.x > 115 )
	{
		cDrummer.Walk ( 247, 150, eNoBlock, eAnywhere );
		current_waypoint[2] = 1;
	}


because there are no braces surrounding the first "if (timer > GetGameSpeed())" check, it will only apply to cChief's "if" block, so he will wait until 12 seconds has elapsed whereas the other two won't. In the code you sent, if I comment out that "if" line they all walk together.

DoorKnobHandle

OH. MY. GOD! :D

This really has to be the stupidest mistake ever... Thanks for finding that and I'm really sorry for wasting your time like that!!

Pumaman


SMF spam blocked by CleanTalk