Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Monsieur OUXX on Mon 24/03/2014 12:01:45

Title: [SOLVED] behaviour of Character.Moving
Post by: Monsieur OUXX on Mon 24/03/2014 12:01:45
Here's the repeatedly_execute function of a module :

Code (ags) Select


Character* charPool[NPC_MAXCHAR]; //some code somewhere else puts Characters there

function repeatedly_execute()
{
  int i=0;
  while (i<NPC_MAXCHAR) { //we iterate through all possible NPC's

        if (!charPool[i].Moving) { //only if the character has stopped walking
       
            int x = Random(320); int y = Random(200);
            charPool[i].Walk(x, y, eNoBlock, eWalkableAreas); //THIS LINE IS CALLED AT EVERY GAME CYCLE!!!
         
        }
        i++;
   
  }
}


It turns out the line commente "//THIS LINE..." is called at every game cycle. A walk action keeps being initiated. I don't understand why : Character.Moving should be false as soon as the character starts walking?!?
Title: Re: behaviour of Character.Moving
Post by: Monsieur OUXX on Wed 26/03/2014 15:21:52
I've recycled this old empty thread for a new purpose so I'm bumping it. Apologies if it confuses the mods.
Title: Re: behaviour of Character.Moving
Post by: Monsieur OUXX on Wed 26/03/2014 15:43:02
OK found it. The character was stuck outside a walkable area, so it couldn't move, so "moving" was always false.