[SOLVED] behaviour of Character.Moving

Started by Monsieur OUXX, Mon 24/03/2014 12:01:45

Previous topic - Next topic

Monsieur OUXX

Here's the repeatedly_execute function of a module :

Code: ags


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?!?
 

Monsieur OUXX

I've recycled this old empty thread for a new purpose so I'm bumping it. Apologies if it confuses the mods.
 

Monsieur OUXX

OK found it. The character was stuck outside a walkable area, so it couldn't move, so "moving" was always false.
 

SMF spam blocked by CleanTalk