LeeC22 Posted May 4, 2020 Share Posted May 4, 2020 You know when the player has been stood idle for a while, it switches to that annoying first-person view where it decides to look at random things. I am trying (and failing) to prevent that happening. I thought it might be switching to first-person cam, so I tried _DISABLE_FIRST_PERSON_CAM_THIS_FRAME, which didn't work. Then I thought it might be a Gameplay hint, so I tried checking IS_GAMEPLAY_HINT_ACTIVE, which always returned false, so it wasn't that. My final thought was to check GameplayCamera.IsRendering, which shows false when it switches to that mode. I could simply reset to the gameplay camera when it happens but that would screw up every cinematic camera type mod I have created, which isn't very good. So all those have failed miserably. I have searched for "idle", to see if it's an idle activity but can't find anything. I searched for "since" as I thought it might have been a TIME_SINCE_INPUT etc... thing but it isn't. Does anyone have any idea what might be driving this switch to an alternate camera, and possibly a way to prevent it? Even if it means editing a gamefile, I don't mind because this mode is just downright annoying when you're trying to test code. I mean, if all comes to all, I could probably write a small standalone mod that keeps track of how long it has been since any kind of input, and then pinging a controller input with a small value... but that's such a hack and it means testing every single controller input every frame, or few frames... unless I just did camera controls and movement controls, that would probably work. Shnockered1 1 Link to comment Share on other sites More sharing options...
LeeC22 Posted May 4, 2020 Author Share Posted May 4, 2020 I decided to go with the input manipulation for now, just to stop this view from kicking in. I have a List<Control> of the controls to check and a counter variable; private int NoInputTimer; private List<Control> CheckControlsList = new List<Control>() { Control.MoveLeftRight, Control.MoveUpDown, Control.LookLeftRight, Control.LookUpDown }; Then I have this function that is called each frame with the elapsed time being passed from the onTick() handler. I always calculate the elapsed time in onTick and then pass it to each function that requires it. private void CheckControls(int elapsedTime) { // Set a flag to false bool isPressed = false; // Go through each control in the List<Control> collection foreach (Control c in CheckControlsList) { // check to see if the Math.Abs(input normal) > .1f if (Math.Abs(Game.GetControlNormal(2, c)) > .1f || Math.Abs(Game.GetDisabledControlNormal(2, c)) > .1f) { // if so, set the flag to true and stop checking as any kind of input is good enough isPressed = true; break; } } // If the flag is still false, no control is pressed if (!isPressed) { // Increment the nothing-pressed timer NoInputTimer += elapsedTime; // if it has been longer than 25 seconds (Look around mode kicks in at about 31 seconds on my PC) if (NoInputTimer >= 25000) { // Set the sprint control normal to 1f. If you are stood still, this will do nothing to the character, so it's a safe input // Setting the control to less than 1f didn't stop the look-around mode from kicking in. Game.SetControlNormal(2, Control.Sprint, 1f); // reset the no-input timer NoInputTimer = 0; } } else { // if something is pressed, reset the no input timer to zero NoInputTimer = 0; } // just prevents me from switching to FPV while cycling camera views Function.Call(Hash._DISABLE_FIRST_PERSON_CAM_THIS_FRAME); } It's not how I wanted to do it but it works, so if anyone else needs to do the same thing... there you go. Shnockered1 1 Link to comment Share on other sites More sharing options...
Jitnaught Posted May 5, 2020 Share Posted May 5, 2020 (edited) Maybe this native? INVALIDATE_IDLE_CAM Or this one _0x9E4CFFF989258472 Quote Resets the idle camera timer. Calling this in a loop will disable the idle camera. Examples: Lua Citizen.CreateThread(function() while true do InvalidateIdleCam() N_0x9e4cfff989258472() --Disable the vehicle idle camera Wait(1000) --The idle camera activates after 30 second so we don't need to call this per frame end end) Edited May 5, 2020 by Jitnaught Shnockered1 and LeeC22 2 Link to comment Share on other sites More sharing options...
LeeC22 Posted May 5, 2020 Author Share Posted May 5, 2020 (edited) 6 hours ago, Jitnaught said: Maybe this native? INVALIDATE_IDLE_CAM Or this one _0x9E4CFFF989258472 I searched for idle in what I presumed was the latest natives list and all I got was this: static void SET_FACIAL_IDLE_ANIM_OVERRIDE(Ped ped, char* animName, char* animDict) { invoke<Void>(0xFFC24B988B938B38, ped, animName, animDict); } // 0xFFC24B988B938B38 0x9BA19C13 static void CLEAR_FACIAL_IDLE_ANIM_OVERRIDE(Ped ped) { invoke<Void>(0x726256CC1EEB182F, ped); } // 0x726256CC1EEB182F 0x5244F4E2 static void SET_TIME_IDLE_DROP(BOOL p0, BOOL p1) { invoke<Void>(0x9DFE13ECDC1EC196, p0, p1); } // 0x9DFE13ECDC1EC196 0x92302899 static void PLAYSTATS_IDLE_KICK(int time) { invoke<Void>(0x5DA3A8DE8CB6226F, time); } // 0x5DA3A8DE8CB6226F 0x9E2B9522 Thank you for finding that, makes things much easier than my method for sure. Edit: I can't actually find the hash of that INVALIDATE_IDLE_CAM and I can't find that name in any list I can find... do you have the hash please? I thought it was FiveM but I am obviously wrong. Edit: Found it: 0xF4F2C0D4EE209E20 Edited May 5, 2020 by LeeC22 Shnockered1 and Jitnaught 2 Link to comment Share on other sites More sharing options...
Jitnaught Posted May 5, 2020 Share Posted May 5, 2020 The lists I used: https://alloc8or.re/gta5/nativedb/ https://runtime.fivem.net/doc/natives/ (where the example came from) Shnockered1 and LeeC22 2 Link to comment Share on other sites More sharing options...
LeeC22 Posted May 9, 2020 Author Share Posted May 9, 2020 Thanks... sorry for the late acknowledgement. Shnockered1 and Jitnaught 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now