Jump to content
Sign in to follow this  
OzeRick

Help with a scripting problem

Recommended Posts

Hi all

I have been playing around with the below script to get 2 planes to spawn and complete the run but I can only get one to spawn.

Could some please let me know if I am heading in the right direction or if I am barking up the wrong tree with he way I am doing it

Thanks

Regards

OzeRick

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 + 4000,_dropPosY,_dropPosZ + 350];

_pilotspawnpos = [_dropPosX + 4000,_dropPosY,_dropPosZ + 350];

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

_PlaneG = creategroup WEST;

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

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

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

_Plane setVelocity [100,0,0];

_dropPosition = getpos ASTarget;

~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) < 2550 : goto "DROP"

goto "CHECK"

~0.5

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

_dropPosition = getpos ASTarget_1;

~0.5

_dropPosX = _dropPosition select 0;

_dropPosY = _dropPosition select 1;

_dropPosZ = _dropPosition select 2;

~0.1

_planespawnpos = [_dropPosX + 4000,_dropPosY,_dropPosZ + 350];

_pilotspawnpos = [_dropPosX + 4000,_dropPosY,_dropPosZ + 350];

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

_PlaneA = creategroup WEST;

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

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

_pilot = "Pilot" createUnit [getMarkerPos "Firedirection", _PlaneA, "P2=this"];

_Plane setVelocity [100,0,0];

~0.4

P2 moveinDriver _plane;

P2 setDamage 0;

P2 action ["gear_up", vehicle P2];

_plane flyinHeight 100;

_plane setSpeedMode "full";

#CHECK1

P2 doMove getPos ASTarget;

P2 doTarget ASTarget;

P2 doWatch ASTarget;

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

goto "CHECK1"

;=========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";

~2

_plane flyInHeight 300;

P1 doMove getPos ASTarget;

#Check2

_plane setDamage 0;

P1 setDamage 0;

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

goto "Check2"

ASTarget setPos [0,0,0];

"Firedirection" setMarkerPos [0,0];

_plane setSpeedMode "Full";

~2

_plane flyInHeight 300;

P2 doMove getPos ASTarget;

#Check3

_plane setDamage 0;

P2 setDamage 0;

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

goto "Check3"

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

#ENDE;

deleteVehicle _plane;

deleteGroup _PlaneG

deleteVehicle P1;

deleteGroup _PlaneA

deleteVehicle P2;

exit

Share this post


Link to post
Share on other sites

maybe?

conflicting names. In one piece of script you have refered to each vehcile as _plane

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  

×