Jump to content
Sign in to follow this  
J3ANP3T3R

Close Air Support SIMULATION Without using Scripts

Recommended Posts

Testing. Testing. Allow AI aircraft to spawn and attack your targets or bomb an empty space just for the heck of it. without using external files and scripts.

Simply create a marker named "Airstrike_Spawn" wherever you like to place them. try on far corners.

Then add a trigger named "AKDummyTrigger" set it to be Repeatable and called on RADIO. add the codes below to the OnAct field.

Now using your center view or binoculars or weapon aim point to a target MAN VEHICLE or point to an empty ground. Airstrike will spawn from a distant and provide support. different aircraft can be set for different targets.

for MAN targets i use Nodunit & Franze AH-64D mod (which is awesome by the way. i just cant fly it). it will use all its weapon.

for all vehicle targets manned or unmanned. i use A-10.

for empty ground targets pr buildings i still use A-10 GBU12 because i dont know of any other.

Config for aircraft:

AirKraft = ["CLASS NAME OF AIRCRAFT","ANY DESCRIPTION"] ;

AKFlyHeight = travel maintaining height ; spawn type "FLY,NONE,FORM,CAN_COLLIDE" etc ; initial speed. put 0 to ignore ; spawn height ;

distance from target before aircraft starts diving and aiming at the target ; let loose will use Waypoint (for choppers) ; expired time before aircraft cancel everything and return to base ;

distance from target before aicraft starts shooting ;

WeaponType = ["CLASS NAME OF WEAPON",DELAY B4 FIRING AGAIN, fire how many ,"ANY DESCRIPTION"] ;

AKOrdinance = Just a tag to tell me what type of target man vehicle or empty ground ;

TGTDesc = "ANY DESCRIPTION" ;

TGTType = class type of target ;

AKMainTime = time ; AKStatus = 0 ; AKBegan = time ; AKLastAtk = time ; AKLetLoose = 0 ; AKTimeout = 900 ;

TargetObj = cursorTarget ;

if(TargetObj isKindOf "AllVehicles" ) Then {TargetCoord = GetPosASL TargetObj ;} Else {TargetCoord = screenToWorld [0.5, 0.5] ; } ;

if(TargetObj isKindOf "Man") Then

{

AirKraft = ["fza_ah64d_b2e","AH64D"] ;

AKFlyHeight = 200 ; AKSpawnType = "FLY" ; AKVelocity = 0 ; AKSpawnHeight = 200 ;

AKDiveRange = 4000 ; AKLetLoose = 1 ; AKTimeout = 500 ;

AKFireRange = 2000 ;

WeaponType = ["fza_m230",50,3,"M203"] ;

AKOrdinance = 1 ;

TGTDesc = "[TARGET MAN]" ;

TGTType = typeof TargetObj ;

}

Else { if(TargetObj isKindOf "AllVehicles") Then

{

AirKraft = ["A10","A-10 Warthog"] ;

AKFlyHeight = 2000 ; AKSpawnType = "CAN_COLLIDE" ; AKVelocity = 220 ; AKSpawnHeight = 5000 ;

AKDiveRange = 4000 ;

AKFireRange = 4000 ;

WeaponType = ["MaverickLauncher",50,1,"Maverick"] ;

AKOrdinance = 2 ;

TGTDesc = "[TARGET VEHICLE]" ;

TGTType = typeof TargetObj ;

}

Else

{

AirKraft = ["A10","A-10 Warthog"] ;

AKFlyHeight = 1500 ; AKSpawnType = "CAN_COLLIDE" ; AKVelocity = 220 ; AKSpawnHeight = 5000 ;

AKDiveRange = 4000 ;

AKFireRange = 300 ;

WeaponType = ["BombLauncherA10",5,1,"GBU12"] ;

AKOrdinance = 3 ;

TGTDesc = "[TARGET GROUND]" ;

TGTType = FORMAT["X:%1 Y:%2", round (TargetCoord select 0), round (TargetCoord select 1)] ;

};};

