So, you're trying to hardcode this script? Or are you trying to make a command that you can call within a Midbattle Script? Because what you have here is a hardcoded script.
Which, if that's the case, you havent defined any battlers here, particularly the one that is meant to unTera. You also...
Only reason would be either of the other two things i mentioned.
Also, have you read through the comments in this discussion? This isn't related to your problem, but you are aware that this plugin is currently in an incomplete state with loads of issues, right? Because this seems like a lot of...
The plugin scripts not actually being installed? The plugin PBS files not being installed? The game not actually compiling? Pretty much the only reasons.
The plugin just makes the game read any Pokémon sprite as sprite sheets. It doesn't matter if its an official, fanmade, or custom sprite. It's on you to actually make those sprite sheets yourself, though.
EBDX and DBK do the same exact things, just in different ways. So it would seem redundant to include both. The biggest unique feature of EBDX is its battle camera, while the biggest unique feature of DBK are all its add-on support. Its up to you which is more valuable.
Did you remove the Mega Stone requirement from Mega Diancie in its PBS data? Megas are inherently incompatible with Terastallization, thus their Tera type will aways be nil. You have to specifically make it so Mega Diancie is no longer considered a Mega form.
The error has nothing to do with what you're doing. You just need to generate a new Diancie. It must have existed in your party prior to installing the Tera plugin, thus is has no Tera type.