Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Making Heli fire at peds


mockba.the.borg
 Share

Recommended Posts

mockba.the.borg

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 by mockba.the.borg
Link to comment
Share on other sites

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 by milkjunk87
Link to comment
Share on other sites

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

mockba.the.borg

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

CliffHanger

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 by CliffHanger
Link to comment
Share on other sites

shoot bullet point to point :p use LOS (line of sight) and maybe vehicles (planes vs planes ex) fight vehicles better than peds

Edited by milkjunk87
Link to comment
Share on other sites

mockba.the.borg

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

CliffHanger

 

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 by CliffHanger
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.