Trigger event at lower level

Did exist a way script or anything else(maybe except parallele event) that can process code when player touch but with event not at same level then player?


First let say I have an alternative solution already for what I want to do and this question is more for be able to keep a logic in my game and avoid a lot of unasasary code.


Basicly, it's just that I want that if I put an event wih level under player and put on even touch or in player touch(I don't know the difference to be honest), that will execute the code inside.


Let explain, I have object that move on the map, of course they can move over objet on floor(level under player). But I have to create a arrow event that let player enter on certain way on the tile only. They can get out of the tile by any direction. But for doing that I must curently put code at same level then player. So I have to put a lot of code jsut for make player enter on the tile, I have to handle a parralele event too because tile will appear over the player so I need to activate switch 4 with the same tile under plyaer and activate back same level then player when he leave the tile. Complicated but work. But if I want to push an objet over this tile, that will not work because of passibility will return false because it's 2 event at same level. Of course I can do aditional code for check for a special note tha autorize to pass using the same complex code but still...


Everything will be a lot more easy with a pluggin that will autorize to execute code with a event touch while it's level under player. Thanks for your help.
Ok first of all the difference between player and event touch should be that player touch i triggeer when the player touch the event while the other cna be triggered ALSO with the event touching the player while moving.


For the second part... i'm not sure i understood your problem, i'll try to give a second read.


EDIT: So, you want that the player can go on the event only through one direction but he can exit whereever he wants?


Can you make a practical example of what u want? what is this event?
@XGuarden: Please post a screenshot of your event, because I think you made it too complex and it could be handled more easily.


As for your other questions, the priority of the event changes the position from which the player can enter it - if the event is below player, then it will be triggered when the player stand on it. If the priority is same as player, the event will be triggered by the player standing next to it (from any direction).


