How to make it so an event only runs when player touches it from the front?

NeoPGX

~ King of Cuteness ~
Regular
Joined
May 15, 2014
Messages
864
Reaction score
188
First Language
English (US)
Primarily Uses
N/A
Right now I am trying to figure how to make it so an event can only work when the front of it is touched by the player.

How do I make this happen?
 

JGreene

Regular
Regular
Joined
Oct 24, 2015
Messages
456
Reaction score
374
First Language
English
Primarily Uses
RMMV
You can put everything inside a conditional branch that only activates when the player is facing up (or whichever direction is the front of your event). It's a default option on the 3rd or 4th tab I think.
 

Andar

Regular
Regular
Joined
Mar 5, 2013
Messages
39,943
Reaction score
11,884
First Language
German
Primarily Uses
RMMV
depends on exactly what you want to do.
basically as said above you make it always trigger but only do something if the player is facing the correct direction.

however sometimes it is more complex when you need to prevent the automatic turning of the event with direction fix.
 

NeoPGX

~ King of Cuteness ~
Regular
Joined
May 15, 2014
Messages
864
Reaction score
188
First Language
English (US)
Primarily Uses
N/A
You can put everything inside a conditional branch that only activates when the player is facing up (or whichever direction is the front of your event). It's a default option on the 3rd or 4th tab I think.

That won't work I'm afraid.

Because the event moves and could touch the player first instead of the player touching it, so it needs to be set up so the player has to be in front of whichever way the event is facing at the time for it to work. The player can be facing any direction. The only requirement is that the player has to be in front.
 

Hyouryuu-Na

Very very lazy
Regular
Joined
Jun 15, 2017
Messages
1,122
Reaction score
2,953
First Language
Not English
Primarily Uses
RMMV
You can probably use a conditional branch (script):
($gamePlayer.direction()==2 && $gameMap.event(ID).direction()==8) || ($gamePlayer.direction()==8 && $gameMap.event(ID).direction()==2) || ($gamePlayer.direction()==4 && $gameMap.event(ID).direction()==6) || ($gamePlayer.direction()==6 && $gameMap.event(ID).direction()==4)

Replace ID with event ID.

I don't know if it will work since I don't know what your plan is (or if I've even understood what you've said correctly). All I can think of from your description is that they have to be facing opposite directions? If that's indeed the case, then this condition should work.
 
Last edited:

Andar

Regular
Regular
Joined
Mar 5, 2013
Messages
39,943
Reaction score
11,884
First Language
German
Primarily Uses
RMMV
Because the event moves and could touch the player first instead of the player touching it,
if the event moves first, then the player is always in front of it if the trigger happens.

as I said above depending on what you want the event can become more complex, but it would still have to always trigger and then check on what has happened before deciding what to do (or not to do).

please give a full description of your mechanic, we can't guess what other conditions you need without you telling us about them.
 

NeoPGX

~ King of Cuteness ~
Regular
Joined
May 15, 2014
Messages
864
Reaction score
188
First Language
English (US)
Primarily Uses
N/A
if the event moves first, then the player is always in front of it if the trigger happens.

as I said above depending on what you want the event can become more complex, but it would still have to always trigger and then check on what has happened before deciding what to do (or not to do).

please give a full description of your mechanic, we can't guess what other conditions you need without you telling us about them.

The only condition I need is that the player must be in front of whichever way the event is facing when the player touches the event or vice versa for it to trigger. The direction the player is facing is irrelevant.

I am 100% sure of this.

I can not say anymore than that.
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
12,732
Reaction score
11,330
First Language
English
Primarily Uses
RMMV
The only condition I need is that the player must be in front of whichever way the event is facing when the player touches the event or vice versa for it to trigger. The direction the player is facing is irrelevant.

I am 100% sure of this.
You should not be...if the player is not facing the event, then by logical definition the event moved into the player, which means the player must be touching its front.

Did you try the script provided to you hours ago? You made more posts, but you didn't say if that worked or not.
I can not say anymore than that.
I don't understand why you keep posting here to ask other people to help you then give weird refusals to provide the information they need to help you like you asked. Do you think someone is going to steal ideas from you in freaking RPG Maker?
 

NeoPGX

~ King of Cuteness ~
Regular
Joined
May 15, 2014
Messages
864
Reaction score
188
First Language
English (US)
Primarily Uses
N/A
You should not be...if the player is not facing the event, then by logical definition the event moved into the player, which means the player must be touching its front.

Not necessarily, the event could step backwards, which it is not currently programmed to do, and touch the player which would still trigger it.

I actually just now created a test event where a cat walks backwards into the player to prove it.

The event moves back and forth between two certain points on the map. The event is supposed to only trigger when the event touches the player from the front but it is possible for the player to touch the event from the side which would still trigger it. I want to prevent this accident trigger.

Did you try the script provided to you hours ago? You made more posts, but you didn't say if that worked or not.

