Having enemies attack player on map?

Hey there!


I was wondering how I'd be able to have an enemy chase the player and inflict damage when making contact, having a small pause that enables the player to be able to run away.


The enemy will continue to chase and inflict damage on the player until they escape.
After a few hits and your hp is depleted, game over.
I've tried to make this happen with events but the enemy will just continually hit the player until they die, player not being able to run away until the event is complete.
Any ideas on how I'd be able to accomplish this?
Hum, it may be not the best way to do it, but I think it should work :


Create a common event which active a switch and desactive it 2 or 3 seconds after.


In the event (the one which hit the player), create another page of event and set the switch as a condition. 


This way, when the player will be hit, the event will switch event page, and you can set a new movement model.


I don't have RPG maker right now so I can't test it, but it should work.
Hum, it may be not the best way to do it, but I think it should work :


Create a common event which active a switch and desactive it 2 or 3 seconds after.


In the event (the one which hit the player), create another page of event and set the switch as a condition. 


This way, when the player will be hit, the event will switch event page, and you can set a new movement model.


I don't have RPG maker right now so I can't test it, but it should work.



I couldn't seem to make it work unfortunately :/
Did you set the pave event order right ? They are reading right to left if i remember well.
Did you set the pave event order right ? They are reading right to left if i remember well.

 
Might have been the custom movement route messing it up? I'm using  Yanfly's Event Chase Player plugin
I can scrap it though if I can find a way that will make it work easier
I'm using it too, but I don't Have RPG Maker on this PC, so I can't send you screens or test things. If this don't work, I cannot help you more since I go back to my house this evening.
I'm using it too, but I don't Have RPG Maker on this PC, so I can't send you screens or test things. If this don't work, I cannot help you more since I go back to my house this evening.



That's alright, i'm going to see if I can make it work with self switches for a while
Thank you very much for the help!
no - the idea to use a common event here is wrong.


You need a two page map event.


On the first page, set autonomous movement to approach, trigger to event touch (or however you use that plugin to follow the player)


In the contents, you place two commands: one is the damage command (change HP on player/party), the other a control self-switch A = ON.


The second page needs the conditions set to activate on self-switch A, and the trigger set to parallel process.


In the contents, you again need two commands: the first one a wait for however long you want the event to stop chasing (in frames, wait(60) is a second), and then a control self-switch A=OFF to reactivate the first page.


If you want all enemies to stop even if only one hits the player, then use a general switch instead of a self-switch.
no - the idea to use a common event here is wrong.


You need a two page map event.


On the first page, set autonomous movement to approach, trigger to event touch (or however you use that plugin to follow the player)


In the contents, you place two commands: one is the damage command (change HP on player/party), the other a control self-switch A = ON.


The second page needs the conditions set to activate on self-switch A, and the trigger set to parallel process.


In the contents, you again need two commands: the first one a wait for however long you want the event to stop chasing (in frames, wait(60) is a second), and then a control self-switch A=OFF to reactivate the first page.


If you want all enemies to stop even if only one hits the player, then use a general switch instead of a self-switch.


Okay, I managed to make it work through switches!
I had custom movement to approach player (everything set to event touch) and used changed HP to -100 with sound effect & animation, turned control switch A on,
and had control switch A wait 60 frames before turning switch B on that had the same commands as the first event!

Now to figure out how to make my player die once HP is deleted, as they will be able to keep roaming around at 1hp. Guessing that one should be easy
Death on 0 HP should be automatical unless you specifically forbid it - check your database, system tab if knockout by slip damage and knockout by floor damage are enabled or not
Death on 0 HP should be automatical unless you specifically forbid it - check your database, system tab if knockout by slip damage and knockout by floor damage are enabled or not



'knockout by slip damage' and 'knockout by floor damage' were unchecked, I enabled them but 1hp still remains.
Did you check "allow knockout" in the change HP command on the event? If yes, try to start a new game. If that still doesn't help one of your plugins might cause this, or you might have given the actor the immortal state or so
Did you check "allow knockout" in the change HP command on the event? If yes, try to start a new game. If that still doesn't help one of your plugins might cause this, or you might have given the actor the immortal state or so



Ah yep! That was the mistake I made, I didn't check allow knockout. 
Thank you very much, everything works perfectly now!

Original thread: https://forums.rpgmakerweb.com/threads/having-enemies-attack-player-on-map.65207/