mockba.the.borg Posted April 9, 2016 Share Posted April 9, 2016 (edited) Hi Everyone, I have a quick question: I select a Ped on the street, give him a machine gun, set his group relationship to "COUGAR" so he hates everyone and set him to "Combat Hated Targets Around". This essentially creates a "Terrorist" who will then walk around shooting at everyone he sees. This is working fine. Now I want to put that Ped into a Heli and have him fly the heli around shooting at people and/or firing rockets at them. I am able to spawn the Heli and move the Ped into it, however the Ped flies the Heli around, seemingly chasing the Peds and Vehs below, but never fires at them. If I do the same thing with a tank, the Ped will fire the tank gun, but Helis and Aircraft doesn't seem to attack. Does anyone know how to create a Heli or Plane which will indeed attack Peds on the street? Thanks, Mockba. Edited April 9, 2016 by mockba.the.borg Link to comment Share on other sites More sharing options...
milkjunk87 Posted April 11, 2016 Share Posted April 11, 2016 (edited) I tried to do something similar for a ISIS vs Military mod but couldnt get it to work. If you figure it out please place on here. Think they could use shoot bullet from point to point but AIwise idk (AI is easier to handle with Lazer/Hydra/Tanks than with Helis think people use the valkyries on forums http://gtaforums.com/topic/822852-c-cant-get-annihilator-to-fire-weapons-at-player/?hl=%2Bvehicle+%2Bshoot&do=findComment&comment=1068044615) Edited April 11, 2016 by milkjunk87 Link to comment Share on other sites More sharing options...
AHK1221 Posted April 12, 2016 Share Posted April 12, 2016 Hi Everyone, I have a quick question: I select a Ped on the street, give him a machine gun, set his group relationship to "COUGAR" so he hates everyone and set him to "Combat Hated Targets Around". This essentially creates a "Terrorist" who will then walk around shooting at everyone he sees. This is working fine. Now I want to put that Ped into a Heli and have him fly the heli around shooting at people and/or firing rockets at them. I am able to spawn the Heli and move the Ped into it, however the Ped flies the Heli around, seemingly chasing the Peds and Vehs below, but never fires at them. If I do the same thing with a tank, the Ped will fire the tank gun, but Helis and Aircraft doesn't seem to attack. Does anyone know how to create a Heli or Plane which will indeed attack Peds on the street? Thanks, Mockba. Simple idea. You can edit the natives for firing on peds. And you need the exact hashes of the weapons of the planes/helis you are using. When I used to mod on Xbox, i edited these in the handling files, which has all of these strings that can be converted into hashes. WEAPON::SET_CURRENT_PED_VEHICLE_WEAPON(pilot,GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLANE_ROCKET")); VEHICLE::SET_VEHICLE_SHOOT_AT_TARGET(pilot, target, targPos.x, targPos.y, targPos.z); Some weapon names VEHICLE_WEAPON_PLAYER_LAZERVEHICLE_WEAPON_PLANE_ROCKETVEHICLE_WEAPON_TANKVEHICLE_WEAPON_WATER_CANNONVEHICLE_WEAPON_SEARCHLIGHTVEHICLE_WEAPON_RADARVEHICLE_WEAPON_PLAYER_BUZZARDVEHICLE_WEAPON_SPACE_ROCKETVEHICLE_WEAPON_PLAYER_BUZZARD These are some of the weapons I found. Basically, if you are using a Lazer than search for lazer in the handling.meta file and in the WeaponHandling data just copy the weapon name and paste it in the code. Done! Link to comment Share on other sites More sharing options...
mockba.the.borg Posted April 13, 2016 Author Share Posted April 13, 2016 Hi AHK1221, Yes, I have tried WEAPON::SET_CURRENT_PED_VEHICLE_WEAPON but still it won't fire at people below. I don't have a specific target to select, so I can't use VEHICLE::SET_VEHICLE_SHOOT_AT_TARGET. I was trying to make the Heli shoot at random Peds below. I have tried a few different natives, but so far the Heli just chases Peds without firing at them. Maybe someone has a code example to share? Or any other idea? I could be collecting Peds near the Heli and feeding them as targets on a per-frame basis, but I don't want to simulate a behavior that maybe already exists in the engine. Tanks programmed the same way will drive around and fire at Peds and vehicles, same with Peds, so I wonder why not the Heli. Any idea is very welcome. Thanks, Mockba. Link to comment Share on other sites More sharing options...
CliffHanger Posted April 13, 2016 Share Posted April 13, 2016 (edited) Good topic - I was wondering the same thing. I ended up spawning 2 hated peds on each sides of the Heli - but making any NPC attack the player using the Chopper's weapons seems to be heavily scripted. There's a sequence in the story where you fight an attack helicopter... it's very possible the whole sequence is not part of a systemic AI behavior we can simply call using one native function. I'd like to know more about this as well. Edited April 13, 2016 by CliffHanger Link to comment Share on other sites More sharing options...
milkjunk87 Posted April 14, 2016 Share Posted April 14, 2016 (edited) shoot bullet point to point use LOS (line of sight) and maybe vehicles (planes vs planes ex) fight vehicles better than peds Edited April 14, 2016 by milkjunk87 Link to comment Share on other sites More sharing options...
mockba.the.borg Posted April 14, 2016 Author Share Posted April 14, 2016 Hi MilkJunk, Yes, shoot bullets point to point works perfectly when you know your target, but in my case I don't know the target, the target is "random people below". I want to create a Heli that flies around shooting everyone it sees, like a "terror copter", so then I can go and fight it, protect the innocent like that guy who uses a round shield with a star, Captain Puerto Rico (lol). I know I could have it heavily scripted, like acquiring "ped near ped" per frame and then having the heli fight specifically at that target using LOS, however I was wondering if such behavior couldn't be replicated on the engine itself, as it does work with tanks, or peds on foot, for example. If I set a ped on foot into "Cougar" mode, for example, and give it a gun, it goes around shooting everyone. If I put it into a tank it goes around shelling everyone. But when I put it into a chopper it goes around chasing everyone. Never fires though. So the behavior of aggressively chasing people below is there. Maybe just a small native is missing to make it fire its heli weapons. Cheers, Mockba. Link to comment Share on other sites More sharing options...
CliffHanger Posted April 14, 2016 Share Posted April 14, 2016 (edited) I know I could have it heavily scripted, like acquiring "ped near ped" per frame and then having the heli fight specifically at that target using LOS That's possibly how you will have to do it, at any rate, if you get that system done and find a native or two to achieve a very similar effect, your method will still be good IMO. I don't know what you're using, but in C# we have Ped[] and a World.GetNearestPeds (Not sure which native that is) if I recall, you can get all peds too but ideally you just want to get for the range value and then pick a random ped in your ped list defined by the length of that list. I don't suppose the heli would fly in closer on targets so it is possible you would need to add a "go-to / shoot-at" AI task switch determined by a raycast (or a native that determines if a ped is in sight for another ped). Then use conditions like if the currently targeted ped's still alive before it picks a new random one. Doesn't hurt to try, shouldn't be too long to code either. Edited April 14, 2016 by CliffHanger 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