Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Harvester on Sat 13/09/2003 17:17:13

Title: Moving a NPC on the screen
Post by: Harvester on Sat 13/09/2003 17:17:13
 How can I make a non-player character repeatedly move all the way to the right and then to the left side of the screen? This should be happening in the background so the main character can interact with that NPC.
When I try to use something like
while (1)
{
MoveCharacterPath(NPC, 0, y);
MoveCharacterPath(NPC, 319, y);
}
the game crashes with an error message saying something like "path too complex, cannot add any more paths".
Title: Re:Moving a NPC on the screen
Post by: Scorpiorus on Sat 13/09/2003 19:01:19
You see, the MoveCharacterPath() has a limit on a maximum number of linked paths.

I'd use room's repeatedly then: :P

function room_*() {
// script for room: Repeatedly execute

 if (character[NCP].walking == 0) {
    MoveCharacterPath(NPC, 0, character[NCP].y);
    MoveCharacterPath(NPC, 319, character[NCP].y);
 }

}