Jump to content
Sign in to follow this  
TBuck

airstrike.sqs + wingman + loop

Recommended Posts

Hi,

I would like to get a wingman and a loop- function for the script bellow.

The script is from Mr. Murray's "Editing Guide Deluxe Edition".

I'm editing a great offensive on Zargabad with many units. There is also CAS.

With this script I call one F16 in my example. The fighter reach the combat zone drop one bomb or missile and left the combat zone immediately. So it works perfect for me. (Another script "crB Airsupport Demo - v0.1" is not so good because the planes stay in the combat zone and where shot down).

First I want a wingman for the F16.

Second I would like to get a loop function. Usually I activate the airstrike by radio Alpha and place a marker on the map (see bellow).

Now i would like for example every 5 min a generated Airstrike with wingman after placing the marker for one time ( for example in the city center). So at the end of the script should be a loop function with a time delay.

on map:

Unsichtbares Heli-H:

Leer/Objekte: H (invisible)

Name: ASTarget

Funkauslöser:

Aktivierung: Radio Alpha

Text: 0-0-1 AIRSTRIKE

Achse a/b: 0

bei Aktivierung: [] exec "Scripts\Airstrike.sqs"

Marker:

Name: Firedirection

Farbe: rot

Symbol: Destroy

Achse a/b: 1

script "Airstrike.sqs" my working example:

setfire=true;

titleText ["Click on the map to set your firedirection","plain down"];

onMapSingleClick "ASTarget setPos _pos; setfire=false";

@!setfire;

"Firedirection" setmarkerpos getPos ASTarget;

onMapSingleClick "";

titleText ["", "plain down"];

;=========DEFINE=======================

_dropPosition = getpos ASTarget;

~0.5

_dropPosX = _dropPosition select 0;

_dropPosY = _dropPosition select 1;

_dropPosZ = _dropPosition select 2;

~0.1

_planespawnpos = [_dropPosX + 3000, _dropPosY, _dropPosZ + 1000];

_pilotspawnpos = [_dropPosX + 3000, _dropPosY, _dropPosZ + 1000];

;=========CREATE=======================

_PlaneG = creategroup WEST;

_plane = createVehicle ["GLT_Falcon_GBU",_planespawnpos,[], 0, "FLY"];

_plane setPos [(getPos _plane select 0),(getPos _plane select 1),900] ;

_pilot = "USMC_Soldier_Pilot" createUnit [getMarkerPos "Firedirection", _PlaneG, "P1=this"];

_Plane setVelocity [100,0,0] ;

~0.4

P1 moveinDriver _plane;

P1 setDamage 0;

P1 action ["gear_up", vehicle P1] ;

_plane flyinHeight 100;

_plane setSpeedMode "full";

#CHECK

P1 doMove getPos ASTarget;

P1 doTarget ASTarget;

P1 doWatch ASTarget;

? (_plane distance ASTarget) < 1500 : goto "DROP"

goto "CHECK"

;=========FIRE=======================

#DROP

_i = 0

_plane flyInHeight 100;

_plane setPos [(getPos _plane select 0),(getPos _plane select 1),100] ;

~13

#FIRE

_i=_i+1

_plane fire "BombLauncher";

~0.2

? _i <= 6 : goto "FIRE"

;=========FLY AWAY=======================

ASTarget setPos [0,0,0];

"Firedirection" setMarkerPos [0,0];

_plane setSpeedMode “Fullâ€

~4

_plane flyInHeight 300;

P1 doMove getPos ASTarget;

#Check2

_plane setDamage 0;

P1 setDamage 0;

? (_plane distance Player) > 2500 : goto "ENDE";

goto "Check2"

;=========DELETE========================

#ENDE;

deleteVehicle _plane;

deleteGroup _PlaneG

deleteVehicle P1;

exit

Can anybody help me to revise the script?

Thanks in advance!

Tino

Share this post


Link to post
Share on other sites

Without reading through it. But you should use sqf instead of sqs. It's better in performance and some things can only be done with it.

Share this post


Link to post
Share on other sites

I've edited the script regarding the loop but thig dosen't work

setfire=true;

titleText ["Click on the map to set your firedirection","plain down"];

onMapSingleClick "ASTarget setPos _pos; setfire=false";

@!setfire;

"Firedirection" setmarkerpos getPos ASTarget;

onMapSingleClick "";

titleText ["", "plain down"];

;=========DEFINE=======================

#AIRSTRIKE

_dropPosition = getpos ASTarget;

~0.5

_dropPosX = _dropPosition select 0;

_dropPosY = _dropPosition select 1;

_dropPosZ = _dropPosition select 2;

~0.1

_planespawnpos = [_dropPosX + 3000, _dropPosY, _dropPosZ + 1000];

_pilotspawnpos = [_dropPosX + 3000, _dropPosY, _dropPosZ + 1000];

;=========CREATE=======================

_PlaneG = creategroup WEST;

_plane = createVehicle ["GLT_Falcon_GBU",_planespawnpos,[], 0, "FLY"];

_plane setPos [(getPos _plane select 0),(getPos _plane select 1),900] ;

_pilot = "USMC_Soldier_Pilot" createUnit [getMarkerPos "Firedirection", _PlaneG, "P1=this"];

_Plane setVelocity [100,0,0] ;

~0.4

P1 moveinDriver _plane;

P1 setDamage 0;

P1 action ["gear_up", vehicle P1] ;

_plane flyinHeight 100;

_plane setSpeedMode "full";

#CHECK

P1 doMove getPos ASTarget;

P1 doTarget ASTarget;

P1 doWatch ASTarget;

? (_plane distance ASTarget) < 1500 : goto "DROP"

goto "CHECK"

;=========FIRE=======================

#DROP

_i = 0

_plane flyInHeight 100;

_plane setPos [(getPos _plane select 0),(getPos _plane select 1),100] ;

~13

#FIRE

_i=_i+1

_plane fire "BombLauncher";

~0.2

? _i <= 6 : goto "FIRE"

;=========FLY AWAY=======================

ASTarget setPos [0,0,0];

"Firedirection" setMarkerPos [0,0];

_plane setSpeedMode “Fullâ€

~4

_plane flyInHeight 300;

P1 doMove getPos ASTarget;

#Check2

_plane setDamage 0;

P1 setDamage 0;

? (_plane distance Player) > 500 : goto "ENDE";

goto "Check2"

;=========DELETE========================

#ENDE;

deleteVehicle _plane;

deleteGroup _PlaneG

deleteVehicle P1;

goto "LOOP"

;=========LOOP========================

#LOOP

_delay=0.15;

goto "AIRSTRIKE"

Hope someone can help me.

Tino

Share this post


Link to post
Share on other sites
Without reading through it. But you should use sqf instead of sqs. It's better in performance and some things can only be done with it.

Is the nomenclature the same?

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  

×