Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Candle on Sun 12/12/2004 06:58:06

Title: repeat wait [SOLVED]
Post by: Candle on Sun 12/12/2004 06:58:06
I would like for it to wait 20 sec and then walk again but if I add  Wait(20); it then turns in to a blocking move and I don't want that .

// script for room: Repeatedly execute
if (character[LADYTALL].walking == 0) { //if not walking
  MoveCharacterPath (LADYTALL, 183, 98);
  MoveCharacterPath (LADYTALL, 123, 83);
}

So how can I make it stand for 20 then walk again ?
Title: Re: repeat wait
Post by: Radiant on Sun 12/12/2004 08:30:11


//outside the functions
int state = 0;

// script for room: Repeatedly execute

if (character[LADYTALL].walking == 0) { //if not walking
  if (state == 0) MoveCharacterPath (LADYTALL, 183, 98);
  if (state == 21) MoveCharacterPath (LADYTALL, 123, 83);
  state ++;
}

Title: Re: repeat wait
Post by: Candle on Sun 12/12/2004 20:08:05
That seems to work a little . it walks to the right then to the left and stops . and I have it in the repeatexecute ?
Title: Re: repeat wait
Post by: Gilbert on Mon 13/12/2004 01:57:45
Did you want her to repeat and repeat, so she's going and going and going?

Try this then:

//outside the functions
int state = 0;

// script for room: Repeatedly execute

if (character[LADYTALL].walking == 0) { //if not walking
if (state == 0) {
    MoveCharacterPath (LADYTALL, 183, 98);
    MoveCharacterPath (LADYTALL, 123, 83);
}
state ++;
if (state == 800) state=0; //20 secs=800 loops
}

Title: Re: repeat wait
Post by: Candle on Mon 13/12/2004 02:23:46
Thank you that work fine ..