How do I...create an event that hurts the player if they're standing still or moving through it?

Joined
Jul 12, 2020
Messages
164
Reaction score
29
First Language
English
Primarily Uses
RMMV
Scenario:
-I have an enemy that follows a specific path (I am using YEP_MoveRouteCore options, so I have some script calls in Custom Routes like "CRASH TO (x,y)" and "JUMP TO: (x,y)" etc...).
-The enemy is supposed to inflict damage and a negative effect if it touches the player.
-The enemy event is "below" the players priority wise.


Problem:

-If the Trigger is set to "Player Touch", the event will only damage the player if the player happens to be moving. If the player stands still, and the event touches the player...nothing happens. Big yikes!

-If the Trigger is set to "Event Touch", the exact same scenario is happening...it only hurts if the player is moving. Still a big yikes!


I'm not really sure what's going on...does anyone have a solution for why this could be?
 

xabileug

Veteran
Veteran
Joined
Jul 1, 2014
Messages
178
Reaction score
38
you can just use an event sensor plugin, or use parallel event in map to check player and event coordinates.
 

Jragyn

JABS codemonkey
Veteran
Joined
Aug 14, 2012
Messages
221
Reaction score
169
First Language
English
Primarily Uses
RMMZ
it only hurts if the player is moving
Most event detection is on-movement from what I can tell from the base code. So if you're not moving, stuff doesn't really work that well except for the "Event Touch". I can't speak to why that doesn't (was likely significantly altered from the core code if its a yanfly plugin).

I'd recommend following what @xabileug suggested using a parallel event on the map to check the coordinates of the player and deal damage if within whatever your "hitbox" threshold is. Do be sure to add a wait of some kind in that event or you'll just get murdered as soon as your dangerous moving event comes too close. (or maybe thats what you want?)
 
Joined
Jul 12, 2020
Messages
164
Reaction score
29
First Language
English
Primarily Uses
RMMV
Most event detection is on-movement from what I can tell from the base code. So if you're not moving, stuff doesn't really work that well except for the "Event Touch". I can't speak to why that doesn't (was likely significantly altered from the core code if its a yanfly plugin).

I'd recommend following what @xabileug suggested using a parallel event on the map to check the coordinates of the player and deal damage if within whatever your "hitbox" threshold is. Do be sure to add a wait of some kind in that event or you'll just get murdered as soon as your dangerous moving event comes too close. (or maybe thats what you want?)

Would it be possible to check for multiple entities at once with only 1 parallel event then? There are some rooms where there's a few copy/paste events of the same enemy in different formations.

Admittedly, I'm also not exactly sure how to make the parallel event "check" for if the player is touching X, Y ,Z event(s)...
 

xabileug

Veteran
Veteran
Joined
Jul 1, 2014
Messages
178
Reaction score
38
how many events do you have? if you have many events, a for loop script would be best.. you just need to assign the event position and player position to variables..
same position is player x === event[1] x,&& player y === event[1] y
left i think is event x === player x - 1, right is event x === player x + 1
top is event y === player y + 1, below is event y === player y - 1..
you could check the face direction values too.

just try making an event on parallel, that checks those conditions, then call common events for the -HP effect.
 
Joined
Jul 12, 2020
Messages
164
Reaction score
29
First Language
English
Primarily Uses
RMMV
how many events do you have? if you have many events, a for loop script would be best.. you just need to assign the event position and player position to variables..
same position is player x === event[1] x,&& player y === event[1] y
left i think is event x === player x - 1, right is event x === player x + 1
top is event y === player y + 1, below is event y === player y - 1..
you could check the face direction values too.

just try making an event on parallel, that checks those conditions, then call common events for the -HP effect.

Hello again!
Uuuh to answer your question...I can tell you this:

There are some maps where this particular harming event (entity) has different pathways...while there's multiple of them.

There are some areas where there could be 1 of them, and others have 6-8 of them...I'm not sure how well a for-loop would work in a script call since all the harmful entities all have different routes.

Perhaps the plugin suggestion from earlier could work?
Or maybe a different approach?
 

coucassi

Veteran
Veteran
Joined
Sep 23, 2019
Messages
125
Reaction score
171
First Language
German
Primarily Uses
RMMV
You could use Yanfly's Region Events, which calls a common event each time the player steps on a specific region.

