Why is my character not walking?

Started by bx83, Mon 30/07/2018 09:16:45

Previous topic - Next topic

bx83

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:
Code: ags

  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:
Code: ags

  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.

Mandle

Where in the Global Script is this code?

Snarky

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.

bx83

As usual, I added a Wait(1); after the SayBubble command, all works :P

SMF spam blocked by CleanTalk