Player manual switchover?

Hi!
I’m trying to create a custom scenario. For testing/debugging purposes I need to configure two things:

  1. Switch off all AI’s on a start.
  2. Configure a way switch over the players whenever I want to take control armies and economics. For example, there were triggers in Age of Mythology and Age of Empires 3 editors, which did allow me to easily switch between players by selecting certain objects.
    So, I achieved 1st goal (I can share - how, if anyone interested).
    But I faced with an issue, when trying to configure 2nd point. I’ve found, for example, following function: Debug_ToggleControlAll(). Its description says that by calling this I unlock possibility to local player (i.e. me) to issue commands to any unit regardless of ownership. Sounds interesting, but my attempts to call this function fail with error (attempt to transfer nil value). This is strange because I can see that function is defined somewhere - I didn’t found a source in “.scar” files, but if I’m able to see the description - then I suspect, it’s defined somehow?
    Does anyone know, how to take ownership over AI player? Some examples of such mechanism or functions which can help to achieve this?