I want to make a mod that introduces a unit that, when created, snaps the camera to a first-person view from said unit, and then allows for direct control via WASD and other keys?
The API isn't that powerful sadly, for example: - there is no API to get the position of a unit - there is no API to set the camera position derp of course there is, I meant GET, sorry for other things, like giving a move command to a unit you have selected right now, workarounds exist, but what you are thinking of will require a lot of very deep digging to find a lot of workaronds then a bit of black magic and sorcery and then maybe you will find a hack to do it. Probably will require a little reading of process memory though.
I'm pretty sure it's impossible to control a unit's movement with arrow keys. The camera part might be half-way possible since there is a way to snap the camera to a unit and ctrl-m changes camera angle.
Well it seems that you can snap the camera to your Commander, so why couldn't you make a script/mod combination that snaps the camera to a different unit?
first person? Well then you can do that part. I am not saying it is totally impossible, but it will not be as easy as "call some ready made functions". Definitely FAR from easy, the part of controlling your unit is probably hardest. If you want to try here is a file I wrote to be able to give move commands in world coordinates to a unit: https://github.com/pamods/Minimap/blob/master/Minimap/ui/mods/minimap/unitcommands.js Then you probably will need a way to determine the position of the currently selected unit. The only way to get world coordinates is from alerts. I have so far not been successful in getting them for arbitrary units at arbitrary times. If you can figure something out please share it. Actually I do have one idea that may somewhat work: use the commander regeneration mod hack (a planet wide invisible explosion that deals positive damage to commanders) and combine it with another explosion that deal real damage. So you get no damage or regenration, but you might be able to have it generate regular "commander damaged" alerts that contain the location of your commander.