Regions: events "stands", "walks onto" and "walks off" region do the s

Started by , Sun 03/10/2004 12:43:17

Previous topic - Next topic

Zak McKrackenâ„¢

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

Ashen

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

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

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.
I know what you're thinking ... Don't think that.

Zak McKrackenâ„¢

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?


Ashen

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.
I know what you're thinking ... Don't think that.

TerranRich

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.
Status: Trying to come up with some ideas...

SMF spam blocked by CleanTalk