Again, I don't know what flags and vars you used, but if I remember correctly here's what you'd have to do.
In the first script, where you activate the tag battle mode, you have to set the flag that was in config.s, and the var that was specified in config.s to the index of the trainer battling alongside you.
So for example, if I wanted to set it up, and have the first trainer in my table fight alongside me, here's what I'd do.
setflag 0x(flag)
setvar 0x(var) 0x0 (the value would be the index, in this case 0).
The two opposite NPCs are just regular trainers. You have to make sure they encounter you at the same time for the tag battle to work. I don't know the name of it, but take a look at the forest in DPP before the grass gym, every trainer there is set up in a way that two will spot you at the same time, thus activating a double battle.
When you want to disable the tag battle, simply clear the flag that you specified in config.s.