Make your harming event a parallel event, that is activated by a switch and inflicts damage every soandso seconds.

Now mark all the tiles that shall activate this event as region 1 for example and use the plugin to designate region 1 to a common event, which turns on the switch for the harming event.

Next surround all region one tiles by region 2 tiles. Region 2 will call another common event, that turns of the switch. This way the parallel harming event will stop, as soon as the player leaves region 1.

This way you will only need one parallel event (per map) and two common events (in total).
 
Joined
Jul 12, 2020
Messages
164
Reaction score
29
First Language
English
Primarily Uses
RMMV
You could use Yanfly's Region Events, which calls a common event each time the player steps on a specific region.

Make your harming event a parallel event, that is activated by a switch and inflicts damage every soandso seconds.

Now mark all the tiles that shall activate this event as region 1 for example and use the plugin to designate region 1 to a common event, which turns on the switch for the harming event.

Next surround all region one tiles by region 2 tiles. Region 2 will call another common event, that turns of the switch. This way the parallel harming event will stop, as soon as the player leaves region 1.

This way you will only need one parallel event (per map) and two common events (in total).


Ooooh I have this plugin actually. I'll give it a shot! :)
 
Joined
Jul 12, 2020
Messages
164
Reaction score
29
First Language
English
Primarily Uses
RMMV
You could use Yanfly's Region Events, which calls a common event each time the player steps on a specific region.

Make your harming event a parallel event, that is activated by a switch and inflicts damage every soandso seconds.

Now mark all the tiles that shall activate this event as region 1 for example and use the plugin to designate region 1 to a common event, which turns on the switch for the harming event.

Next surround all region one tiles by region 2 tiles. Region 2 will call another common event, that turns of the switch. This way the parallel harming event will stop, as soon as the player leaves region 1.

This way you will only need one parallel event (per map) and two common events (in total).
Hey! Just to follow up...what exactly do you mean by "make your harming event a parallel event"? I understand the whole switch and tile region things, but from the way I understand that portion...the regions themselves will just activate constant damage to the player until they leave that region. So the actual harming event itself has no purpose.

Did I misinterpret it?
 

coucassi

Veteran
Veteran
Joined
Sep 23, 2019
Messages
125
Reaction score
171
First Language
German
Primarily Uses
RMMV
My bad^^ I forgot that common events can be parallel too.
 
Joined
Jul 12, 2020
Messages
164
Reaction score
29
First Language
English
Primarily Uses
RMMV
My bad^^ I forgot that common events can be parallel too.
That's okay! I ended up trying something else...



So, I set up a parallel process, and now I guess I have a new question:

Should I be concerned about storing more than 1 object location base in the same 2 variables?
I have 4 variables.
Screen Shot 2021-05-19 at 10.57.20 AM.png

So it's going to always check for the player's location (Player X,Y), as well as the damaging event's location (Object X,Y). And if there's ever a point where the player's location matches with the event's location, the damage happens with the 2 second cool down. (120 frames)

This seems to be working quite nicely, but...again, there could be instances where I have like 4-6 of these guys roaming around in their respective formations, and not just this 1.

Is it still okay to through with this route? I'm only afraid of lag really.
 

coucassi

Veteran
Veteran
Joined
Sep 23, 2019
Messages
125
Reaction score
171
First Language
German
Primarily Uses
RMMV
I just realized, I totally misread your original post. Didn't get that you wanted a moving enemy, not just a tile to move on xD Sorry.
Is it necessary that your events priority is "below"? If it's set to same as actors, it should work without any plugins or scriptcalls, just by have the trigger set to "event touch".
 

Latest Threads

Latest Posts

Latest Profile Posts

Not about my game project but i feels like to talk about it a bit. :kaohi:
moka.jpg

It's my コテキャ and maybe closest thing in english is a "avatar personality" i guess?
Her design also looks very similar to protagonist from my game because i'm so uninspiring :kaoslp:
Oh and my hobby is sleeping and drawing. :kaojoy:
Okay, so it seems I've found a major bug in VNM. Check my thread about variable buttons in the support forum for more info.
Man, this quick One Map game is causing unprecedented amounts of trouble.
I always end up having issues with things i'd never expect.

Capture.PNG

Those friggin mountains man xD

Forum statistics

Threads
112,401
Messages
1,068,066
Members
146,053
Latest member
komradiv
Top