Character running away

Hello my friends!

I have another question and am using RPGVXAce.. ^^"

I am designing a quest where the player has to catch someone.

The "target" should run away as soon as the player is near to him.

The solution is to roll a rock and chase the target towards the rock.

The rock isn't the problem but the target.

How do I make the target run away from the player, so he only can catch him by blocking the road.

Also: the target should stay in it's designed area. 🙂

Thanks in advance!
Compare their x and y locations through variable operations. If the difference is too small, move that event away from player.
Compare their x and y locations through variable operations. If the difference is too small, move that event away from player.

Hi.
Thanks but I am a noob. .
How do I do that, "compare" their locations? 🙂
Variable operations, save their x locations to different variables, compare by subtracting one from the other. Same for y locations.
The rest is conditional branching, if the result is either less than or equal to 3 or greater than or equal to -3 for example.
This is an implementation question.
Moved to: RPGMaker VX Ace Support
Normally I would just answer to set the event custom move route to combination of "Move at Random" and "Move Away from Player", but I once do that and the event always stuck at the wall. Even with the variable condition like how @Poryg explain above, if you execute "random" or "move away" move route, it would just make the event dumbly stuck at impassable tiles. Not to mention the event need to be inside designated area.

Here's a lazy solution. I think it's better for you to degrade your condition. Instead of moving like dumb event, make it move from point to point. If the event is on point 0, when you get close, the event will run to point 1. If you get close to the event again, it will run to point 2, and so on until it circled to point 0.
rock.png
You might want to use conditional variable for the event to detect the player's nearby. Make a switch activated after you put the rock on designated place. The rest is just playing with condition.
event.png

Here, I make the event run from point to point when player get in range 2 tiles away from em. of course, it needs to be a parallel process Let's just say you put the rock between point 3 to point 4. Voila~ it slammed the rock! Maybe make it confused? Now you can swap to second page and make it triggered either autorun or action button. Do what you want from there.
@Kuro DCupu
Okay.. my bad.. it seems it is not that easy for me at all.. xD

It doesn't work that way I wanted it too... Maybe you can help me, by looking at my screenshots?

First pic is the scenery.

Spoiler
snQyXzo.jpg

Second pic is the stone, the path (yellow) the target should run around, crossed out the target and crossed out the three entry points of that location.

Spoiler
O3yRwq6.jpg

Third and fourth pic are the codes.
I haven't finished your code on purpose, cause I wanted to see, if the enemy gets stopped by itself, as far as the rock blocks his way, OR if he runs another route if the stone is in the way.

Spoiler
P89bIeZ.jpg

Spoiler
Wh7jSPz.jpg

Maybe you can help me!

It's much appreciated!

Thanks in advance! =)
If you move the event with eventpage eventcommand, than you should turn off the autonomous moveroute.
Because when its on random it will interfere/bug/overwrite the moveroute on the right side in the branches. That will start messing up things.
If you move the event with eventpage eventcommand, than you should turn off the autonomous moveroute.
Because when its on random it will interfere/bug/overwrite the moveroute on the right side in the branches. That will start messing up things.

How do I deactivate the autonomous moveroute?
😳...??? Just choose "None" instead of "Random" in the Choice Field.
Edit: Sorry it was called Fixed not None, my fault.
@Wasserteufel I can't seem to load your picture...? could be my internet connection tho, it's buggin up lately.

If it's about the autonomous movement, the type need to be Fixed. So it doesn't mess up with event move route. Yes, it will make the event to wait for the player to approach em first. You might also want the event to be Through, to avoid the player stopping its path. This will cause the event to be unstoppable.
event.png

And just in case, when setting the event move route.
event.png
You need to check the Wait for Completion to let the event complete their move before your next approach. Skip if Cannot Move allow the event to abort further movement command in case they stuck. Turning it on might cause the event to mess up future movement. But if you turn on Through (which make them unstoppable) that won't bother the event. And of course you don't want the event to repeat same movement with Repeat Action.

Finally, when you want the event to stuck at the rock, it's preferred to set different move route for that.
@Wasserteufel I can't seem to load your picture...? could be my internet connection tho, it's buggin up lately.

If it's about the autonomous movement, the type need to be Fixed. So it doesn't mess up with event move route. Yes, it will make the event to wait for the player to approach em first. You might also want the event to be Through, to avoid the player stopping its path. This will cause the event to be unstoppable.
View attachment 75960

And just in case, when setting the event move route.
View attachment 75961
You need to check the Wait for Completion to let the event complete their move before your next approach. Skip if Cannot Move allow the event to abort further movement command in case they stuck. Turning it on might cause the event to mess up future movement. But if you turn on Through (which make them unstoppable) that won't bother the event. And of course you don't want the event to repeat same movement with Repeat Action.

Finally, when you want the event to stuck at the rock, it's preferred to set different move route for that.


Hey! Thanks for the quick answer.

No it's not about the movement, but thank you, that helped a lot.

The problem is, that the target istn't moving like it should and I don't know why it moves in such strange patterns..