Player touch requires the player to move on the event, event touch requires the event to move on the player (which can't happen unless the event moves)


If you want to prevent the player from entering the event position depending on the side from which he enters, I would make it same as player and triggered on player touch, and then check the player facing - if he comes from the wrong direction do nothing, if he comes from the correct direction set a move route on the player that turns the event to through and moves the player on it. That is a bit tricky with the timing and depends on what exactly you're trying to do (which is why we need the screenshot to help), but it doesn't require parallel processes.

I give you a video of my event that curently work. But It's cause trouble because did't work well.


- You can see on this video that I use a event for my arrow because I can trigger even with event under hero curently.


- You can see that I can enter the hero from any directin except the one where the arrow pointing to.


- You can see that I can push the ricebox but I can push it over the arrow event because it's on same level.


If you asking why I put that much code it's because I alwat do plugg and play code, all my event must work by copy and past.


Of course arrow are not in common even curently because it's still on progress.


So I have two choice, be able to trigger an even when player touch a event on floor(not from parralele event, it's ugly)


Or to put a event on same level then player then make some code for silutate he go on the arrow and some other code for when he left the arrow for activate back the event at same level then player.


Any idea?

View attachment etst.avi
Ok i'm not sitll entirely sure on how should work, in the video semms like the palyer cant go on the arrow just when he comes from the from (so if the arrow points down he can come in from top, right, left but not from below). Is it like that?


Second thing, once the player is on the arrow, where can he go? You said he can exit how he wants right?


Assuming i understood correctly i made i pluging that does that (instructions in the plugin guide)

View attachment ArrowsPlugin.js
Ok i'm not sitll entirely sure on how should work, in the video semms like the palyer cant go on the arrow just when he comes from the from (so if the arrow points down he can come in from top, right, left but not from below). Is it like that?

YES

Second thing, once the player is on the arrow, where can he go? You said he can exit how he wants right?


YES, he can go out by any way.


Assuming i understood correctly i made i pluging that does that (instructions in the plugin guide)


I will try it.


View attachment 41975

How about performance, did a pluggin is faster then my code? I try it.. and give you news..
It should be hundreds times faster in my experience, this should basically not affect the code speed at all 😉


Btw unrelated suggestion, the arrow graphic is a bit confusing, try to use a step graphic as in pokemon for example ( but at that poin maybe you make the palyer and the block do a little jump so is not worth)


Otherwise a graphic like this one


example.png


like little arrows on the blocked side to moke clear that everithing happens just on one side.


maybe with triangles instead of ^^^^ though


EDIT


One thing i forgot to tell you, as for now the arrow blocks EVERY character/event who trys to come in from the arrow direction.


If you want just the player and the blocks to be stopped by the arrow i have to add an extra bit of code.


EDIT 2


I tested the events it doesnt' work for them, i solvind the problem 😛
I just try it, it's work like my current code(without enoying code of course =:0)


Unfortunatly, he have the same limitation then my code. Even if I put under player, I can't push objet over it.


Usually on event under player, we can push event over it. 


I use this code for collision check if that can help:


this.character(0).canPass
I think is just a metter of correcing a few lines of code... i will update you soon


EDIT


FINALLY it should work View attachment ArrowsPlugin.js  😀


It should not mess anything with the discrete modifications i made, is something strange happens tell me
99% perfect, I forgot one thing... my fault....


Of course for what he have to do it's work. 


But in my specific case, Objet can be push over the arrow from any direction, but can't go by himself.


In other work, only alive objet have this restriction but not box of sand.


For exemple, I can push a boxofsand over the arrow from any side, but monster have same restriction then me.


For compatibility with what other user can need, maybe jsut adding two option with yes or no:


Player can push event over, Objet can go by himself over.


But I must admit that my box of sand that I use , use move command for push objet so im not sure how it's cna be handle.


Maybe by a tag, but some objet will have multiple tag. Not sure if it's possible to have many tag.


Im sorry if I ask to much... But you can sure that will be a real great game.


If you want to know exactly what I try to do, in fact I try to reproduce lolo adventure game on NES but better of course.


One last point, I can do it by event code direction but if you want to put it a fully fonctionnal way:


The arrow are not static and can change direction, I did't create the code for it curently.


If player have X objet in inventory and use in in front of the arrow(where we are blocked) the will turn the arrow.


They have 3 different items that can do it, right turn, left turn, flip arrow. These are 3 different items. 


I can do it by code, but if you have time and are not to tired of my request, that will be great.


I think that can need 3 more parameter with id of each. When used, qunatity of the objet do -1.


Thansk for your help you are great =:0)


Small edit, it's appear that when I put sandbox on the arrow, if I go to the side that I can't go on arrow, If I try to push the objet that work. It's seem normal because how my sandbox is programmed. Maybe I jsut need to find a code for my sandbox that detect if he was on the arrow and if I try to push it from the side that I can't. I start tinking that my sandbox is a nightmare haha
Ok, making the arrow not block the blocks should be easy, at this point i ask you if we can merge the arrow plugin and the alsers plugin since i need some things that are in the other one.


For the little bug i imagine it happens because you can pass on the block when you are pushing it maybe (like you make the block through or things like that). If that's the case the problem should be that the game to see if you can either pass or not somewhere just checks the highgest event in that tile and ignore the others below it. This is because i think it interprets it as a "ladder" ontop of an obstacle.


If this is the case and you make the block "through" or change is priority to avoid bugs or if the block is allways in one or both of the states, the solution is this:


make the block at the same level of the player (and not pass through) and set the activation on player touch.


In the event instructions move this event in the pushed direction and AFTER put the istruction to move the player forward. If you do the other way around it will not work, because he will try first to move the player in the tile occupied by the box and then move the box.


EDIT: 


Since i'm warking on all of your plugins at the moment i move this thread with the other one THIS


this way we can work better

Original thread: https://forums.rpgmakerweb.com/threads/trigger-event-at-lower-level.64685/