Draw the crosshair when in third person with cg_thirdPerson
-
Hello,
So I'm trying to add toggle-able third person on my server and with the help of several people on the Discord I got it to work but my only issue is that before I was using
camera_thirdPerson 1
to set everyone in third person because it allowed me to keep the crosshair on screen.From what I understood
camera_thirdPerson
is not a client dvar so I have to usecg_thirdPerson
instead but it takes away the crosshair for both normal state and aiming.I checked and both
cg_drawCrosshair
andui_drawCrosshair
are set to 1.Below are screenshots of what I have with
camera_thirdPerson
that I would like to replicate withcg_thirdPerson
either for both normal and aiming states or even better: only when aiming. -
camera_thirdPerson's value is propagated by the server to all connecting clients, it is cheat protected and has another flag I don't know about.
It's a dvar shared by both game and the server. So I guess it depends what's your definition of client dvar, but I would consider it one.
So, by all means, camera_thirdPerson is good to use because you just need to change it server-side and its value will be updated to all clients.
Since it's cheat protected it will be reset to its original value once a client disconnects from your server so you don't have to worry about messing with client config. So if the reason for not using camera_thirdPerson was because you thought it was not a client dvar, now you know. -
Premake5 client means each client can change it themselves. Therefore camera_thirdPerson would not work. As for getting this done, I know for a fact it can’t be done in bo2, so in mw3, i would feel the same. However I dont work with mw3 so idk haha
-
Premake5 I'm not 100% sure I explained it right or if I misunderstand what you're saying.
I want each player to be in third person by default and to be able to switch his own camera and only his camera to first person by pressing a button.With
cg_thirdPerson
the script below works fine but withcamera_thirdPerson
it doesn't work.
It's a server/global dvar so it doesn't work and to my understanding removing self would override the dvar for every player on the server
fun_buttonPressed2(button) { self endon("disconnect"); level endon("game_ended"); self notifyOnPlayerCommand("third_person_button", button); while(1) { self waittill("third_person_button"); isInThirdPerson = GetDvar( "camera_thirdPerson" ); self iprintlnbold(isInThirdPerson); if (isInThirdPerson == "0") { self SetClientDvar("camera_thirdPerson", "1"); } else if (isInThirdPerson == "1") { self SetClientDvar("camera_thirdPerson", "0"); } wait(1); } }
-
If the crosshair is disabled by that dvar then I suggest you find in the game's code where the cross hair is supposed to be rendered and force it to always render. It's not impossible, just difficult.
-
Since this is a global dvar and I really want to keep the camera this way I decided to make a vote system on my server instead so that players can choose which camera they want at any time in the game
If anyone is interested in this see my Github