Help with making floor spikes!

I made floor spikes, and when your player walks over them, your screen flashes, and you take damage and also take a step back. Then I decided to make spikes that retract into the ground every once in awhile, then come back up, then go back down, and so on. It works perfectly besides one problem! If you're on the spikes when they come up from being completely retracted, nothing happens. You take no damage, the screen doesn't flash, and you don't take the step back. You can just stand there as if the spikes weren't there!

How can I make it so when the spikes come up while you're on them, they still do the normal properties of the spikes?

SCREENSHOT.png
You'd have to have a page for them being down that runs as a parallel process event, and the moment they come up, have it check if the player's location is the same as its own location.
You'd have to have a page for them being down that runs as a parallel process event, and the moment they come up, have it check if the player's location is the same as its own location.
I know I'll sound nooby, but how do I make it so it checks if the player is on the same space as the event?
Put this in a conditional branch:

Spoiler
$game_player.x == $game_map.events[event id].x && game_player.y == $game_map.events[event id].y
I'll apologize now in case the code is incorrect.
Instead of [event id] you can actually type [@event_id] - this way you can copy and paste your spikes all over, and don't have to manually enter each event's id. It says "the id of THIS event".
@Shaz - Thanks for correcting the error in the code.  I just wrote it based from what I recall.  Sadly, it was more than a month ago when I last used VXA that is why I wasn't able to remember every detail.
You did pretty well even if you'd only used it yesterday 🙂


Oh - that game_player.y should have a $ in front of it too. Apart from that typo, I think the syntax looks just about perfect 🙂
I was having this issue and tried the script but I got an unexpected tIDENTIFIER error saying that it wants one of these ']' but I have no idea where to put it I did copy and paste it and make the changes shaz suggested also.
Are you saying you got it to work, or that you're still having troubles? The [ and ] should be around both instances of @event_id
no it isn't working [and] are around both of the @event_id  this is the full error message

Script 'Game_Interpreter' line 450 SyntaxError Occured

unexpeted tIDENTIFIER, expecting ']'

...r.x==$game_map.events[@event

id].x&&$game_player.y==$game_ma...
@event_id has a _ in the middle. In both places.
thank you thought it was odd that there was a space instead of an "_" that fixed it. also thanks for the solution to the retracting spikes and dmg orathan and shaz and thank you mahoken for saving me the trouble of asking myself.
Going to close this now, as I assume the OP would have come back by now if there was a problem implementing any of that.


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-making-floor-spikes.20297/