AKDir = markerDir "Airstrike_Spawn" ;

AK_Trigger setPos (getPosASL player) ;

deleteVehicle AKDummyobj ; deleteVehicle AKDummysmoke ; deleteVehicle AKDummytrigger ;

{deleteVehicle _x} forEach crew AK + [AK] ;

{deleteVehicle _x} forEach units AirStriker ;

AirStriker = CreateGroup West ;

AK = createVehicle [ AirKraft select 0 ,[(getMarkerPos "Airstrike_Spawn") select 0,(getMarkerPos "Airstrike_Spawn") select 1, AKSpawnHeight ], [], 0, AKSpawnType] ; AK setDir AKDir ;

AKPilot = AirStriker createUnit ["USMC_Soldier_Pilot", [0,0,1], [], 0, "CAN_COLLIDE"]; AKPilot moveInDriver AK;

if(AK emptyPositions "Gunner" >0 ) Then { AKGunner = AirStriker createUnit ["USMC_Soldier_Pilot", [0,0,1], [], 0, "CAN_COLLIDE"]; AKGunner moveInGunner AK; };

AKSpot = AirStriker createUnit ["USMC_Soldier_Pilot", [0,0,1], [], 0, "CAN_COLLIDE"] ;

AKSpot hideObject true ; AKSpot setPos TargetCoord ; removeAllWeapons AKSpot ;

AirStriker setCombatMode "BLUE" ;

AirStriker setSpeedMode "FULL";

AirStriker SetBehaviour "SAFE" ;

AK FlyInHeight AKFlyHeight ;

if(AKVelocity>0) Then { AK setVelocity [AKVelocity,0,0]; } ;

AKDummyobj = "Baseball" createVehicle [(TargetCoord) select 0,(TargetCoord) select 1,1] ;

AKDummysmoke = "SmokeShellRed" createVehicle [(TargetCoord) select 0,(TargetCoord) select 1,1] ;

AKDummysmoke attachto [AKDummyobj,[0,0,0]] ;

if( AKOrdinance < 3 ) Then { AKDummyobj = TargetObj ; } ;

AirStriker reveal [AKDummyobj, 4] ; AKSpot doWatch AKDummyobj ; AK doMove getPos AKDummyobj ;

t_AirKraft = "<t color='#E9ED9F'>%1</t> %9" ;

t_AKGroundDist = "Distance : <t color='#F24E61'>%2</t>" ;

t_AKAltitude = "Altitude : <t color='#A5C1F0'>%3</t>" ;

t_AKAimAcc = "Accuracy : <t color='#46E3D9'>%4</t>" ;

t_WeaponType = "Weapon : <t color='#33E842'>%5</t>" ;

t_TGTDesc = "<t color='#E39546'>%6</t>" ;

t_TGTType = "<t color='#E359E1'>%7</t>" ;

AKDummytrigger = createTrigger ["EmptyDetector", getPos AKDummyobj];

AKDummytrigger setTriggerArea [0, 0, 0, false];

AKDummytrigger setTriggerActivation ["NONE", "PRESENT", True];

