i want to make a event that is trigger as a paralel process,but i also want that event do something else changing its page only when it touch the player via local swich.How i do something like that
I will explain with more detail what i am doing,I trying to do on map encounters with a pixel movement chase,so normally the event is ramdom moving,when the player is near it change to a page with a script command that makes the event start chasing the player,but i dont know how to make the event start a battle only when it touches the player
"Chase player" should be available as a movement route type which could be activated in a secondary page via switch and the chase player movement type can be used in conjunction with "player touch" event activation type, this should simplify things.
In case im reminding things wrong you can set a parallel with "move towards player" moveroute (please add waits) store player X & Y coords and compare them with the event's coords on every move, if they match then its contact and battle ensues, the parallel loop needs to check all 4 coordinates on every move cycle.
You could have it be a parallel process that puts the X, Y coordinates of the player into variables then compares them to its own.
- If it's outside of your distance, do nothing but wait for some frames.
- If it's within your distance, do a move route of move toward player.
- If they equal each other (or are within the size of a sprite from each other, whatever ends up looking good), do the battle processing.
You could also check out Yanfly's event chase plugin to see if it does anything that will make your life easier.
mathematics - that means multiple control variable commands
control variable player X
control variable monster x
control variable distance x = player x
control variable distance x -= monster x
conditional branch variable distance x <0
>> control variable distance x *= -1 (if distance is negative, multiply by -1 to make it positive)
conditional branch variable distance x < 4
you need to use mathematics to calculate the distance instead of the coordinates, and then check that in the conditional branch.