—
You can do like this,
1. give each monster an instance variable by right click at the object > instance variable > add > Name it "Team" and give Initial value to either text or number; text as A/B or number as 1/2
2. On the event, Object(monsterA) on collision with another object(monsterB)
3. Add another condition to the event | object(monsterB) compare instance variable (team variable) = to B or 2
4. give action to the event | monster play "atk" animation
*meaning if monster from team A hit something and that thing has instance variable of B, it will atk, else it won't
* and you have to give the same concept to monster of team B also to see if it collide with monster team A.
This should solve your problem.
Cheers!