Make an event trigger another by touch

I'm doing a push rock puzzle, I want to make an animation when the rock event reach the target event and both event to be erased after that.
I believe I need to use event switches but I'm not sure about how to do it, I also have no idea about how to make one event erase another, I only saw option for erasing the event itself but not others.

Could u help me ?
You don't want to erase but turn their Selfswitch on instead
#1:
So i assume you have rock1 & rock2
First you need to have a Parallel event which record rock1 & rock2 location on map into Variables
upload_2018-2-3_8-4-32.png


After that, it will run a condition branch check those 2 rock location:
Let say now i have var1 = Rock1x , var2 = Rock1y , var3 = Rock2x , var4 = Rock2y
>>> we will run this script in Condition Branch check:
Math.abs($gameVariables.value(1) - $gameVariables.value(3)) == 1 || Math.abs($gameVariables.value(2) - $gameVariables.value(4)) == 1
upload_2018-2-3_8-10-24.png

upload_2018-2-3_8-11-27.png
You don't want to erase but turn their Selfswitch on instead

No I really want to erase it, because I'll have that reset button. I don't want people to redo the puzzle.
that why you have to turn them off by Selfswitch/ Switch ( If you erase them, they will re-appear after you re-enter map)
What is on your target event? Why do you have an event there at all?

If it's not moving, I'd just use a region to paint that tile, then in your rock event, each time it moves, check if it's on that region. If it is, turn on a switch that conditions the second page of the rock event (which has no sprite and no commands - this is what makes it disappear permanently), and also conditions whatever event you want to update when the puzzle is solved - either a door that opens or an NPC that does something else after you've solved the puzzle.

Sorry, how do I get here ?
What is on your target event? Why do you have an event there at all?

If it's not moving, I'd just use a region to paint that tile, then in your rock event, each time it moves, check if it's on that region. If it is, turn on a switch that conditions the second page of the rock event (which has no sprite and no commands - this is what makes it disappear permanently), and also conditions whatever event you want to update when the puzzle is solved - either a door that opens or an NPC that does something else after you've solved the puzzle.

I'm using a crystal for the rock and a hexagram for the target.

I'm using an event for the target because I run out of space for tilesets.

How do I make the event check the position of the rock, I couldn't find this out.
You don't. You use a region under the target event, then you use Control Variables on the rock event to get the rock's x and y position, and Get Location Info to get the rock's region into a new variable. Then you use a conditional branch to see if the region is the one you used on the target.

How are you going to let the rock move onto the same tile as the crystal? You'll have to make the crystal Below or Above Characters, or Through.
@Isabella Ava I need to create one variable for Map X and another for Map Y, right ?

Could you explain for me script ? why are we using == 1 ?
Hey, i am back 🙂 actually there is a mistake in the code
(Math.abs($gameVariables.value(1) - $gameVariables.value(3)) == 1) && $gameVariables.value(2) == $gameVariables.value(4)) || (Math.abs($gameVariables.value(2) - $gameVariables.value(4)) == 1 && $gameVariables.value(1) == $gameVariables.value(3))
this code checking if either x of rock1 = rock2 & y of rock 1 is next to rock2 (+-1) and viceversa
upload_2018-2-3_9-20-29.png


But actually @Shaz mentioned method is even more simple, look, for example i paint my destination tile in region79
In the Rock event, everytime it moving (by your method?), i will run this script in Condition Branch check:
$gameMap.event(this._eventId).regionId() == 79
and then if return is TRUE i will turn switchON to destroy the rock

upload_2018-2-3_9-22-24.png
@Isabella Ava I don't want to do Shaz method, i already started with yours and it's almost done.

I figure it all how to use the script but for some reason the event happens before the rock reach the target.

What is that ==1 in the script
You might need to check the Wait box on the move route event, so the check only happens AFTER the rock has completed moving.
You might need to check the Wait box on the move route event, so the check only happens AFTER the rock has completed moving.
The event is happening when the rock is far from the target.

The wait box is checked, @Shaz. That caps lock was unnecessary
did you replace the old script with the new one i posted? it was my mistake :LZSoops:
(Math.abs($gameVariables.value(1) - $gameVariables.value(3)) == 1) && $gameVariables.value(2) == $gameVariables.value(4)) || (Math.abs($gameVariables.value(2) - $gameVariables.value(4)) == 1 && $gameVariables.value(1) == $gameVariables.value(3))
That caps lock was unnecessary
it was for emphasis. It's not like I was yelling at you - if that was the case, the whole thing would be in upper case.
(Math.abs($gameVariables.value(1) - $gameVariables.value(3)) == 1) && $gameVariables.value(2) == $gameVariables.value(4)) || (Math.abs($gameVariables.value(2) - $gameVariables.value(4)) == 1 && $gameVariables.value(1) == $gameVariables.value(3))

The event is not triggering now. Could you explain to me how the script works ?

The target is on 24,9. Should the script be == 1 or something else ?
@cybarxz You'd better show me how you handle your events. The script is nothing but compare variables together ( == 1 ) is checking if result = 1 or not
Well I managed to do it.

I'm using script: $gameMap.event(11).x === 24 && $gameMap.event(11).y === 9

11 is the ID number of the rock that I'm pushing
24 is the x position of the target
9 is the y position of the target.

Thanks 4 the help people

Original thread: https://forums.rpgmakerweb.com/threads/make-an-event-trigger-another-by-touch.90814/