Mouselook script by riyuzakisan.
File is at the bottom.
WASD keys to move.
Mouse movement to turn the player.
Player is the white cube.
“1” key to select all squadmates.
“2” key to select blue squadmate only.
“3” key to select yellow squadmate only.
“4” key to deselect all squadmates.
Shift to toggle squad movement placer. (The green sphere)
Left click to deploy squadmate(s) to indicated location when the squad movement placer is on.
Scroll up and down while squad movement placer is on to move it forwards and backwards.
This is a set up in which you the player can command a single squadmate or all of them to move to a particular location (in my example, I have two squadmates one yellow and the other blue). I used a third person camera set up here but this can work for anything from an RTS to a first person shooter depending on how you tweak it. This is a basic version of a system that could be used to command an entire army, or to interact with AI partners in a puzzle platformer. The possibilities are endless. At initialisation of the game, all the squadmates are selected. Selected squadmates will follow you wherever you go. If you select one specifically using a number key it will deselect the other, forcing them to hold their current position. Only selected squadmates can move to the squad movement placer.
Also I placed a smaller cube within the main player cube, parented to the main player cube. I attached the mouselook script to this smaller cube. This allows player to only turn on the z axis and not go upside down.
squadai.zip (126 KB)