[Solved] Event running away from player

Started by Globock, May 25, 2013, 10:38:50 am

Previous topic - Next topic

Globock

May 25, 2013, 10:38:50 am Last Edit: May 25, 2013, 02:07:46 pm by Globock
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:

I'm sure it's not that hard, I just had a looong break from RMXP ^^' Can anyone solve it?

Zexion

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

KK20

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.





   


   
   


   
   

Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!



Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Globock

Yes, I want event to run away when at certain distance, but how exactly should I make it? I have a little trouble

Zexion

Here you go.
Spoiler: ShowHide

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.

Globock