OrnsteinDragonslayer, the code is so incorrect that it's unclear where to even begin explaining. You should start by noting that the game directly indicates in which function the error occurred and which variable it didn't like. There are none of those in the provided code, which means the error occurred in another part of the combat script. As for the rest, I recommend looking at Novik's manual, especially regarding combat hooks.
Well, I'm not very familiar with combat scripts, so I just copied everything from above and added creature identifiers. A manual would be helpful, but where can I find it? Google is silent, and there's no one with the nickname Novik on the forum (or is it spelled that way? I only found that in Google). There's nothing about it in the general Heroes manuals. I would be grateful if you could share it for everyone to see.