Cloud_Power Posted March 4, 2017 Share Posted March 4, 2017 As the title says... I've tried : Game.Player.Character.Task.FightAgainst(enemy); Game.Player.Character.Task.ShootAt(enemy); TASK_COMBAT_PED(Ped ped, Ped targetPed, int p2, int p3) TASK_PUT_PED_DIRECTLY_INTO_MELEE(Ped ped, Ped meleeTarget, float p2, float p3, float p4, BOOL p5) without any luck! How can I task the player ped to do that? Thank you! Link to comment https://gtaforums.com/topic/882883-how-to-make-player-ped-attack-another-ped/ Share on other sites More sharing options...
jedijosh920 Posted March 5, 2017 Share Posted March 5, 2017 (edited) I don't think you can do that with a player controlled ped. Albeit, I recommend creating a fake gameplay camera with a fake ped attached to the player and control the fake ped while applying the task to the player ped. Edited March 5, 2017 by jedijosh920 Link to comment https://gtaforums.com/topic/882883-how-to-make-player-ped-attack-another-ped/#findComment-1069437902 Share on other sites More sharing options...
Cloud_Power Posted March 5, 2017 Author Share Posted March 5, 2017 Right... I'm trying to avoid that though... Do you know any way to "simulate" an input? I mean, you press anything, but the game just receive an input. I have found void SIMULATE_PLAYER_INPUT_GAIT(Any p0, Any p1, Any p2, Any p3, Any p4, Any p5) But there is no documentation at all... Link to comment https://gtaforums.com/topic/882883-how-to-make-player-ped-attack-another-ped/#findComment-1069438437 Share on other sites More sharing options...
stillhere Posted March 5, 2017 Share Posted March 5, 2017 Right... I'm trying to avoid that though... Do you know any way to "simulate" an input? I mean, you press anything, but the game just receive an input. I have found void SIMULATE_PLAYER_INPUT_GAIT(Any p0, Any p1, Any p2, Any p3, Any p4, Any p5) But there is no documentation at all... You can simulate an input with SetControlNormal. For some reason the unofficial native name, which was _SET_CONTROL_NORMAL, was removed from the NativeDB; the hash is 0xE8A25867FBA3B05E. Use GetControlValue to get an idea of what kind of values you'd need to input. Cloud_Power 1 Link to comment https://gtaforums.com/topic/882883-how-to-make-player-ped-attack-another-ped/#findComment-1069438555 Share on other sites More sharing options...
Cloud_Power Posted March 5, 2017 Author Share Posted March 5, 2017 (edited) EDIT: Nevermind, my bad. I've found out that 127.0f is when the Attack button is released and 254.0f when pressed. The game does recognize that when I use SetControlNormal, but nothing happens. No animation, no melee fight, nothing... Do you guys have an idea? if(Game.IsControlJustReleased(0, GTA.Control.Attack)){ UI.Notify(Game.GetControlNormal(0, GTA.Control.Attack).ToString());} if(Game.IsControlJustReleased(0, GTA.Control.Attack)){ UI.Notify(Game.GetControlValue(0, GTA.Control.Attack).ToString());} Both gives me 0 but when I use if(e.KeyCode == Keys.O){ Game.SetControlNormal(0, GTA.Control.Attack, 0.0f);} Nothing happens. Maybe I'm using this in a wrong way? Can you kindly shine a light on this for me? I really appreciate your help! Edited March 5, 2017 by Cloud_Power Link to comment https://gtaforums.com/topic/882883-how-to-make-player-ped-attack-another-ped/#findComment-1069438690 Share on other sites More sharing options...
stillhere Posted March 6, 2017 Share Posted March 6, 2017 (edited) Nothing happens. Maybe I'm using this in a wrong way? Can you kindly shine a light on this for me? I really appreciate your help! IIRC, GetControlNormal ranges from 0 to 1 or -1 to 1 (depending on the Control. I think MoveLeftRight works like this). Basically, 0% pressed to 100% pressed. So 1f as the last parameter should work. Btw, about this code: if(Game.IsControlJustReleased(0, GTA.Control.Attack)){ UI.Notify(Game.GetControlNormal(0, GTA.Control.Attack).ToString());} I think it returns 0 because it is only displaying the control value after releasing the control, which means it is 0% pressed by the time the subtitle is shown Edited March 6, 2017 by stillhere Link to comment https://gtaforums.com/topic/882883-how-to-make-player-ped-attack-another-ped/#findComment-1069439605 Share on other sites More sharing options...
Cloud_Power Posted March 7, 2017 Author Share Posted March 7, 2017 Unfortunately It seems not to work! Or, at least, it doesn't work the way I wished. The game does recognize that the button has been pressed/clicked but the action binded to that button doesn't play. So yeah, it works but not how I wished to! Link to comment https://gtaforums.com/topic/882883-how-to-make-player-ped-attack-another-ped/#findComment-1069443095 Share on other sites More sharing options...
stillhere Posted March 10, 2017 Share Posted March 10, 2017 Unfortunately It seems not to work! Or, at least, it doesn't work the way I wished. The game does recognize that the button has been pressed/clicked but the action binded to that button doesn't play. So yeah, it works but not how I wished to! Sorry for the late reply. I have personally used this with the movement controls (left stick on gamepads) and it works, but I just tried with the attack/melee controls and they don't work. Sorry man! Cloud_Power 1 Link to comment https://gtaforums.com/topic/882883-how-to-make-player-ped-attack-another-ped/#findComment-1069449142 Share on other sites More sharing options...
Cloud_Power Posted March 11, 2017 Author Share Posted March 11, 2017 The only one I wished it worked with! Aahah, never mind! Anyway thank you! stillhere 1 Link to comment https://gtaforums.com/topic/882883-how-to-make-player-ped-attack-another-ped/#findComment-1069450849 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