Home   Help Search Login Register  

Author Topic: My onmapclick AirStrike Script "looks good" (ACCEPTED)  (Read 4137 times)

0 Members and 1 Guest are viewing this topic.

Offline Michael

  • Members
  • *
  • www.zonekiller.ath.cx
    • ZoneKillers
This Script Makes a plane that will fly to where you click on the map and it will drop bombs then return to the place it started and it gets removed from the mission, you can call new planes every 15 seconds. works with SP & MP

Sample mission at the bottom of post "the mission is still a little messy but fun"
if you are on a gun press F to use the AA Bullets
"pbo" and a "rar script folder"

What you need:
in the init.sqs put ----- assist = 0
5 x triggers

1st Set it to blufor present make it repeat
in the name call it Airport
the activation put ----- working = 1
in the Deactivation put ----- working = 0; hint "Air-Strike on its way \nETA 30 Seconds."

2Nd Set it to Radio Alpha make it repeat
in the text put ------ null
the activation put ----- 1 setRadioMsg "Click on map"; [this] exec "AirStrike.sqs";

3rd Set it to Radio Delta make it repeat
in the text put ----- Target Assist On
the activation put ----- assist = 1; hint "Target Assist is On"

4th Set it to Radio Echo make it repeat
in the text put ----- Target Assist Off
the activation put ----- assist = 0; hint "Target Assist is Off"

5th Set it to Radio JULIET make it repeat
in the text put null
the activation put ----- menu = 0

thats it just goto your map and click on "select a target" click on target assist on or
off depending what you want then click on the map , as soon as the radio says "select a
target" again you can call in another airstrike

The Target assist will check for any men or vehicles within 200 mtrs of where you clicked
and update the target and marker when the airstrike is 1300 mtrs away.
If your trying to destroy buildings turn off Target assist

The Script
Call It Airstrike.sqs

----------------------------------------------------------

