OK, I've tried everything, I can't figure out how I did this before (I deleted it because I thought I wouldn't need it). What I'm trying to do is make it so that the follower is always 2 tiles away from the player. But no matter what I do, the follower still goes through the player.
Cleaning Up Followers Not Working
RPG Maker VXAce SupportI used this in the conditional branch:
(($game_player.x - $game_map.events[38].x).abs + ($game_player.y - $game_map.events[38].y).abs) > 4
My event was supposed to be 4 tiles away.
(($game_player.x - $game_map.events[38].x).abs + ($game_player.y - $game_map.events[38].y).abs) > 4
My event was supposed to be 4 tiles away.
Still going through the player, unfortunately.
Weird. What do you have in the other conditions? Mine only had one else and that was turning 'through' on, so I didn't get stuck with the event in the way (I see that yours is set to through always, I don't even remember why I did it like that).
turn off the repeat in the move routes?
Right because it's parallel process. I'm so stupid.
And of course that was it, LOL.
And of course that was it, LOL.
It's actually not because it's parallel process. Your condition determines if the move route is run. If you have it set to repeat, then the movement will keep repeating without checking the condition each time. So the player/event will be more than 2 tiles apart, triggering the move route, but then the event will just keep moving towards the player as there is nothing telling it not to. An alternative to removing the Repeat would be to put a final Else statement with Set Move Route with no movement commands, which means if none of the conditions were met, the currently-applied move route would be cancelled. Either removing the Repeat, or adding the final Else and Set (blank) Move Route will ensure the event only moves one tile closer to the player, before re-evaluating the condition.
Actually, your code looks a little confusing ... you have 4 tests, and in the first you specifically refer to event 23, but in the others, you use self.event_id - are all tests referring to the one event?
You can reduce it to a single test as follows:
This means if the player and event are more than 2 tiles apart in any of the 4 directions, the event will move. Removes the need to check for player being left, right, above or below the event.
get_character(0) when used in a Script call (not a movement route script call) means "this event".
Actually, your code looks a little confusing ... you have 4 tests, and in the first you specifically refer to event 23, but in the others, you use self.event_id - are all tests referring to the one event?
You can reduce it to a single test as follows:
Code:
(($game_player.x - get_character(0).x).abs > 2) || ($game_player.y - get_character(0).y).abs > 2)
This means if the player and event are more than 2 tiles apart in any of the 4 directions, the event will move. Removes the need to check for player being left, right, above or below the event.
get_character(0) when used in a Script call (not a movement route script call) means "this event".
Original thread: https://forums.rpgmakerweb.com/threads/cleaning-up-followers-not-working.148236/