I saw it but from what I can tell, it seems to be based on direction which wouldn't work for me. So I haven't even bothered.

I don't understand why you keep posting here to ask other people to help you then give weird refusals to provide the information they need to help you like you asked. Do you think someone is going to steal ideas from you in freaking RPG Maker?

Because I feel as though I told everything people need to know.

No more, no less.
 

Htlaets

Regular
Regular
Joined
Feb 1, 2017
Messages
404
Reaction score
217
First Language
English
Primarily Uses
That won't work I'm afraid.

Because the event moves and could touch the player first instead of the player touching it, so it needs to be set up so the player has to be in front of whichever way the event is facing at the time for it to work. The player can be facing any direction. The only requirement is that the player has to be in front.
You can get both the event X, Y and the player X, Y make sure that player facing matches up with relative location (if Py-Ey=1, the player is below the event, if player is also facing up, activate the event). Using labels to jump to a single event activation would make it less cluttered, but it'd still be a slight pain to repeatedly do.
 

NeoPGX

~ King of Cuteness ~
Regular
Joined
May 15, 2014
Messages
864
Reaction score
188
First Language
English (US)
Primarily Uses
N/A
You can get both the event X, Y and the player X, Y make sure that player facing matches up with relative location (if Py-Ey=1, the player is below the event, if player is also facing up, activate the event). Using labels to jump to a single event activation would make it less cluttered, but it'd still be a slight pain to repeatedly do.

So I need to use Map X/Y to determine the location of the player in relation to the direction the event is facing?
 

Htlaets

Regular
Regular
Joined
Feb 1, 2017
Messages
404
Reaction score
217
First Language
English
Primarily Uses
So I need to use Map X/Y to determine the location of the player in relation to the direction the event is facing?
Does the direction the event is facing matter? If it does, that's a factor.

What you'll need:
-Map X/Y of the player. Easy, just use the variable option.
-Map X/Y of the event. Easy, just use the variable option.
-Facing of player.
-Facing of event if you need both to be facing each other.

Then you'll need to find the difference between the X and Y coordinates of the event and player (it'll be 1 or -1 for each variable, and one of the two will always be zero).

So, for example,
If player x - event x = -1
Then the player is to the left of the event.

Then you check the player direction to see if it's to the right.
Then you can use a label to jump to whatever your event does instead of putting the meat in each and every conditional.
 

NeoPGX

~ King of Cuteness ~
Regular
Joined
May 15, 2014
Messages
864
Reaction score
188
First Language
English (US)
Primarily Uses
N/A
Does the direction the event is facing matter? If it does, that's a factor.

What you'll need:
-Map X/Y of the player. Easy, just use the variable option.
-Map X/Y of the event. Easy, just use the variable option.
-Facing of player.
-Facing of event if you need both to be facing each other.

Then you'll need to find the difference between the X and Y coordinates of the event and player (it'll be 1 or -1 for each variable, and one of the two will always be zero).

So, for example,
If player x - event x = -1
Then the player is to the left of the event.

Then you check the player direction to see if it's to the right.
Then you can use a label to jump to whatever your event does instead of putting the meat in each and every conditional.

Can you please make an example event and screenshot it?

I get the idea from text but I need an image of it, something visual for me to get the full understanding of how to set something like that up.

Also I get confused easily. :yswt:
 

Htlaets

Regular
Regular
Joined
Feb 1, 2017
Messages
404
Reaction score
217
First Language
English
Primarily Uses
Can you please make an example event and screenshot it?

I get the idea from text but I need an image of it, something visual for me to get the full understanding of how to set something like that up.

