So the problem is that when a unit attacks an enemy building the game stucks and only a restart of the computer can get you out of it. The units i use in my map aren't custom, but the original ones and I just modified them. When they are fighting other units all is fine.