How to make a npc that I can attack but it also can attack me?

I tried making it but I only could do either it attacks me and I cant or I can but it cant. I dont know how to make both things at once, any help?
The player attacks when you press Z and when both get hit the screen goes red for a second and in the case of the player they take damage, in the case of the npc it dies. I do not have the events here but it was something I tried in the past and couldnt work out. It would be a simple fight method, not more complicated than that
I think it would help if you gave us some more information. Please edit your opening post to include:

Under what circumstances do you want the NPC to attack you?
What form does their attack take?
When you say that the player can't attack, what sort of attack was the player trying to do?
I assume that this is not happening in a battle scene, so what initiates the fight?
A screen shot of your event would be a huge help. Please use Alt+PrtSc so that the shot is only of the event window, not your whole desk top.
That boy Pikachu is probably making an ABS with the talk of events and there's 3 possiblities:

-ABS script, but not likely with its calls
-Evented ABS, which can be aided by following examples.
-Self-Crafted ABS, which may differ from my ABS and would be hard to help.

Generally speaking, though, I'm assuming this is a case of Evented ABS and one of the issues would be the Event Trigger, as we would either assume Press Button and Event Touch, but that would trigger with a button controlled by the player or by the movement of the event. The other solution would be to use Parallel Processing, though as this would run the code when the game is running, we wouldn't write the attack/flash code by itself but rather as the content of the action that occurs.

For example, you would normally press the button to trigger the event, but in PP, you'd need to check for this button and if the player is near and facing this event (and probably a switch so that it registers the button press once instead of being held).
This seems harder than I thought... I'll try it tomorrow but if I don't get results I think I'll pass. This idea was for something secondary so no big loss

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/how-to-make-a-npc-that-i-can-attack-but-it-also-can-attack-me.97036/