Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

View range -follow-lose interest

arion

Member

Basicly, what i've done is set up a view range event, to set self switch "A" on if the player steps into view. This causes the next page, set to follow the player, to start a battle based on a random variable when it reaches the player.
After it is defeated, the event dissapears for a set amount of time, and reappears with all self-switches turned off.

The issue, is that i want the event to "lose interest" in the player if he is out of the original range. To do this, i set a parallel process to wait 30 frames, and then turn off the self switch A. This worked effectively, as it stopped the event if you were too far, but continued the chase if you are still in range.

However, i can't seem to figure out how to make both run simultaneously.
Using seperate event pages didn't work, for obvious reasons.
What i need is a way to check to see if the event has made contact with the player, while running in parallel process.

I rigged around with X &Y variables, but no luck.


I'm experienced with the program, so no need to waste your time with highly detailed instructions if you reply.
If anyone has an idea how to do this, i'd appreciate the help.

http://www.box.net/shared/2eytzmqses
 
Here is how I rewrote the second tab. I created some variables that store the player's and enemy's X and Y values, as well as a couple of temporary distance calculating variables. These are only updated while switch A is on.

http://img146.imageshack.us/img146/2333/examplerz0.png[/IMG]

One thing to note - I made the event passability as "Through" while it's stalking the player. If you want the player to be able to duck behind a tree to lose the enemy, for instance, you can uncheck this and then change the "Distance Check X == 0" conditional to "Distance Check X == 1", so if the event is 1 space away, it will attack. I'd recommend making the sight radius higher than 3 in this case, and don't forget to change the "Distance Check X >= 3" line accordingly. Everything inside this "Collision" check is unchanged from your enemy group setting method. (Fake edit: Oops, except for the "Wait 1 Frame(s)" command at the veeeeeeery end outside of the conditional.)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top