You must've explained it quite well, because I got it working after a bit of wrangling. I ended up having to create a new version of the trainer for it to work properly - couldn't tell you why, but thats just what seemed to be effective.
This is going to be super useful moving forward. It may...
I'm looking at rematches using the scaling system - would it be possible for the script (or is there some other way) to create a rematch of a trainer with (x) levels above from when you first battle them?