OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: GI-YO on 07 Oct 2004, 12:48:36

Title: strafe attack script
Post by: GI-YO on 07 Oct 2004, 12:48:36
I am trying to make a script that commands a cobra to fire at invisibel H's which are placed in a line so it looks like he is just strafing enemy positions and I have written a sort of script but it doesn't do anything. Any help would be appreciated.

";strafing script by GI-YO

copter1 setcombatmode "red"

copter1 selectweapon "Zunilauncher38"

copter1 dotarget "hpad"

~2

copter1 dofire "hpad"

~2

copter1 dotarget "hpad1"

~2

copter1 dofire "hpad1"

~2

exit"

copter1 is the heliocpters name and hpad and hpad1 are the invisibel helipads. thanks in advance.

GI-YO
Title: Re:strafe attack script
Post by: macguba on 07 Oct 2004, 12:51:58
Forget the second pad for a moment, once you have him firing on one you can add in more.

There is an invisible target addon that might be more effective than the invisible Hs.  Search the forum for a link.

Try switching the code to this:-

copter1 dotarget "hpad"
copter1 dofire "hpad"
~4

And I know you have checked the spellings of all the names, etc., but check it again.    Check the syntax of the commands too:  you may not need the quotes " ".
Title: Re:strafe attack script
Post by: Sophion on 07 Oct 2004, 17:42:51
Remember distance, they can't shoot whats out of range or can't see. Try something like putting an call trigger:

Put a trigger down as 1x1 and in the condition field:
Code: [Select]
Chopper1 Distance hpad < 250Then in the action field:
Code: [Select]
[Chopper1] exec "script.sqs"
Mabe that will work, I had troubles with the Dofire comm like that, They were too far away.

Or it could be a fault in the weapon's selection (?)
Title: Re:strafe attack script
Post by: Zombie on 07 Oct 2004, 18:01:23
perhaps using the reveal command would help as well
Title: Re:strafe attack script
Post by: Wadmann on 07 Oct 2004, 23:54:25
You could try Igor Drukov's chain script available here (http://www.ofpec.com/editors/browse.php?browsewhat=2&category=2_14) if you just need it to look like a strafing run. I would personally use Lester's Invisible Targets. I have made a script using these to follows groups or units and aircraft will fire until the  invisible target is destroyed, the targeted unit/group is destroyed, you disable it via a variable, or a group is down to a certain number of units. If I get a demo mission together this weekend, I will post it here at OFPEC.


                                                             Wadmann

Edit: I do not know if it will work, but perhaps trying to group an enemy of the aircraft to the invisible H and delete the enemy unit at the start of the mission may help to get your aircraft to fire on the invisible H.
Title: Re:strafe attack script
Post by: Dubieman on 08 Oct 2004, 01:56:04
Invisible targets are the way to go here. You could just set a few down or use my script in the ed depot for a gunship support script, it comes with the addon and has a script that creates a ceratin kind of target specified by you, man or tank etc... and just set the location at an invisible helipad or two or at enemy postions...

But whatever is easiest for you. ;)

edit : here--->
http://www.ofpec.com/editors/browse.php?browseon=&browsewhat=-1&catselected=-1_-1&catagory=-1&subcategory=-1_-1&numreturn=25&displayformat=0&ofpv=1&searchwhat=1&searchlevel=0&searchwhat=1&searchopts=&searchstring=gunship&x=27&y=7
Title: Re:strafe attack script
Post by: GI-YO on 10 Oct 2004, 12:40:59
Thanks for all the advice dude's but i'm trying to learn to script and here's my first attempt so I wanna make it work, i'll check out those other scripts and see what makes them tick. Heres what I changed the script to and it works ok, but the chopper keeps circling around and attacking the last hpad4, is there a donttarget command or something similar?

";strafing script by GI-YO

copter1 setbehaviour "aware"
copter1 setcombatmode "yellow"

copter1 selectweapon "MachineGun30"

copter1 dotarget h1
copter1 dofire h1
~4

copter1 dotarget h2
copter1 dofire h2
~4

copter1 dotarget h3
copter1 dofire h3
~4

copter1 dotarget h4
copter1 dofire h4
~4


exit"

I changed the invisibel H's to brown barrels, which the chopper doe's shoot at. Thanks again.

GI-YO