one of the beauties of ExecuteScript() is that the calling script doesn’t need to be recompiled after changes are made to the executed script. (as long as the filename of the executed script stays the same)
what this means, among other things i guess, is that the .ncs of the calling script can remain very small, because it doesn’t need to compile all that extra code into it.
take a hypothetical example that’s going to require a lot of code …
say you want to call DetermineCombatRound() [a big function with a lot of bytecode] from three different places/scripts. You could make DetermineCombatRound() into a void main() function in a script called “dcr.nss”
Then in, say, creatures’ OnPerception, OnHeartbeat, OnDamaged, OnPhysicallyAttacked, etc Ai-scripts, instead of compiling DetermineCombatRound() into each of those .ncs files, just call ExecuteScript(“dcr”, OBJECT_SELF); instead
get it? One big script (dcr.nss) called by any number of much smaller scripts.
but i don’t like doing that since the stacktrace goes out the window …
however, it has been used to good effect by things like Kaedrin’s PrC pack. He basically overrides several module-level eventscripts, but instead of compiling his advanced functions into those scripts he just calls ExecuteScript() to invoke their functionality. This way those module-level eventscripts, once in place, no longer need to be re-edited or re-complied,
ps. you shouldn’t have to use ExecuteScript() … i’d bet that a judiciously placed DelayCommand() [etc] would solve those VFX issues …
pps. ExecuteScript() can also workaround some tmi (too many instructions) issues – but my opinion is that if you’re getting TMIs there’s something else that needs lookin’ at / imho