Tile event we can walk from specific direction

I want to create an event. The event was an arrow on the floor.  The player can walk on it only if he come from a direction that was not the direction pointing to. So for exemple


if the arrow point to the right, if the player try to walk on it from the right, that will not work. If he try to walk on it from the left, top or down, that will work.


I tryed to use the direction inside tileset option, but it's work like a wall and if im already on the arrow, I can't walk in the direction of the arrow.  Also, that was not an event if I do that and avoid me to add coding. Any idea? Thanks for your great help.
This tutorial on the official RPGMaker blog may be relevant/helpful. Link
You don't even need complex eventing for that.


If an event uses a tile as a graphic, it will also adopt the passability of that tile. So you can make your arrows in tiles on an unused B-E sheet of your tileset, give them directional passability there and the player will only be able to walk in the direction of the arrow he's standing on (if you set the passability that way)
No that can't work. I try. I don't want to force player direction. I want to do like in lolo advendture. Inf im on the arrow, I can go in any direction I want. But for be able to walk on arrow, I must not come from the side the arrow poiting to..
This tutorial on the official RPGMaker blog may be relevant/helpful. Link

By the way, the solution on the link was  not a good solution for arrow path even if it's not what I trying to do. With parallele event, player can still keep press an arrow and be able to not follow the path.
The other option is to create an event using two of the same tiles with different passabilities enables.


1. On page 1, use the tile with passability set so the player can only enter on one side


2. Set the page to run On Player Touch and have it turn on a self-switch to activate page 2


3. On page 2, use the tile with passability set so the player can move in any direction


The biggest flaw with this option is you'll need a way to turn the self-switch off when the player leaves the tile so the event defaults to page 1 again (so the player can only enter from one side). You can do this by setting events around the tile and using the OuterSelfSwitch plugin to change the self-switch of the target tile.


Hopefully this makes sense.
This can be done by makeing a cordinates reader using a parrellel common event process that records player x and y coords to variables, and blank events set up in the spots you don't want players to be able to walk on when they are standing on certain map coords.


If you don't want this common event running all the time, you can set it to be activated by a switch. 


You will need two variables. I called them "Location X" and "Location Y"., and they are occupying 2 and 3.


You will need some kind of switch to activate the parallel process. That switch can either be something physical that the player activates (like a normal event), or it can be autorun, or whatever you want to make that switch activate.. But it must activate somehow. 


Common event would look like this: 

Spoiler
5b4e0567be.png



Next you need to place events everywhere you do NOT want the players to be able to step on: (the one in the top right is an autorun you'll need)

Spoiler
151d11f0ed.png





The four events placed where the arrows are pointing are blank event pages with only two things:


Priority: Same as character


Options: Through


Next, you'll want to create a new event anywhere that will autorun when the switch is activated. That event should look like this:

Spoiler
9be08e8bb4.png



I named each event it's respective coordinates to make it easier to map. You'll need to repeat the above contents for each of the events you placed, and adjust the "If" requirements for the locations of each of the arrows... You can place all of it in the same event, Or alternatively, you could also place all of this in the same Common Event Parallel process.. Either way works.


What this whole process will do, is that while that parralel process is running, it will record the player location.. If you have all the coords and "if" statements set appropriately, it will turn the "through" off on the appropriate event to prevent the player from stepping on the event... Once the player steps off the arrow in any other direction, the "through" is turned back on for that event so the player can freely walk ontop of it.


It is not short and simple, but it does work.


Oh.. and one last thing. in order to assign the coords to a variable, you need to go to Control Variables.. -> Game Data -> Player -> Map X/Y


Hope that's not too confusing.. if you run into any problems with it, let me know! screenshots will also help.


EDIT: (I just realized it would be much easier to just name the events themselves the same coordinates of the arrow that should cause it to activate.. Will save you some time and work mapping them out in the event contents.)
In fact I usually use more advenced script way. Your solution is not bad, it's a good idea, unfortunatly will not work in my case. The reason is simple.


Why I did't do that it's because all arrow event can move, can change direction and can be close one to other. So I can't do that this way.


I try to find an other way, I will try some scripting in case of.
I found a code that can work great. But for finish it, I need some help.


I need one of these thing:


Be able to triger event by touching him event if the event is under the player.


OR


Be able to change the level of the objet by code(under, same,over)


OR the best


Be able to make the event appear under the player event if he was same level.
I'm quite sure I gave you a script call to change / read the priority type of an event in the bullet on map example...


After checking, I did.


$gameMap._events[your_event_id]._priorityType = x //0-> below, 1->same 2->over


You don't have to use scripting to move an event on the same location than the player. You can use the transfer event command, set variables to the x/y of the hero and transfer it there. If you want a script call: here you go:


$gameMap.event(eventId).setPosition(x, y)


That takes care of solution 2 or 3.


I don't think 1 is possible unless you completely change how event collision works, and that is outside of script calls power.
Yes your right you told me how in another post and I forgot.


After some test, maybe I get some trouble. I create a cute working event. but...


solution 2 work great..... but I forgot that I can't restaure it after player leave the arrow case.


Of course I can do it with parallele event but I alway try to avoid that.


For the second option, i tryed but make appear the tile over the player unfortunatly.


I think I really need a way to make it appear under the player =:0(
How are you moving the event?


TdZiLlh.png



This works for me. The event does appear right on top of the player. However, the player is able to move from the tile even if it is on the same tile as an event that has the same priority as his. I think this is intended behaviour to prevent the player from being stuck.


If you're calling that properly and getting the same result, it means we can scrap that solution.  
I understand the part that you don't understand, Maybe I was not clear and it's why..


The event need to appear UNDER the player, not on top. 


I will show you a working event, it's work but I want to remove the parallele event from it.


Also it's a little bit buggy when player leave the arrow by top or right.


Apparently each time we change item tab with selfswitch, player position (0,1,2) reset.


Sans titrvvcccdfffdffffffe.png


Note: I updated the code a little bit and now perfectly working on any side. But still.... I looking a way for avoid appallele event.
Ah, I understand that you don't want every event of yours to be a parallel process, and you're right. It will cause lag.


If you don't find a way to do it without a parallel process (I don't see one right now), just use a single parallel process that does the check for all your events. 


Its the same principle as with the bullet collision, have it cycle through a list of your arrow event ids (probably most easily done in an array) and do the checks accordingly.


By doing this and adding a small wait (about 3 frames should do), it will minimize the possibilty of lag and get you the desired result.


You'll just have to use script calls to set self switches and use a loop.
In fact that not create lag because player can be on only one arrow at time and parralle event stop when leaving this arrow.


But still bad coding to me.

Original thread: https://forums.rpgmakerweb.com/threads/tile-event-we-can-walk-from-specific-direction.64410/