Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sun 03/10/2004 12:43:17

Title: Regions: events "stands", "walks onto" and "walks off" region do the s
Post by: on Sun 03/10/2004 12:43:17
Hello,
I'm using AGS 2.61

in my game, there is a path, and there is a bridge in the middle of the path.
My charachter has to cross the bridge.

Well, I wish to do the following:
- if the character stands on the bridge, do "action 1"
- if the character crosses the bridge without stop on it, nothing happens.

I thought to draw a region on the bridge, and to use the following events:
- while player stands on region, Run Script (doing "action 1")

Well... action 1 is correctly executed, but unfortunately the event "while player stands on region" is triggered even if my character is moving on the bridge!
That is, I expected this event to be triggered only if my character would *STOP* on region.

So, events "Player walks onto region" and "Player stands on region" are both triggered when character enters region.
Is there something wrong?

Thanks
Title: Re: Regions: events "stands", "walks onto" and "walks off" region do t
Post by: Ashen on Sun 03/10/2004 12:57:25
No, I think that's what's meant to happen. If you want the 'Stands on bridge' to happen when the character is stopped, I think you'd need to use something like:

  // script for region1: While player stands on region
if (character[EGO].walking == 0) { // character has stopped
  // interactions here
}
else { //character is moving
  // so do nothing
}

Or, if you're using the Interaction Editor:

While playe stands on region
   ? Conditional - If character is moving (EGO)
        Stop running more commands
   Other interaction
   Other interaction
   etc...

Or, you could use a variable, or a Timer, to track the amount of time the character has spent on the region.
Title: Re: Regions: events "stands", "walks onto" and "walks off" region do t
Post by: on Sun 03/10/2004 13:11:27
WOW!
Thank you for your *VERY PROMPT* reply!

It worked!

Just for my curiosity: so when could be useful using the "walks onto region" if the "stands on region" is always triggered?

Title: Re: Regions: events "stands", "walks onto" and "walks off" region do t
Post by: Ashen on Sun 03/10/2004 13:26:00
You're welcome, glad I could help.

Anyway - I suppose for one-off events - e.g. setting a variable, opening a door, triggering an event. Using 'While player stands on region' would constantly call the code so long as the player was on the region, which could cause glitching, unwanted repetitions, buggy behaviour, etc.
Title: Re: Regions: events "stands", "walks onto" and "walks off" region do t
Post by: TerranRich on Mon 04/10/2004 15:57:01
In simpler terms, "walk-on" could be used for opening a door, a one-time event. "Stands on" could be used, for example, if you wanted an object to animate while EGO was on a certain spot. EGO walks on, a TV screen goes on and animates until he gets off.