Also I get confused easily. :yswt:
First, in general it's useful to have a "find player location event" in your common events:
it should look like this (this is from an MV project transferred to MZ):
1619300747061.png
With that as a common event, the event in question could look like (need three screenshots since one isn't big enough)...
1619301359395.png
1619301399784.png
1619301415667.png

If you want to see if the event is facing the player, just add more conditionals. With this, nothing will happen unless the player faces the event, if the player does, then the event will skip to the label at the bottom, where you can put what actually happens in your event.
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
12,732
Reaction score
11,330
First Language
English
Primarily Uses
RMMV
Because I feel as though I told everything people need to know.

No more, no less.
This is not a good attitude to have when you're asking for help. If you knew what needed to be done, and all the information that was required for that, then obviously you'd already have done it and wouldn't need to be asking. It seems silly to be saying "I don't know the answer, but you don't need the things you say you need." It's like saying you don't know how to make a pizza, but the chef is wrong when he asks you to get tomatoes.

As far as all of your absurdity about the event walking backwards or sideways...you didn't mention any of that in your original posts and it's not default behavior for events, so you would have to intentionally be trying to do it without telling the people you're asking to help you (because you feel as though you told us what we needed to know). It would need further programming to try to specifically account for that.
 

NeoPGX

~ King of Cuteness ~
Regular
Joined
May 15, 2014
Messages
864
Reaction score
188
First Language
English (US)
Primarily Uses
N/A
This is not a good attitude to have when you're asking for help. If you knew what needed to be done, and all the information that was required for that, then obviously you'd already have done it and wouldn't need to be asking. It seems silly to be saying "I don't know the answer, but you don't need the things you say you need." It's like saying you don't know how to make a pizza, but the chef is wrong when he asks you to get tomatoes.

As far as all of your absurdity about the event walking backwards or sideways...you didn't mention any of that in your original posts and it's not default behavior for events, so you would have to intentionally be trying to do it without telling the people you're asking to help you (because you feel as though you told us what we needed to know). It would need further programming to try to specifically account for that.

My apologies,

I thought I was clear in explaining what I wanted, obviously I was wrong, so I will attempt to explain what is going on using a somewhat similar scenario to what is going on in the game.

So imagine you are walking around a town and in it there a knight who walks in circles along a very specific path patrolling the town. Of course this knight is just an event who can only walk along a predetermined path.

Touching him from the side won't block the path so nothing is supposed to happen. But move directly into the knight's path and the path is blocked so the knight walks into you which triggers the event where they tell you to move out of the way.

That's basically what is going on. Although the event in my game has a bit more going on than simple dialogue.
 

Htlaets

Regular
Regular
Joined
Feb 1, 2017
Messages
404
Reaction score
217
First Language
English
Primarily Uses
My apologies,

I thought I was clear in explaining what I wanted, obviously I was wrong, so I will attempt to explain what is going on using a somewhat similar scenario to what is going on in the game.

So imagine you are walking around a town and in it there a knight who walks in circles along a very specific path patrolling the town. Of course this knight is just an event who can only walk along a predetermined path.

Touching him from the side won't block the path so nothing is supposed to happen. But move directly into the knight's path and the path is blocked so the knight walks into you which triggers the event where they tell you to move out of the way.

That's basically what is going on. Although the event in my game has a bit more going on than simple dialogue.
Then use the event I posted, but instead of checking the player facing, check the event's facing. Also, build direction fixes into the event's move route so it doesn't turn toward the player on interaction.
 

NeoPGX

~ King of Cuteness ~
Regular
Joined
May 15, 2014
Messages
864
Reaction score
188
First Language
English (US)
Primarily Uses
N/A
Then use the event I posted, but instead of checking the player facing, check the event's facing. Also, build direction fixes into the event's move route so it doesn't turn toward the player on interaction.


Apologies, I saw your message before but I was in a rush and only had time to respond to Turan.

The common event you mentioned. That is the main thing checking the player direction right?

So I only need to change it from player to "this event" and it will work like I want it?
 

Htlaets

Regular
Regular
Joined
Feb 1, 2017
Messages
404
Reaction score
217
First Language
English
Primarily Uses
Apologies, I saw your message before but I was in a rush and only had time to respond to Turan.

The common event you mentioned. That is the main thing checking the player direction right?

So I only need to change it from player to "this event" and it will work like I want it?
No, the common event (the first picture) should stay as is since it's checking player location not player orientation, and then be referenced at the start. The parts you need to change are the "If player is facing" to If This Event is facing.
 

NeoPGX

~ King of Cuteness ~
Regular
Joined
May 15, 2014
Messages
864
Reaction score
188
First Language
English (US)
Primarily Uses
N/A
Alright so after much consideration and whatnot, also because of how confusing the event set up in the screenshots are. I have determined that a better way to conquer this problem is to use a conditional branch to check if the player is inside a certain region number when the touch event occurs.

In this case, region number 50. (Subject to change)

I have actually considered why this would work.

1. The event only moves inside the region.

2. It is only possible for the player to touch the event from the side.

3. Because touching the event's sides is only possible from outside the region, it won't run.

4. It is impossible to touch the event from behind. (Moves too fast)

Now the only question is, how do I have it check if the player is inside the region?
 

Latest Threads

Latest Posts

Latest Profile Posts

if a lot of the games that inspire me to continue making games have a pretty mixed to somewhat negative critical reception, what does that say about the games I make? :kaoeh:
Hey Y’all! Here’s Day #8! Another round of applause for @hiddenone my hero yesterday. Kind of still flipping between too hot and too cold, but friends, we’re hydrated.
My boss asked I bring my laptop to work so he could see my game. I show my coworkers, show them some database stuff, and then my boss asks "so can I fight this final boss you've talked about a lot?" :kaojoy:
Finally started working on my first game, let's see where this gets me :)
Gonna repost this since it's currently tied 1-1! We've seen Strength with our adventurers and Charisma with our merchants, so which DnD stat would you like to see in the next NPC for my advent calendar: Constitution or Wisdom?

And a bonus game: if you can guess what type of character each stat will represent, I’ll make your suggested sprite for Christmas! First person to get it wins, so make your guess!

Forum statistics

Threads
136,853
Messages
1,270,745
Members
180,618
Latest member
cinnapuppy
Top