Can menu UI be used to change cameras in a map?

rednico6

L1: Registered
Mar 29, 2021
5
4
I want to create a dynamic map background who's view changes as you click on menu buttons. For example, highlighting/clicking MVM mode changes the camera to a scene of RED mercs fighting bots. Picking between PVP gamemodes like payload or KOTH would swap to scenes of BLU mercs pushing a cart, or Engi setting up a sentry on a control point. Is there anyway UI can send commands that affect the player's server like that?

Let's just say I'll piece together a map with all of these various scenes ready for cameras to look at.
 

henke37

aa
Sep 23, 2011
2,075
515
Menu buttons can indeed run console commands.
 

Idolon

they/them
aa
Feb 7, 2008
2,107
6,116
You can use the ent_fire command to send any input to any entity. I would recommend making a logic_relay for every camera that sends all the necessary inputs to change cameras and fire any other inputs necessary for that particular view, and then set each menu button to trigger that relay.

One issue you may run into is that ent_fire requires sv_cheats 1, so if you're running this map as a background map every time you launch the game, you will be unable to unlock any achievements. I haven't actually tested this so it might not be an issue, but I'm guessing it will be.