this command ,,a unit attacks'' doesn't exist, i would be grateful if you tell me another even tfor this trigger 2 workIt goes something like this:
Make an integer variable "Your_Variable"
-------------------------------------------
Events: A unit attacks
ty this maked it workOh yeah. You should use "a unit is attacked" and then set an extra condition that says something like "attacked unit belongs to player X" or "attacked unit belongs to an enemy of owner of YourUnit"
The trigger I posted is a quick way to do it. But there are some problems with it. Fx "a unit is attacked". A unit can be set to attack and then quickly be ordered to do something else, like "move". The game still treats this as an attack so YourUnit will gain a stack even though it did not actually attack.
Also. The trigger includes no stack dump meaning that once you get 1 stack it will stay at 1 until the unit attacks again. Same goes for the next attacks and thus it will never reset.
Edit:
You could make a timer YourTimer that starts every time YourUnit gets a stack.
Then make another trigger that keeps track of the timer. If the timer reaches 0 the trigger will set YourVariable to 0.