Laser trap

Hi all 🙂

There is something i really don't know how to do it..

I've done a "laser" trap, a laser tilset who appear and disappear every 80 trames, and if the player go in when it's activated he died.
BUT (there is the problem), if the player is already on the laser tilset when it's off and the laser appear the player will not die if he don't moove even if the laser is activate..

I've try many things, like "touch event" and not "touch player"..but i really don't know how to do. :s

Thanks a lot for help all !
You should also check the player's X and Y locations (you can do this under Control Variables -> Game Data -> Player) at the moment that you turn on the lasers (so it should be a part of the event that turns the lasers back on every 80 frames). If they are at an X and Y coordinate that are where the lasers are, run the same processing as when the player walks into the laser event.

This can be done a lot more expediently (and with a much greater ability to scale to things like "are any of these 10 projectiles hitting any of these 40 enemies") using scripting, but assuming that you don't know JavaScript, it's easier to stick to the solution I gave you above - for now.
Thanks Wavelenght for your answer, i don't really understand everything you say me to do.. but i'm still trying to.

"Control Variable" is when i create an event ?
And i want to know if i made a moovable laser, can i do the same ?

Yeah..i don't know JavaScript.. :/
I think i'm on the way, but now i die everytime the event that turns the lasers back on every 80 frames is on haha..


EDIT :

I mean i put the variable edit into the laser event, but even if i quit the laser position (when it's still off) i will die.
The same rules should apply.

https://forums.rpgmakerweb.com/index.php?threads/timed-spike-trap-tutorial.79746/

From my experience with a similar trap, the issue that you're having now is that your player is getting hit with the trap every frame while it's on which pretty much instantly kills them. You have to disable the damage once hit. Here is a full tutorial that ended up as a result to when I worked on this.
Sounds like you're new to the program, so I recommend reading some eventing tutorials. @Andar has links to several in his signature.

The reason you're dying every time the lasers turn on is that you are not checking the player's X and Y coordinate properly. Once you take those coordinates into a variable (which should be done in the same event that turns the lasers back on every 80 frames - immediately after they come on), grab those coordinates (I described how in my last post), then use a Conditional Branch to see whether they are equal to the X and Y coordinates of the laser tiles. Let's say the laser tile is at (5, 19) - then you will want to check whether Player's X variable = 5; if so, check whether Player's Y variable = 19; if so, zap the player because he's standing in the laser field.

If the laser tiles are moving around, then you will need MORE variables to check the current location of the laser tiles (same way you would for the player), and you can check whether one variable (the Player's X) is equal to another variable (the Laser Event's X) in a conditional branch - if so, check whether the Y values are also the same; if so, zap the player.

As you can see, it's a little bit tough and roundabout to try and do these "actiony" elements in RPG Maker, because most of the features are designed to make it easy for you to create traditional JRPGs. But if you develop a really strong grasp of eventing (and especially scripting/coding), you can do almost anything.
Guys really, thanks a lot.
It works !

Not for the mooving laser because i don't try yet, but for the static one. But i will try for the mooving one.
And yeah i'm new with this program, i've learn many things; but not the location tracking ! And i'm not English, so sometimes i don't understand everything at 100%. ^^
I will go see the tutorials you speak about anyway for sure.

Thanks a lot for your time and for help @Wavelength @Frogboy !
I just realized that you were referring to a different problem than the one I mentioned. I did run into yours as well. Ran into a lot of issues trying to get those spiked traps working right. The tutorial should cover the static lasers but you likely won't be able to use Region IDs for the moving ones.
No it was the same, i follow what Wavelength said and i understand it, but finaly i use the Region method to do it with your tutorial. 🙂

For the mooving one i realised that i don't need this, i just have to set the tilset to don't go "throught". Noot perfect, because before the screen deseaper we can see the laser stop a little..but not a huge problem !

Because first tilset go "throught" the player and the event don't begin.

Original thread: https://forums.rpgmakerweb.com/threads/laser-trap.92995/