Code: [Select]
;Script By Michael --- www.zonekiller.ath.cx --- zonekiller@iinet.net.au
~0.5
;?!(local Server): exit
?(assist == 0) : hint "Target Assist is Off"
?(assist == 1) : hint "Target Assist is On"
;allows cancel
working = 0
menu = 1
;makes target
Dropzone = "Logic" createvehicle getpos airport
@(alive Dropzone) or (menu == 0)
onMapSingleClick "dropzone setPos _pos"
~0.5
_markername = name player
~0.5
_markername = _markername + "'s DropZone"
_Dropzone = Dropzone
~0.5
_Dropzone setpos _pos
@_Dropzone distance airport > 50
;create marker
~0.2
_marker = createMarkerLocal [_markername, position _Dropzone];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerTypeLocal "Destroy";
_marker setMarkerSizeLocal [.8,.8];
_marker setMarkerTextLocal _marker;
1 setRadioMsg "Please wait"
~1
@(working == 0) or (menu == 0)
~5
;1 setRadioMsg "Select Target"
2 setRadioMsg "NULL";
3 setRadioMsg "NULL";
4 setRadioMsg "Target Assist On";
5 setRadioMsg "Target Assist Off";
6 setRadioMsg "NULL";
7 setRadioMsg "NULL";
8 setRadioMsg "NULL";
9 setRadioMsg "NULL";
10 setRadioMsg "Cancel Orders";
?(menu == 0) : _marker setMarkerType "empty"; goto "cancelled"
~0.5
?(menu == 0) : goto "cancelled"
_planepos = getpos airport
_squadvcl = []
_squadsld = []
_unitClass = "AV8B2"
_unitCount = 1
_unitType = "vcl"
?(menu == 0) : goto "cancelled"
_group = createGroup west
_group createUnit ["SoldierWPilot", _planepos, [], 0, "FORM"]
_newsld = (Units _group) select 0
_squadsld = _squadsld + [_newsld]
[_newsld] join grpNull
~0.1
_itemcount = _itemcount + 1
_vcl = _unitClass createVehicle _planepos
_sldClass = _vclCrew select 0
_newsld moveindriver _vcl
_leader = _newsld
~1
_vehicle = vehicle _leader
;x = [_vehicle] execVM "markersplanes.sqf"
deleteMarkerLocal _Marker
;change marker name
_pilotname = " Pilot is "
_pilotname = _pilotname + name _leader
_markername = _markername + _pilotname
_marker = createMarkerLocal [_markername, position _Dropzone];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerTypeLocal "Destroy";
_marker setMarkerSizeLocal [.8,.8];
_marker setMarkerTextLocal _marker;
;sets pilot skill
_leader setskill 0.10
;Target Assist on or off
?(assist == 0) : _ta = 0
?(assist == 1) : _ta = 1
1 setRadioMsg "Select Target"
~0.5
;starts the plane in the air - no runway needed -
_vehicle setPos [(getPos _vehicle select 0),(getPos _vehicle select 1),(getPos _vehicle select 2) + 1000]
@(alive _dropzone) or (menu == 0) or !(alive _leader)
~2
;move to target
_leader doMove getpos _Dropzone
@(_vehicle distance _dropzone < 1300) or !(alive _vehicle) or (menu == 0) or !(alive _leader)
_vehicle setspeedmode "limited"
_vehicle setBehaviour "CARELESS"
hint "Range 1300"
_vehicle flyinheight 50
?(_ta == 0) : _objects = [_dropzone]
?(_ta == 1) : _objects = nearestObjects [_dropzone,["jeep","car","tank","truck","ship","men"],200]
~1
_Target = _objects select 0
~0.1
_dropzone setpos getpos _Target
~0.1
_marker setmarkerpos getpos _Dropzone
~0.1
_leader doMove getpos _Dropzone
@(_vehicle distance _dropzone < 350) or !(alive _vehicle) or (menu == 0) or !(alive _leader)
?!(alive _vehicle) or (menu == 0) or !(alive _leader) : goto "cancelled"
?!(menu == 0) && (alive _leader) : hint "Target Acquired."
_vehicle flyinheight 50
;wait till in position
@(_vehicle distance _dropzone < 170) or (unitReady _vehicle) or !(alive _vehicle) or (menu == 0) or !(alive _leader)
?!(alive _vehicle) or (menu == 0) or !(alive _leader) : goto "cancelled"
?(menu == 0) : goto "cancelled"
_num = 4
_i = 0
~0.3
;Drops bombs
#bombs
?!(alive _vehicle) : goto "cancelled"
_bomb = "Bo_GBU12_LGB" Createvehicle [(getPos _vehicle select 0),(getPos _vehicle select 1),(getPos _vehicle select 2)-3]
_bomb setDir (getDir _vehicle)
_bomb setVelocity [(velocity _vehicle select 0)*0.2,(velocity _vehicle select 1)*0.2,(velocity _vehicle select 2)*0.2]
_i = _i + 1
~0.15
? _i < _num : goto "bombs"
hint "Bombs Away.\nHeading Home."
#cancelled
?(menu == 0) : 1 setRadioMsg "Select Target"
~1
_vehicle setspeedmode "full"
_vehicle setBehaviour "CARELESS"
;move back to the place of start
_leader doMove getpos airport
?(menu == 0) : hint "Orders Canceled.\nHeading Home."
?!(alive _leader) : "MayDay MayDay Im Going Down."
;cleans up the mission
;_marker setMarkerType "empty"
deleteVehicle _Dropzone
deleteMarkerLocal _Marker
;when back at the planes starting pos it will delete the plane and pilot
@(_vehicle distance airport < 1000) or (unitReady _leader) or !(alive _vehicle) or (menu == 0) or !(alive _leader)
~0.2
deleteVehicle _vehicle
~0.2
deleteVehicle _leader
exit
----------------------------------------------------
Have Fun
Michael


Please use code tags to enclose code, it makes it so much easier to read and separates it from your message text nicely. - Planck
« Last Edit: 20 Sep 2007, 21:10:42 by Mandoble »

Offline Blanco

  • Former Staff
  • ****
Re: My onmapclick AirStrike Script "looks good"
« Reply #1 on: 09 Apr 2007, 05:13:31 »
Nice script   :) Works like a charm
Search or search or search before you ask.

Offline Monkels

  • Members
  • *
Re: My onmapclick AirStrike Script "looks good"
« Reply #2 on: 22 Apr 2007, 19:47:32 »
Dont want to railroad your thread here but perhaps you could help me with somthing im trying to do.

I want like your script to target the objects, which will be a warehouse

the current script im using is using 2 planes to of sorts, carpet bomb the area into oblivion  ::)

1Trigger set to exec the following script

Code: [Select]
plane1 fire "BombLauncher";
plane2 fire "BombLauncher";
~.4
plane1 fire "BombLauncher";
plane2 fire "BombLauncher";
~.4
plane1 fire "BombLauncher";
plane2 fire "BombLauncher";
~.4
plane1 fire "BombLauncher";
plane2 fire "BombLauncher";


Is it possible for me to target a Ai or the warehouse instead of using this carpet bomb method?



Offline 456820

  • Contributing Member
  • **
Re: My onmapclick AirStrike Script "looks good"
« Reply #3 on: 06 May 2007, 22:30:49 »
Is it possible so that the planes don't engage enemy targets. I get a bit annoyed when the script says the jet has finished its run but no bombs have been dropped because the jet has pissed off to engage some targets.

What do I need to edit? I have had a quick scan and cant see what it could be.