How to set a touch trigger that changes the sprite?

Hello everyone. It's my first post! and there goes my explanation:

I have a cockroach sprite that I'd like to have running randomly by all the place. I can manage to do that, no problem. 

What I addionally want it's that when you walk over it changes to another sprite. ( a crushed cockroach)

I tried different ways. I managed to make it work with two event pages and setting everything by the custom patron of the autonomous movement, but the problem is that it needs a sprite on the graphic area (the second event page), if not, when I walk over the sprite, it lags for a second and doesn't let the action to be inmediate. 

I don't want to add the  same single sprite because I'd like to mantain the four different angles of the crushed cockroach depending on what angle its facing when it got crushed. 

I don't know if it's possible. (Or if you understand what I'd like)

Cockroach alive
[IMG]http://s13.postimg.org/7fh2dfujr/Cockroach_Sprite_V2.png[/IMG]

And the dead ones 
[IMG]http://s13.postimg.org/wa55l94rr/Dead_Cockroack_Sprite.png[/IMG]

Anyways, looking forward a solution. Thanks in advance! and also happy new year everyone!
  
If you want to keep it permanent use a self switch. On the second event page turn self switch condition to "A". On the first page with the regular roach, put in Self Control Switch A. Now when the player steps on the roah it will switch to the second page.
Please post a screenshot of your event pages.

The way with two event pages should work, we need to see your commands to give you advice on how to change them
Ok, I think I got something different. (I had to redo everything again because I deleted the event weeks ago)

Now it kinda works, but I don't know to make the crush sounds only once.

These are the event pages I have now.

[IMG]http://s27.postimg.org/elc4ioqgz/image.png[/IMG]

(I know there's a typo, forgive my spaghetti fingers)

Also I'd like to know if there any way to get the roach to mantain dead in the place you originally crushed it and after a couple of minutes or more  it would permanently dissappear. 
No, you don't need Set Move Route here (and on the second page do you realise you're changing the PLAYER'S sprite to the crushed cockroach?)


Just put the regular sprite on page 1, with the Control Self Switch A = ON as the command.


On page 2, condition the page by self switch A as you've done, and select the crushed sprite as the graphic. No event command needed.


To make it permanently disappear after a while is a bit more tricky - you could add a Wait for X seconds and then turn on another self switch that conditions another page with no sprite, but that would not work if you left the map while it was counting down. I do have a MV plugin that gives additional timers, that works even when you're on a different map - you could use it to add a command to page 1 to set a timer to turn on self switch B after X seconds.
Yes, it worked fine. But when I select the crushed sprite I can only select a single sprite. I'd like to have a variable crushed sprite depending on where  the roach was facing at the moment of the event being triggered.   

Also the dead sprite it's still there, but, for example, if it is dead in the bottom of the map and then I go out and enter to the area again, it appears on where I originally put the event, not on where I crushed it. 

Thanks a lot so far for the fast replies, too.
IIRC, Ace does not reset the direction when you switch to a new event page. I remember having to cater for that in a cutscene in my game.


When a map is loaded, all the events are placed at the spot you put them in the editor. You need to use a script to make it appear somewhere else. I have a Remember Event Position script for Ace (sorry - I thought for some reason you were using MV, so I referred to an MV plugin above for the timer. I do, however, have the same as an Ace script). If you grab that script, on the first page of the event, do a call to the script to save the event's position, and it'll keep appearing in that spot whenever the map is reloaded.
That sounds pretty good actually, thanks. There's a link for that script?
Remember Event Position


I just checked the thread for the timers, and the first page of posts has been lost. It's also not in my pastebin. I think I need to pull it out of my current game and post it again.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-set-a-touch-trigger-that-changes-the-sprite.54198/