Event with paralel process trigger,do another action or change page when it touch player

DarielZer0

Villager
Member
Joined
Oct 16, 2021
Messages
27
Reaction score
8
First Language
Spanish
Primarily Uses
RMMV
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
 

BK-tdm

Manga Maker
Veteran
Joined
Jun 21, 2018
Messages
391
Reaction score
1,235
First Language
English
Primarily Uses
RMMV
"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.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,106
Reaction score
2,507
First Language
English
Primarily Uses
RMMV
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.
 

DarielZer0

Villager
Member
Joined
Oct 16, 2021
Messages
27
Reaction score
8
First Language
Spanish
Primarily Uses
RMMV
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.
i make 4 variables : a playerX,playerY,monsterX,and monsterY,then i put a condicional that if playerx=monsterx and playerY=monsterY the battle proceed.And it worked! But i dont how make the variable/event detect it is "outside my distance" or "within my distance",so the event is always chasing me,can you please tell me how? And About Yanfly chase plugin,it does not work for me because i am using a pixel movement plugin and the event dont move at all,they probably are incompatible,but the pixel movement i am using includes a Chase script call,but no a range for it
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
35,860
Reaction score
9,501
First Language
German
Primarily Uses
RMMV
But i dont how make the variable/event detect it is "outside my distance" or "within my distance",
that is pure mathematics.
instead of checking if the coordinates are identical, you check if the difference between the two coordinates is higher or lower than the distance choosen.

and if you want a circular distance check, it's just more mathematics (search for pythagoras, that is the name to find the required formula)
 

DarielZer0

Villager
Member
Joined
Oct 16, 2021
Messages
27
Reaction score
8
First Language
Spanish
Primarily Uses
RMMV
that is pure mathematics.
instead of checking if the coordinates are identical, you check if the difference between the two coordinates is higher or lower than the distance choosen.

and if you want a circular distance check, it's just more mathematics (search for pythagoras, that is the name to find the required formula)
Sorry but i dont understand,how i make that if playerX-monsterX>4,for example,the event proceed,for what i know in the condicional you can say If Playerx>MonsterX proceed but no If playerX-monsterX>4
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
35,860
Reaction score
9,501
First Language
German
Primarily Uses
RMMV
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.
 

DarielZer0

Villager
Member
Joined
Oct 16, 2021
Messages
27
Reaction score
8
First Language
Spanish
Primarily Uses
RMMV
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.
It worked fine and i also learned something useful today,thanks!
 

Latest Threads

Latest Posts

Latest Profile Posts

Me and my friend got into one of our usual discussions after I reccomended him a game, and I remember the last time we had a discussion like that, he disabled his FA account. This time, I found myself constantly checking my friends account hoping it wouldn't happen again. ...But it didn't.

The thing is... I just can't lie about my feelings, sometimes. :(
COMBAT:

Finally showing combat in my game. The lighting system I'm currently using doesn't transfer over into combat, but I am hoping to find a new one soon... or an update for the one I'm using. The plan is to make combat less bright, though. You'll want to click the video link below and visit YT for audio.
Huge thanks to D757 Gaming for his stream, impressions and review of my game, please check him out!
Thank you to everyone who participated in the 3rd quarter annual Drifty jam! I'm always so impressed with the games people make! This time our winner dominated both categories!
jamWinners2.png
That feeling when you have an out-of-bounds error and an ai enemy exploits it to kill you

Forum statistics

Threads
122,041
Messages
1,146,080
Members
160,308
Latest member
DoctorDeathtrap
Top