Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: bx83 on Mon 30/07/2018 09:16:45

Title: Why is my character not walking?
Post by: bx83 on Mon 30/07/2018 09:16:45
I have this piece of code for The Assayer, who is a non-player character, on a walkable area, and has 1 frame for walking down, 17 left, and 17 right.

in GlobalScript.asc:

  if (cJulius.ActiveInventory==iGoldIngot) {
    cJulius.SayBubble("&242 I would like to value some gold.");
    cAssayer.SayBubble("&2 Really.");
    cAssayer.SayBubble("&3 Hand it to me.");
    //assayer tries the scales
    cAssayer.SayBubble("&4 Let me get the books...");
    cAssayer.Walk(998,676,eBlock,eWalkableAreas);        <--DOES NOTHING
    SetTimer(TIMER_ASSAYER, GetGameSpeed()*6);            <--SET A TIMER FOR 6 SECONDS
    PayForMace=true;
  }


I also have a piece of code which complements this:

in GlobalScript.asc:

  if (cJulius.Room==30) {
    if (IsTimerExpired(TIMER_ASSAYER)) {    //WHEN TIME IS UP...
      cAssayer.Walk(ASSAYER_START_X, ASSAYER_START_Y, eBlock, eWalkableAreas);
      cAssayer.SayBubble("&40 It's 23.9 carats. Yes. *Crap* I'm afraid.");
    }
  } 


However:
If I make one or both pieces of code eNoBlock, or eBlock, it does nothing.
If I make him WalkAnywhere or only on WalkableAreas, it make no difference.
If I make him walk Block-ing, the timer icon does not appear, and I can do other things.

Why does he do nothing when he should be walking? Should I use something else to get him to move? Does it make a difference this is in the GlobalScript and not the room script?
Puzzled.
Title: Re: Why is my character not walking?
Post by: Mandle on Mon 30/07/2018 10:04:34
Where in the Global Script is this code?
Title: Re: Why is my character not walking?
Post by: Snarky on Mon 30/07/2018 11:01:20
First, I would try adding another frame (just a copy of the same one) for the down walk. I seem to recall that AGS doesn't like it if you don't have at least one walking frame.

Second, I would have a look at the TIMER_ASSAYER constant, to check that it's a valid timer value and not already in use.

Third, I would try it without the SayBubble() calls, in case those mess with it somehow.
Title: Re: Why is my character not walking?
Post by: bx83 on Tue 31/07/2018 03:24:08
As usual, I added a Wait(1); after the SayBubble command, all works :P