AKDummytrigger setTriggerStatements ["( Time - AKMainTime ) >= 1 AND AKStatus < 9 ;", "

AKMainTime = time ;

AKGroundDist = round (AKDummyobj distance [(getPosASL AK) select 0,(getPosASL AK) select 1,(getPosASL AKDummyobj) select 2]) ;

AKAltitude = round ((getPosASL AK) select 2) ;

AKAimAcc = AK aimedAtTarget [AKDummyobj, WeaponType select 0] ;

AKIntel = AK knowsAbout AKDummyobj ;

AKSpread = AKDummyobj distance (aimPos AK) ;

AKCurrStatus = ['OTW','DIVING','FIRING','HITS','','','','','RTB','KIA'] select AKStatus ;

hintSilent parseText format[t_AirKraft + '<br/>' + t_AKGroundDist + '<br/>' + t_AKAltitude + '<br/>' + t_AKAimAcc + '<br/>' + t_WeaponType + '<br/>' + t_TGTDesc + ' %8<br/>' + t_TGTType

,AirKraft select 1,AKGroundDist,AKAltitude,AKAimAcc,WeaponType select 3,TGTDesc,TGTType,AKIntel,AKCurrStatus] ;

AirStriker reveal [AKDummyobj, 4] ; AKSpot doWatch AKDummyobj ;

if(AKGroundDist <= AKDiveRange AND AKStatus < 3) Then { if(AKStatus < 1) Then {AKStatus = 1 ;} ; if(AKLetLoose == 0) Then {AK doTarget AKDummyobj ; AK doWatch AKDummyobj ; AKSpot doMove getPos AKDummyobj ; }; };

if(AKLetLoose == 0) Then {

if(AKAimAcc > 0 AND AKGroundDist <= AKFireRange AND AKStatus <= 2 AND ( Time - AKLastAtk ) >= WeaponType select 1 )

Then { AKLastAtk = time ; AKStatus = 2 ; for [{_x= 0},{_x <= WeaponType select 2},{_x = _x + 1}] do { _handle = AK fireAtTarget [AKDummyobj,WeaponType select 0] ;} ; Hint 'Missiles away' ; } ;

if(AKOrdinance < 3 AND !alive AKDummyobj and AKStatus == 2 ) Then { AKStatus = 3 ; hint 'Target destroyed' } ;

if(AKOrdinance == 3 AND AKStatus == 2) Then { AKStatus = 3 ; hint 'Package Delivered' } ;

} Else {

if(AKGroundDist <= AKFireRange AND AKStatus <= 2 AND ( Time - AKLastAtk ) >= WeaponType select 1 ) Then {

AirStriker setCombatMode 'RED' ; AirStriker setSpeedMode 'LIMITED'; AirStriker SetBehaviour 'AWARE' ;

AKLastAtk = time ; AKStatus = 2 ; doStop AK ; deleteWaypoint [AirStriker, all] ;

AK_wp1 = AirStriker addWaypoint [getPos AKDummyobj, 100] ; AK_Wp1 setWaypointType 'SAD' ; };

myNearestEnemy = AK findNearestEnemy AK ; if( myNearestEnemy == objNull ) Then {AKStatus = 3 ; hint 'CLear' ;} ;

};

if(( Time - AKBegan ) >= AKTimeout ) Then { AKStatus = 3 ; hint 'Timed out' } ;

if( AKStatus > 2 AND AKStatus < 8) Then { AKStatus = 8 ; doStop AK ; deleteWaypoint [AirStriker, all] ; deleteVehicle AKSpot ; AK doWatch objNull ; AK FlyInHeight AKFlyHeight ; AirStriker setSpeedMode 'FULL' ; AK doMove getMarkerPos 'Airstrike_Spawn' ; } ;

if(!alive AK) Then { AKStatus = 9 ; hint 'Strike mission failed. Aircraft destroyed' } ;

if( (AK distance (getMarkerPos 'Airstrike_Spawn') <= 100 AND AKStatus == 8) OR AKStatus == 9 ) Then {

deleteVehicle AKDummyobj ; deleteVehicle AKDummysmoke ; deleteVehicle AKDummytrigger ;

{deleteVehicle _x} forEach crew AK + [AK] ; {deleteVehicle _x} forEach units AirStriker ; } ;

", " "];

myNearestEnemy = AK findNearestEnemy AK ; if( myNearestEnemy == objNull ) Then {AKStatus = 3 ; hint 'CLear' ;} ;

doesnt work. please tell me how i can fix this.

Edited by J3ANP3T3R
forgot to ask a question

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×