Maybe it's a multiplayer map? You can download different scenarios and compare them. I don't see any major differences compared to my working version.
Added 12 hours 41 minutes ago
In general, I browsed through the map section, specifically those marked as multiplayer, and I didn't find a single combat script in the couple of dozen I downloaded... I don't like this trend. There's still hope that maybe it needs to be specified somewhere in the map.xdb and it will start working.
Another question about sleep arose, based on the information from other users who were looking for answers before me. I suspect that the freezes at the start of the map, where many functions are executed simultaneously without waiting for each other, are due to the specifics of Lua. I found an example:
repeat sleep(1) until GetUnitManaPoints(GetAttackerHero())==200 --Sleep until mana is addedI found this code. How can I attach a wait to the MessageBoxForPlayers function? Or to the completion of the function that adds creatures to the players' castles. For now, I'm thinking of a workaround with some boolean variable and checking it for true|false in the sleep function.