Home   Help Search Login Register  

Author Topic: Simulating AI Gunship attack  (Read 1413 times)

0 Members and 1 Guest are viewing this topic.

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Simulating AI Gunship attack
« on: 18 Jan 2009, 18:01:17 »
Hi all~
I'm building a mission where in the mission, I want an enemy AI Chopper like the V80 Chopper to fly in and do a quick missile drop at the squad the player is controlling. Although I don't want the chopper to target the squad directly, I just want a little show to get the player aware.

Like maybe have the chopper target a spot near the squad with only one pass and then fly away.

Basically bomb a spot near the squad and then fly away, dont' return, because the point of the mission is not to blow up the chopper.  It's just to add a little excitement.

How would I do this. I don't know how to script the AI Chopper to drop his missles near the squad..Thanks all.
Who's hyped for Arma4, long live Arma!

Offline Mostly

  • Members
  • *
Re: Simulating AI Gunship attack
« Reply #1 on: 18 Jan 2009, 18:37:49 »
Haven't tested this but hopefully should work.

Create an empty marker with the name TARGETMARKER

now add this line to a script:
Code: [Select]
TARGETMARKER setPos [(getPos Player select 0),(getPos Player select 1)+20,(getPos Player select 2)];
AIRCRAFTNAME domove TARGETMARKER;
AIRCRAFTNAME dofire TARGETMARKER;

Hopefully that should work, if you want to increase the distance of the target marker from your player then just add a + or - figure after each co-ordinate. For example I've already added a +20 on the Y axis so the marker should appear just north of your men.
They mostly come out at night. Mostly!

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Re: Simulating AI Gunship attack
« Reply #2 on: 18 Jan 2009, 19:09:30 »
Hi thanks, I did as you mentioned this is my script from you;

Quote
; *****************************************************
; ** Operation Flashpoint Script File
; *****************************************************

TARGETMARKER setPos [(getPos Player select 0),(getPos Player select 1)+10,(getPos Player select 2)];
helo domove bomb;
helo dofire bomb;

exit

What happens, the V80 does lunch the missles, but it does it far off, how do I get it closer now?  I did it +10 to see if it would land closer near the player but it's still a good 100yards off or more.. :)
Who's hyped for Arma4, long live Arma!

Offline Mostly

  • Members
  • *
Re: Simulating AI Gunship attack
« Reply #3 on: 18 Jan 2009, 19:17:53 »
Hmmmm, not sure.

Try adding the following underneath the commands which set the marker position.

HELICOPTER setcombatmode "BLUE";     this should make the helicopter hold fire
@  unitReady HELICOPTER;                  this should make it wait until it's reached the marker
HELICOPTER setcombatmode "RED";        this should make it fire.
HELICOPTER dofire TARGETMARKER;

Hopefully, this should make the Helicopter more accurate because it will wait until it's on top of the marker before it decides to fire.

They mostly come out at night. Mostly!

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Re: Simulating AI Gunship attack
« Reply #4 on: 18 Jan 2009, 19:30:06 »
It actually doesn't work. I have an empty v80, placed 2 resistance soldiers in it becasue it's the resistance were fighting.

Then I gave the resistance soldiers a few move waypoints and triggerd them to move as soon as west tripped a trigger to actve the chopper to similate the script.

but now the chopper just continuously passes the player without firing a shot.
« Last Edit: 18 Jan 2009, 19:44:28 by NightJay0044 »
Who's hyped for Arma4, long live Arma!

Offline Mostly

  • Members
  • *
Re: Simulating AI Gunship attack
« Reply #5 on: 18 Jan 2009, 21:25:13 »
Ok. If that's happening ignore the last section of script I posted.
How about placing the marker directly over the player with the command:

Code: [Select]
"TARGETMARKER" setmarkerpos PLAYER;
HELICOPTER dofire TARGETMARKER;

If that doesn't work I'm all out of ideas. Was hoping that the first snippet of script I posted would do the job. There is another way we could achieve what you want. We could create a bomb or a missile and place it a set distance from the player when the helicopter flys overhead. Again this isn't tested but I think it should work:

Code: [Select]
HELICOPTER domove Player;
@ unitready HELICOPTER;
bomb = "Laserguidedbomb" camCreate [(getPos player select 0)+20,(getPos player select 1),(getPos player select 2)+1]
I'm hoping that this script should create a bomb which should explode at a location very near to the player when the helicopter flys overhead. This should give the illusion that the helicopter has tried to attck your squad. You might want to replace the Laserguided bomb with a Hellfire missile?

They mostly come out at night. Mostly!

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Simulating AI Gunship attack
« Reply #6 on: 18 Jan 2009, 22:10:11 »
As far as I know the only way to achieve this reliably would be to include Lester's Invisible Targets and place one near the player. If it's important that the chopper always attacks near the player regardless of his/her location, use a script to setpos the invisible target. Once the chopper has engaged the target once (check magazines) delete the invisible target and domove the chopper away.