Spikes on the floor with a certain order.

For my game, I'm making a room that has your typical spikes on the floor. I know that you have to use region ids for the player to take damage, but how can I do it when the spikes move like this?

pinchoshelp.gif
I know that you have to use region ids for the player to take damage
I think not doing that might work better in this case, actually.

I threw together a quick proof of concept for you in MV.

Set up your event like this:
temp1.png


For that script call to work, you'll need the following code in a plugin. If you don't want to use a plugin, you could make an autorun event on the map and put it in a script call, followed by a Control Self Switch A = ON command.

JavaScript:
Game_Interpreter.prototype.checkPlayerHere = function() {
	var ev = $gameMap.event(this.eventId());
	if(!ev) return false;
	return $gamePlayer.x == ev.x && $gamePlayer.y == ev.y;
};

The key points on the left-hand side are the custom move route and the Parallel type. The move route should look like this:
temp2.png


You'll probably want to change the wait values both in the move route and the event contents – I set it to 5 for testing, but that's quite slow. If it's best with no wait at all in the move route, you might need to fiddle with the event commands to avoid lag (possibly move the wait into the inner conditional and figure out what value works).

Again, this works in MV, and would probably work in MZ as well. The concept probably works in other makers as well, but the JS code would need to be translated into Ruby.
I think not doing that might work better in this case, actually.

I threw together a quick proof of concept for you in MV.

Set up your event like this:
View attachment 348465

For that script call to work, you'll need the following code in a plugin. If you don't want to use a plugin, you could make an autorun event on the map and put it in a script call, followed by a Control Self Switch A = ON command.

JavaScript:
Game_Interpreter.prototype.checkPlayerHere = function() {
    var ev = $gameMap.event(this.eventId());
    if(!ev) return false;
    return $gamePlayer.x == ev.x && $gamePlayer.y == ev.y;
};

The key points on the left-hand side are the custom move route and the Parallel type. The move route should look like this:
View attachment 348466

You'll probably want to change the wait values both in the move route and the event contents – I set it to 5 for testing, but that's quite slow. If it's best with no wait at all in the move route, you might need to fiddle with the event commands to avoid lag (possibly move the wait into the inner conditional and figure out what value works).

Again, this works in MV, and would probably work in MZ as well. The concept probably works in other makers as well, but the JS code would need to be translated into Ruby.
I tried to replicate it, but when the player steps, nothing happens.
Did I do something wrong?
You could try removing the wait in the event contents. I think that might cause some other problems (in my testing, spikes are getting out of sync with each other when offscreen), but it should make it trigger every time the spikes are up.
you could have also had one parallel event increment a variable, use a modulus so that its values can ever only be 1-5, and then set each of those events as player touch with page conditions for each being specific variable values.
you wouldnt need to check the pattern or set up movement routes. youd just have 2 pages where the default is that the spikes are down and an active page where theyre up
I don't think that works without a plugin? You can only check if a variable is greater than or equal to a specified value, but for this use-case you need to check exactly equal to. It would probably work with something like HIME_CustomPageConditions though… but I'm not sure how the two intermediate frames of the animation would fit in with that model. (The original poster appears to have chosen not to use them, but personally I would prefer to use them.)
the loop of the 4 rows, the top 3 (start in middle has those wait.

30, 45 // row 1
25, 40 // row 2
20, 35 // row 3
15, 55 // row 4
5, 50 // row 5

numbers are wait, so you have a move route of 30 wait, same moveroute
below it, but with 45 wait in between, 4/5 frames per turning (down/left/right/up)
and back down.

so you have the effect like: 1,2,3,4,5,3,4,5,1,2,3,4,5,3,4,5 in repeat session.
You can only check if a variable is greater than or equal to a specified value, but for this use-case you need to check exactly equal to
ah, forgot there wasnt a choice there, but it just means the logic just needs a slight adjustment. since the variables are integers, you can make equal cases by using equal to or greater than comparisons.

base case is the spikes are disabled, theres an active case where the spikes are up and its requirement is the variable is of equal or greater value to something, and then an additional active case to disable the spikes again for the value above the previous one

Spoiler: spikes
1756390389968.png

1756390395850.png

1756390399065.png
Spoiler: controller
1756390479869.png
I had forgotten that touch events arent triggered when the event is activated while a player is already on them, so the activated spike pages are parallel and just check if the player is on them. it didnt need script, but its easier for me to type that than to event it 🤣
Code:
$gamePlayer.x === $gameMap.event(this.eventId()).x && $gamePlayer.y === $gameMap.event(this.eventId()).y
spike-ezgif.com-optimize.gif


Switches could have also been used instead of variables, but depending on how many possibilities of active spikes there should be it might take a bit more to set up.
it didnt need script, but its easier for me to type that than to event it 🤣
Yeah, I just think it's clearer to put it in a function like I did in my previous post.

I ended up with something pretty similar to robro33's solution, but using HIME_CustomPageConditions and my custom checkPlayerHere() script:

Spoiler: Controller
temp1.png
Spoiler: Spikes Page 1
temp2.png
temp3.png
Spoiler: Spikes Page 2
temp4.png
temp5.png

Note that the move routes are set not to repeat. Then the only thing I needed to change on individual spikes is the frame I'm checking for in the conditional statement (on both pages).
found out it can be done without the active spikes being parallel. they can be changed to player touch and the controller can use a base engine script call to run the spike event if the player is on it when it changes. I thought it hadnt worked earlier, but it seems to have just needed a minor delay.

Spoiler
Spike
1756395227323.png

Controller
1756395235787.png
That seems like it would trigger any event the player happens to be standing on, not just the spikes. It might be fine if you don't have any other events the player would stand on, though.
That seems like it would trigger any event the player happens to be standing on, not just the spikes
any player touch event the player is standing on. other trigger types wont count, and if the map has other player touch events that arent spikes that may be stood on, a conditional branch that checks the region the player is in can be used to filter them out
ah, forgot there wasnt a choice there, but it just means the logic just needs a slight adjustment. since the variables are integers, you can make equal cases by using equal to or greater than comparisons.

base case is the spikes are disabled, theres an active case where the spikes are up and its requirement is the variable is of equal or greater value to something, and then an additional active case to disable the spikes again for the value above the previous one

Spoiler: controller
I had forgotten that touch events arent triggered when the event is activated while a player is already on them, so the activated spike pages are parallel and just check if the player is on them. it didnt need script, but its easier for me to type that than to event it 🤣
Code:
$gamePlayer.x === $gameMap.event(this.eventId()).x && $gamePlayer.y === $gameMap.event(this.eventId()).y
View attachment 348495

Switches could have also been used instead of variables, but depending on how many possibilities of active spikes there should be it might take a bit more to set up.
Yes! This is exactly how I wanted it! The variables do make it work better.
There was a problem with the game over sequence, but that was a mistake on my part, fixed now.

Original thread: https://forums.rpgmakerweb.com/threads/spikes-on-the-floor-with-a-certain-order.179814/