Here is the link with the pictures if this might help. ^^

event.png

First, the type of the autonomous movement need to be Fixed.
The fourth range condition is supposed to be var 9 : Range Y. It's the detector, so that will cause the event to-- wait, it's all my fault! =_=
Sorry, it need to be like this :
event.png
Uuuh, this is embarassing... =////=


And finally, you modulo the waypoint by 5 while you only have 4 waypoint (0, 1, 2, and 3)
Well, since it's parallel it will only cause the event to skip the fifth round though... still, just make it 4 if you only provide 4 point location.
View attachment 75971

First, the type of the autonomous movement need to be Fixed.
The fourth range condition is supposed to be var 9 : Range Y. It's the detector, so that will cause the event to-- wait, it's all my fault! =_=
Sorry, it need to be like this :
View attachment 75974
Uuuh, this is embarassing... =////=


And finally, you modulo the waypoint by 5 while you only have 4 waypoint (0, 1, 2, and 3)
Well, since it's parallel it will only cause the event to skip the fifth round though... still, just make it 4 if you only provide 4 point location.

Hey! Thank you.

The Event is reacting much better right now.

But I've still got a few bugs here..

If I enter the map from below the first time (or somewhere above) the events triggers itself without using the range.
If I go back and forth a second time, the event only reacts as it should by the correct distance..

And the second problem is, I told him the exact patterns how to move, but he still moves how he likes..

Does it matter from which direction I come, with those Branches or do I have to come from a certain point, that it moves correctly?

And my last question is, how does it know to move the other way back from where it came, if I would try to get him from the opposite site? ^^"

Sorry for so many questions.. but THAAAAANK you for your help! =D

It's just a mini-event in my big event but it gives me more trouble than the big one.. xDD
I thought the quest won't allow you to leave until you completed it, so I didn't consider about leaving the map.
Right... that's happen often when you deal with parallel process event. Unlike regular event, when it's not active, the event will immediately cut-off midway. On this case, probably you leave the map before it's able to finish their movement and turn off the self switch A.

First problem can be solved by putting Turn off self switch A up above.
event.png

Next... by default, if you re-enter map, all event will return to their original position. But your variable are not. You need to reset variable point location back to 0 after transferring player to other map.
Those conditional branch allow the event to detect player in 5x5 square around it, regardless to where the player are facing.
event.png

For the last question, you can use Move Away from Player, but like I mentioned before, the event will just dumbly move straight away from player regardless of the impassable tiles ahead. If you want the event to be able to tell where the player came from, you need to set up another condition and of course... another execution for the event move route manually.
I thought the quest won't allow you to leave until you completed it, so I didn't consider about leaving the map.
Right... that's happen often when you deal with parallel process event. Unlike regular event, when it's not active, the event will immediately cut-off midway. On this case, probably you leave the map before it's able to finish their movement and turn off the self switch A.

First problem can be solved by putting Turn off self switch A up above.
View attachment 76008

Next... by default, if you re-enter map, all event will return to their original position. But your variable are not. You need to reset variable point location back to 0 after transferring player to other map.
Those conditional branch allow the event to detect player in 5x5 square around it, regardless to where the player are facing.
View attachment 76007

For the last question, you can use Move Away from Player, but like I mentioned before, the event will just dumbly move straight away from player regardless of the impassable tiles ahead. If you want the event to be able to tell where the player came from, you need to set up another condition and of course... another execution for the event move route manually.

Wow!

Thank you.

It really works well for the most parts now. =)

The only two things I have to wrap my head around is, that the target runs the opposite direction if I come from the other side.
But that's not so hard to solve I guess.

BUT one thing is really still bugging me.. I chose a picture for the "dizzy" target. But everytime I click on it, it changes picture and I don't know why it does.. O___o
You know about that? I had this problem a few times now..

Nevertheless I reaaally appreciate your help!!

Can't thank you enough! =)

EDIT: oh.. and I don't know how to "reset variable point location back to 0" apperiantely.. how do I reset those? ^^"
God.. I am so sorry to bother you all the time.. Normaly I would offer you a drink for your help. xD But You don't life close to me.
You're welcome~ That's nice of you!
I'm currently on mobile now, so I can't post pic...

By choosing picture, you mean changing the character graphic? it's recommended to swap to the second event page instead of changing it via event move route. Then you need to checklist the direction fix and uncheck the rest of the option.

about the variable, you need to open all other event with transfer player command inside, then manually set the variable to 0 just after the transfer.
You're welcome~ That's nice of you!
I'm currently on mobile now, so I can't post pic...

By choosing picture, you mean changing the character graphic? it's recommended to swap to the second event page instead of changing it via event move route. Then you need to checklist the direction fix and uncheck the rest of the option.

about the variable, you need to open all other event with transfer player command inside, then manually set the variable to 0 just after the transfer.

EDIT: Everything works perfect now. Thank you! =)

Original thread: https://forums.rpgmakerweb.com/threads/character-running-away.86834/