Chaos Project

RPG Maker => Event Systems => Event System Troubleshooting => Topic started by: Globock on May 25, 2013, 10:38:50 am

Title: [Solved] Event running away from player
Post by: Globock on May 25, 2013, 10:38:50 am
So I've been trying to make animals running away from player (as they're scared), but I had a little trouble. Here is how I made it:
(http://img809.imageshack.us/img809/4130/afera.png)
I'm sure it's not that hard, I just had a looong break from RMXP ^^' Can anyone solve it?
Title: Re: Event running away from player
Post by: Zexion on May 25, 2013, 11:55:26 am
I don't know exactly how you want this to work. Do you want it to move away from the player if they are stepped on, or if the player is within a certain range? If in a range, than what is the range :P
Title: Re: Event running away from player
Post by: KK20 on May 25, 2013, 12:24:35 pm
In your picture, the first conditional branch says the following: If Event's X-coordinate is less than or equal to 4, perform movement. I believe you forgot to subtract the player's X with the event's X. Also, you would have to either find the absolute value of that result or square it accordingly.
Title: Re: Event running away from player
Post by: Globock on May 25, 2013, 12:31:27 pm
Yes, I want event to run away when at certain distance, but how exactly should I make it? I have a little trouble
Title: Re: Event running away from player
Post by: Zexion on May 25, 2013, 01:06:55 pm
Here you go.
Spoiler: ShowHide
(http://img855.imageshack.us/img855/3458/runawayo.png)

Takes 5 Variables though lol.

Basically just make the distance formula sqrt( (x2-x1)^2 + (y2-y1)^2).
Then some conditional branches to make sure it only moves when requirements are met (always check the handle...blah box)
You can change the range if you'd like currently it's at 2 squares just change that number in the conditional branches.
Title: Re: [Solved] Event running away from player
Post by: Globock on May 25, 2013, 02:07:59 pm
Thanks alot!