ColonelSandersLite 0 Posted April 24, 2006 Alright, bombing run on map click. CSLMapClick.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Move Marker On Map Click by ColonelSandersLite Version V1.0 ; Note that some mods may interfere with this. ECP will when you use AI release or HELO Coms. ; the mission designer should warn the player about this potential complication. ; If this script may not be needed if the mission is designed for a mod that already does this. ; Usage: ; Create 1 Marker (emtpy), name it so you will remember it. ; The marker will be moved by this script. ; create an init.sqs file in your mission directory if you don't have one already ; at the bottom of your init.sqs, add a small delay before this script is activated like this: ; ~1 (without the semicolon or this text) ; below your delay activate this script, parameter details below: ; onMapSingleClick {[_pos, _shift, _alt, "MyMarkerName", booleanShiftRequired, booleanAltRequired] exec "CSLMapClick.sqs"} ; example usage: ; onMapSingleClick {[_pos, _shift, _alt, "FWAS_Target", false, false] exec "CSLMapClick.sqs"} ; Parameter Details: ; _pos, _shift, _alt ; these are game code and are mandatory as written. ; "MyMarkerName" ; This should be the name of the marker above in quotes. ; booleanShiftRequired ; true or false ; This specifies wether the script should require the left shift key to be held down before activating. ; booleanAltRequired ; true or false ; This specifies wether the script should require the left alt key to be held down before activating. ; BEGIN SCRIPT ; Get All Passed Data. _pos = _this select 0 _shift = _this select 1 _alt = _this select 2 _marker = _this select 3 _execOnShift = _this select 4 _execOnAlt = _this select 5 ; if the shift key requirement isn't met, exit the script ? _shift and !(_execOnShift) : exit ? !(_shift) and _execOnShift : exit ; if the alt key requirement isn't met, exit the script ? _alt and !(_execOnAlt) : exit ? !(_alt) and _execOnAlt : exit ; move the marker to the position clicked. _marker setMarkerPos _pos ; end of script exit fixedWingBombPosition.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Fixed Wing Air Strike Bomb Position by ColonelSandersLite Version V1.0 ; Usage: ; Create 1 Marker (emtpy), name it so you will remember it. ; The marker will be used by the script as the point to attack. ; If player control of the location that is targeted is desired, an outside script should be responsible ; for moving this marker. ; Create 1 man (ungrouped) and name his group by putting mygroupname = group this in his init feild. ; This man should be tucked out of the way ; Create a trigger that covers the man above, name it whatever you want, but it must be ; an "anybody present, repeatedly, condition this, on activation blank" type ; I reccomend a 500X500 rectangle. ; I strongly reccomend limiting the number of strikes the player can have, but this script will provide infinite number of ; strikes as long as pilots don't eject. This is fairly rare, and the script handles up to 11 pilots at a time, so that ; really isn't a concern. ; Create a trigger/script/whatever that calls this script. Parameter details below ; [delayBeforeRunInSeconds, list MyPilotList, "myTargetMarker", "approachFromTheDirection", "exitToTheDirection", preferedFlyingHeight, myGroupName, "myAircraftType", "myPilotType", numberOfVolleysDroped, numberOfBombsPerVolley, delayBetweenVolleys, distanceFromTargetToReleaseFrom] exec "fixedWingLaser1.1.sqs" ; Parameter Example: ; [1, list FWAS_PilotList, "FWAS_Target", "w", "n", 75, Group_FWAS, "A10", "SoldierWPilot", 4, 2, 0.25, 300] Exec "fixedWingMapClick.sqs" ; More information on accepted parameters ; delayBeforeRunInSeconds ; This number lets you set the time between the call for support and the actual attack run of the aircraft. ; list MyPilotList ; list is game code and is mandatory. MyPilotList should be the trigger covering the spawn area as above. ; "myTargetMarker" ; this should be the name of the marker mentioned above in quotes. ; "approachFromTheDirection", "exitToTheDirection" ; these must be one of: "n" "ne" "e" "se" "s" "sw" "w" "nw" and must be different from eachother ; this script will warn you of bad input. ; preferedFlyingHeight ; The aircraft will stay this many meters above the ground. Given ofp's bad pilot AI, this isn't going to be too accurate. ; It is suggested that you make this number at least 50 and do a little testing to see what's reliable in your particular ; situation. ; myGroupName ; should be what you named the soilder's group above ; "myAircraftType" ; tested working standard ofp types below helicopters should work as well, but will suffer a major realism hit. ; "Su25" ; "A10" ; "A10LGB" ; "Cessna" ; "myPilotType" ; tested working standard ofp types below ; "SoldierWPilot" ; "SoldierEPilot" ; "SoldierGPilot" ; "Civilian" ; numberOfVolleysDroped, numberOfBombsPerVolley ; 4, 2 would make the plane drop 4 groups of 2 bombs. ; 4, 1 would bame the plane drop 4 groups of 1 bomb. ; 4, 4 would make the plane drop 4 groups of 4 bombs. ; 1, 2 would make the plane drop 2 bombs. ; etc ; delayBetweenVolleys ; This will controll the tightness of the strike, reccomended value is 0.25 ; distanceFromTargetToReleaseFrom ; The controls the distance from the target to start releasing the bombs at. ; This will vary depending on the altitude release is at, and the speed of the aircraft. ; The below values work well for the A-10, I suggest you start here and tweak to achieve desired results. ; 300 when the fly height is 75 ; 350 when the fly height is 200 ; 450 when the fly height is 400 ; 500 when the fly height is 600 ; BEGIN SCRIPT ; Get All Passed Data. _delayBeforeInbound = _this select 0 _pilotList = _this select 1 _attackMarker = _this select 2 _approachFrom = _this select 3 _exitTo = _this select 4 _flyHeight = _this select 5 _group = _this select 6 _acType = _this select 7 _crewType = _this select 8 _numSalvos = _this select 9 _numBombsPerSalvo = _this select 10 _delayBetweenSalvos = _this select 11 _distanceToStartReleasingFrom = _this select 12 ? (_delayBeforeInbound > 0) : units _group select 0 sideChat "Roger, setting up for attack run, over." ; delay the script's execution the specified number of seconds ~_delayBeforeInbound ; check that the approach and exit directions are valid. If they're not, abort the script ? _approachFrom == _exitTo : hintC "The AI performs eratically when you set the approach and exit directions to be the same. Please set them to different directions"; exit _validApproach = false _validExit = false ? _approachFrom == "n" : _validApproach = true ? _approachFrom == "e" : _validApproach = true ? _approachFrom == "s" : _validApproach = true ? _approachFrom == "w" : _validApproach = true ? _approachFrom == "ne" : _validApproach = true ? _approachFrom == "se" : _validApproach = true ? _approachFrom == "sw" : _validApproach = true ? _approachFrom == "nw" : _validApproach = true ? !(_validApproach) : hintC format["The Approach direction specified is invalid. Must be one of ""n"" ""e"" ""s"" ""w"" ""ne"" ""se"" ""sw"" ""nw""."]; exit ? _exitTo == "n" : _validExit = true ? _exitTo == "e" : _validExit = true ? _exitTo == "s" : _validExit = true ? _exitTo == "w" : _validExit = true ? _exitTo == "ne" : _validExit = true ? _exitTo == "se" : _validExit = true ? _exitTo == "sw" : _validExit = true ? _exitTo == "nw" : _validExit = true ? !(_validExit) : hintC format["The exit direction specified is invalid. Must be one of ""n"" ""e"" ""s"" ""w"" ""ne"" ""se"" ""sw"" ""nw""."]; exit ; spawn the plane and the pilot _aircraft = _acType createVehicle [getPos ((units _group) select 0) select 0, getPos ((units _group) select 0) select 2, 3000] _crewType createunit [getPos ((units _group) select 0), _group, "", 1, "PRIVATE"] ; get the pilot from the pilot list, and stick him in the cockpit. #waitForPilot ~.5 _pilot = objNull "if (typeOf _x == _crewType) then {_x assignAsDriver _aircraft; _x moveInDriver _aircraft}" forEach _pilotList _pilot = driver _aircraft ? (IsNull _pilot) : goto "waitForPilot" ; set the strike aircraft's waypoint and flight altitude _aircraft doMove [getMarkerPos _attackMarker select 0, getMarkerPos _attackMarker select 1, _flyHeight] _aircraft flyInHeight _flyHeight ; set the pilot to be reckless so he doesn't try to engage other opponents "_x setCombatMode ""BLUE""" foreach units _group "_x setBehaviour ""CARELESS""" foreach units _group ; remove all armament from the plane to help enforce him not engaging other opponents removeAllWeapons _aircraft ; start the aircraft on his flight path. ? _approachFrom == "n" : _aircraft setPos [(getMarkerPos _attackMarker select 0), (getMarkerPos _attackMarker select 1) + 2500, _flyHeight]; _aircraft setDir 180; _aircraft setVelocity [0,-111,0] ? _approachFrom == "e" : _aircraft setPos [(getMarkerPos _attackMarker select 0) + 2500, (getMarkerPos _attackMarker select 1), _flyHeight]; _aircraft setDir 270; _aircraft setVelocity [-111,0,0] ? _approachFrom == "s" : _aircraft setPos [(getMarkerPos _attackMarker select 0), (getMarkerPos _attackMarker select 1) - 2500, _flyHeight]; _aircraft setDir 0; _aircraft setVelocity [0,111,0] ? _approachFrom == "w" : _aircraft setPos [(getMarkerPos _attackMarker select 0) - 2500, (getMarkerPos _attackMarker select 1), _flyHeight]; _aircraft setDir 90; _aircraft setVelocity [111,0,0] ? _approachFrom == "ne" : _aircraft setPos [(getMarkerPos _attackMarker select 0) + 1768, (getMarkerPos _attackMarker select 1) + 1768, _flyHeight]; _aircraft setDir 225; _aircraft setVelocity [-78,-78,0] ? _approachFrom == "se" : _aircraft setPos [(getMarkerPos _attackMarker select 0) + 1768, (getMarkerPos _attackMarker select 1) - 1768, _flyHeight]; _aircraft setDir 315; _aircraft setVelocity [-78,78,0] ? _approachFrom == "sw" : _aircraft setPos [(getMarkerPos _attackMarker select 0) - 1768, (getMarkerPos _attackMarker select 1) - 1768, _flyHeight]; _aircraft setDir 45; _aircraft setVelocity [78,78,0] ? _approachFrom == "nw" : _aircraft setPos [(getMarkerPos _attackMarker select 0) - 1768, (getMarkerPos _attackMarker select 1) + 1768, _flyHeight]; _aircraft setDir 135; _aircraft setVelocity [78,-78,0] ; announce the begining of the attack run to the player _pilot sideChat "Inbound on attack run, over." ; keep checking that the plane is still on target ; also moves the wp to keep the plane heading towards the target, even if it moves. _halfwayToWP = false #waitForAircraftToGethalfwayToWP _aircraft doMove [getMarkerPos _attackMarker select 0, getMarkerPos _attackMarker select 1, _flyHeight] ; simply the pythagorean theorem _distanceA = (getpos _aircraft select 0) - (getMarkerPos _attackMarker select 0) _distanceB = (getpos _aircraft select 1) - (getMarkerPos _attackMarker select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? _distanceC <= 1000 : _halfwayToWP = true ~1 ? !_halfwayToWP : goto "waitForAircraftToGethalfwayToWP" ; (faster) keep checking that the plane is still on target ; also moves the wp to keep the plane heading towards the target, even if it moves. _atWP = false #waitForAircraftToReachWP _aircraft doMove [getMarkerPos _attackMarker select 0, getMarkerPos _attackMarker select 1, _flyHeight] ; simply the pythagorean theorem _distanceA = (getpos _aircraft select 0) - (getMarkerPos _attackMarker select 0) _distanceB = (getpos _aircraft select 1) - (getMarkerPos _attackMarker select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? _distanceC <= _distanceToStartReleasingFrom : _atWP = true ; aborts the run if the plane over shot the target without dropping the bomb. ? _distanceC >1000 : _pilot sideChat "Couldn't stay on target, attack run aborted, over."; goto "abortRun" ~.25 ? !_atWP : goto "waitForAircraftToReachWP" ; drop the bomb when over the target. _i = 0 #salvos _j = 0 #bombs _bomb = "laserGuidedBomb" camcreate [getPos _aircraft select 0, getPos _aircraft select 1, ((getPos _aircraft select 2) - 2 -_j)] _bomb setDir (direction _aircraft) _bomb setVelocity [(velocity _aircraft select 0) * .2, (velocity _aircraft select 1) * .2, ((velocity _aircraft select 1) * .5)-2] _j = _j + 1 ~0.1 ? _j < _numBombsPerSalvo : goto "bombs" _i = _i + 1 ~_delayBetweenSalvos ? _i < _numSalvos : goto "salvos" ; this marker is used in the event the plane had to abort the run #abortRun ; this block just makes the plane fly away after the run in the desired direction ? _exitTo == "n" : _exitLocation = [(getMarkerPos _attackMarker select 0), (getMarkerPos _attackMarker select 1) + 5000, _flyHeight] ? _exitTo == "e" : _exitLocation = [(getMarkerPos _attackMarker select 0) + 5000, (getMarkerPos _attackMarker select 1), _flyHeight] ? _exitTo == "s" : _exitLocation = [(getMarkerPos _attackMarker select 0), (getMarkerPos _attackMarker select 1) - 5000, _flyHeight] ? _exitTo == "w" : _exitLocation = [(getMarkerPos _attackMarker select 0) - 5000, (getMarkerPos _attackMarker select 1), _flyHeight] ? _exitTo == "ne" : _exitLocation = [(getMarkerPos _attackMarker select 0) + 3536, (getMarkerPos _attackMarker select 1) + 3536, _flyHeight] ? _exitTo == "se" : _exitLocation = [(getMarkerPos _attackMarker select 0) + 3536, (getMarkerPos _attackMarker select 1) - 3536, _flyHeight] ? _exitTo == "sw" : _exitLocation = [(getMarkerPos _attackMarker select 0) - 3536, (getMarkerPos _attackMarker select 1) - 3536, _flyHeight] ? _exitTo == "nw" : _exitLocation = [(getMarkerPos _attackMarker select 0) - 3536, (getMarkerPos _attackMarker select 1) + 3536, _flyHeight] _aircraft doMove _exitLocation _pilot sideChat "Ordnance deployed, over." ; wait for the plane to extract. _atWP = false #waitForAircraftToReachExit ; simply the pythagorean theorem _distanceA = (getpos _aircraft select 0) - (_exitLocation select 0) _distanceB = (getpos _aircraft select 1) - (_exitLocation select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? _distanceC <= 250 : _atWP = true ~.5 ? !_atWP : goto "waitForAircraftToReachExit" _pilot sideChat "Exiting Mission Area, over." ~1 ; once the plane has extracted, delete it so it's not taking resources anymore deleteVehicle driver _aircraft deleteVehicle _aircraft ; end of script exit sample everon mission.sqm <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">version=11; class Mission { randomSeed=9605123; class Intel { }; class Groups { items=2; class Item0 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={5029.488281,138.444397,6749.663086}; azimut=180.000000; id=0; side="WEST"; vehicle="OfficerW"; player="PLAYER COMMANDER"; leader=1; skill=0.600000; text="soldier1"; }; }; }; class Item1 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={1130.192139,89.903740,11490.961914}; id=1; side="WEST"; vehicle="SoldierWB"; leader=1; rank="COLONEL"; skill=1.000000; init="Group_FWAS = group this"; }; }; }; }; class Markers { items=1; class Item0 { position[]={5011.016602,93.385727,6532.331055}; name="FWAS_Target"; type="Destroy"; colorName="ColorRed"; a=1.200000; b=1.200000; angle=72.388702; }; }; class Sensors { items=5; class Item0 { position[]={5026.414551,156.471176,6935.195801}; a=0.000000; b=0.000000; activationBy="ALPHA"; repeating=1; age="UNKNOWN"; text="Air Strike -75M"; name="AirStrike"; expActiv="[1, list FWAS_PilotList, ""FWAS_Target"", ""w"", ""n"", 75, Group_FWAS, ""A10"", ""SoldierWPilot"", 4, 2, 0.25, 300] Exec ""fixedWingBombPosition.sqs"""; class Effects { }; }; class Item1 { position[]={1153.896484,88.589584,11488.771484}; a=500.000000; b=500.000000; rectangular=1; activationBy="ANY"; repeating=1; age="UNKNOWN"; text="FWAS_PilotList"; name="FWAS_PilotList"; class Effects { }; }; class Item2 { position[]={5026.414551,155.860260,6907.097168}; a=0.000000; b=0.000000; activationBy="BRAVO"; repeating=1; age="UNKNOWN"; text="Air Strike - 200M"; name="AirStrike_1"; expActiv="[1, list FWAS_PilotList, ""FWAS_Target"", ""w"", ""n"", 200, Group_FWAS, ""A10"", ""SoldierWPilot"", 4, 2, 0.25, 350] Exec ""fixedWingBombPosition.sqs"""; class Effects { }; }; class Item3 { position[]={5024.659180,154.515060,6880.753418}; a=0.000000; b=0.000000; activationBy="CHARLIE"; repeating=1; age="UNKNOWN"; text="Air Strike - 400M"; name="AirStrike_1_1"; expActiv="[1, list FWAS_PilotList, ""FWAS_Target"", ""w"", ""n"", 400, Group_FWAS, ""A10"", ""SoldierWPilot"", 4, 2, 0.25, 450] Exec ""fixedWingBombPosition.sqs"""; class Effects { }; }; class Item4 { position[]={5024.659180,153.887100,6859.679688}; a=0.000000; b=0.000000; activationBy="DELTA"; repeating=1; age="UNKNOWN"; text="Air Strike - 600M"; name="AirStrike_1_1_1"; expActiv="[1, list FWAS_PilotList, ""FWAS_Target"", ""w"", ""n"", 600, Group_FWAS, ""A10"", ""SoldierWPilot"", 4, 2, 0.25, 500] Exec ""fixedWingBombPosition.sqs"""; class Effects { }; }; }; }; class Intro { randomSeed=12544003; class Intel { }; }; class OutroWin { randomSeed=10262019; class Intel { }; }; class OutroLoose { randomSeed=8190979; class Intel { }; }; init.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">~1 onMapSingleClick {[_pos, _shift, _alt, "FWAS_Target", false, false] exec "CSLMapClick.sqs"} Share this post Link to post Share on other sites
Guest Posted April 25, 2006 Hope you dont kill me here... lol I can see youve been extremely busy getting up scripts for folks, and I greatly appreciate the spawned mobilized infantry squad script, but I am having problems with keeping track of these vehicles if they get stopped along the way, not that I cant access this info but there are so many variables involved and it isessential that the units they carry get to their destinations more less on time, so... My absolute fix for this is to switch to helos instead of vehicles, even in the slim chance a helo gets shot down the occupants will likely all be dead, so no checks are needed, they either make it or they dont. And so, I would at least like to just put down my interest in seeing a script that does similiar to what you did with the bmp but using a chopper instead, a script that does this: spawns a helo that has a seperate group pilot spawns a number of units near the helo that are joined to a group that has existed from the beginning (editor placed). This group will be at the destination for the fly-in drop off. The units board the helo and it flys them to a marker which is the location of the group they are joined to. The helo lands, drops them off and then returns to its original spawn position and lands. And no biggie either way on this, I just had to put this down after spending about 6 hours on testing the ground vehicles being used for reinforcement transports and seeing its too undependable, and seeing that helos are the only way to go. Ill still prolly use the vehicle spawn but for less crucial stuff, where the mission progression does not depend on vehicles making it to certain positions. Lastly, like I said youve already done alot, so either way its up to you, if you want to when you have the time, if not no biggie. Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 25, 2006 It would probably be fairly easy to modify it to be a helo script. If you have a mission where the guys are acting unpredictably, I'd like to see it. Really. Unpredictable behavior is 90% likely to be bug induced. The 9% of the time, this would likely be due to the settings used when running the script and built in ofp behavior. I was thinking about revisiting this script anyways, mostly I wanted to add more waypoints and a add little more control of how the AI approaches said waypoints. I have a few other Ideas floating around as well. Seriously though, I'd greatly appreciate it if you make a clean example (no addons, mission stripped to the most basic elements) of these acting unpredictably, document where the unpredictability is likely to occure in your example, zip it, and e-mail it to colonelsanderslite@hotmail.com I also appreciate feedback on my scripts as well. If you think an area should be improved upon or changed, let me know. I'm a reasonable guy and won't be offended if you say, "well gee CSL, the way you made the squad selection work sucks". Share this post Link to post Share on other sites
Guest Posted April 25, 2006 Thanks for the kind response. Actually its an issue with the mission itself, not ur script at all, see the mission needs to have reinforcements sent in occasionally to specific towns -14 possible towns, enemy or freindly, so its actually a script that will cover a possible almost 30 reinforcement plans (both sides), and so right there is an issue, where I cant just send them in strait lines either, they get stuck going around walls and fences, so each plan has to be individualized with multiple waypoints to get to the destination, then if indeed the truck gets stuck, shot up, etc, I have to find something to do with the leftovers, and then add in new checks in the townbattle script to keep those reinforcements from coming in at the wrong time and really messing everything up... I started putting checks in yesterday, its not worth the time lol, it would take forever and be difficult, helos fix the whooole thing, they only need their destination and return point, no obstacles to worry about, and if one gets shot down there wont be 10 units left over ransacking a town when I dont want em to. Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 25, 2006 Quote[/b] ]so right there is an issue, where I cant just send them in strait lines either, they get stuck going around walls and fences, so each plan has to be individualized with multiple waypoints to get to the destination Yeah, looks like my script needs more waypoints, I was going to add that anyways. Also, since the group name is known outside of the script, you could rig something that make the reenforcements retreat to another point if the town falls or they take too many losses. Anyways, yeah, I'll put together a helicopter version soon. Share this post Link to post Share on other sites
Guest Posted April 26, 2006 Quote[/b] ]Also, since the group name is known outside of the script, you could rig something that make the reenforcements retreat to another point if the town falls or they take too many losses. Anyways, yeah, I'll put together a helicopter version soon. Your right on the money, lol, I had thought of sending those reinforcements to one of many camp positions, problem is that reinforcements may have a freindly held base nearby, which if they moved to that would cause issues with unit counts within that base, causing script problems, and if they goto a camp instead of freindly nearby base, players will be like huh?.. lol That helo version would be awsome, as I said it would solve the matter at hand, and would be reliable to get from point a to point b without issues, nor 5 dif marker locals. The Mobile Infantry Spawn script you made will still work well in the mission for keeping vehicles moving about, its just that for a particular application that is so mission sensitive that those reinforcements get there for sure on a dynamic style mission almost requires either tons of checks or a solid yes or no = the units made it there, in this mission the last option would be helos. Take your time man, your generosity is great, but Im in no hurry and I cant even believe the amount of scripts you have put out over the last few weeks here.. Thanks for your efforts. Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 26, 2006 Fixed Wing Cargo Plane Ammo Drop on Map Click To run the demo mission you'll need this : http://ofp.gamepark.cz/index.php?showthis=8859 First The Main Scripts. AirDropAmmo.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Fixed Wing Air Drop Ammunition On Position by ColonelSandersLite Version V1.0 ; Usage: ; Create 1 Marker (emtpy), name it so you will remember it. ; The marker will be used by the script as the point to attack. ; If player control of the location that is targeted is desired, an outside script should be responsible ; for moving this marker. ; Create 1 man (ungrouped) and name his group by putting mygroupname = group this in his init feild. ; This man should be tucked out of the way ; Create a trigger that covers the man above, name it whatever you want, but it must be ; an "anybody present, repeatedly, condition this, on activation blank" type ; I reccomend a 500X500 rectangle. ; Create a trigger/script/whatever that calls this script. Parameter details below ; [delayBeforeRunInSeconds, list MyPilotList, "myAirDropMarker", "approachFromTheDirection", "exitToTheDirection", preferedFlyingHeight, myGroupName, "myAircraftType", "myPilotType", distanceFromDropZoneToReleaseFrom, "smokeOnWayDown", "smokeOnGround", seaLevelTriggerName, numberOfWeaponTypes, numberOfMagazineTypes, ***numberOfWeapons***, ***"weaponType"***, ***numberOfMagazines***, ***"magazineType"***] exec "AirDropAmmo.sqs" ; Create another trigger that does nothing with radius 0,0 ; Name it something you will remember ; This trigger is used by the script to keep track of the ground lever vs sea level ; Parameter Example: ; [1, list AirDrop_PilotList, "AirDropMarker", "w", "n", 75, Group_AirDrop, "hwk_C130g", "SoldierWPilot", 150, "none", "none", SeaLevelTrigger, 2, 3, 1, "LAWLauncher", 2, "Beretta", 4, "M16", 8, "BerettaMag", 3, "LAWLauncher"] Exec "AirDropAmmo.sqs" ; More information on accepted parameters ; delayBeforeRunInSeconds ; This number lets you set the time between the call for support and the actual attack run of the aircraft. ; list MyPilotList ; list is game code and is mandatory. AirDrop_PilotList should be the trigger covering the spawn area as above. ; "AirDropMarker" ; this should be the name of the marker mentioned above in quotes. ; "approachFromTheDirection", "exitToTheDirection" ; these must be one of: "n" "ne" "e" "se" "s" "sw" "w" "nw" and must be different from eachother ; this script will warn you of bad input. ; preferedFlyingHeight ; The aircraft will stay this many meters above the ground. Given ofp's bad pilot AI, this isn't going to be too accurate. ; It is suggested that you make this number at least 75 and do a little testing to see what's reliable in your particular ; situation. ; myGroupName ; should be what you named the soilder's group above ; "myAircraftType" ; Designed for Updated Hawks C-130 1.4_Beta available at: ; http://ofp.gamepark.cz/index.php?showthis=8859 ; Other Fixed wing transports should work with little or no modification to this script ; "myPilotType" ; tested working standard ofp types below ; "SoldierWPilot" ; "SoldierEPilot" ; "SoldierGPilot" ; "Civilian" ; distanceFromDropZoneToReleaseFrom ; The controls the distance from the Drop Zone to release the cargo at. ; This will vary, mostly depending on the he speed of the aircraft. ; 75 works well for the Updated Hawks C-130 1.4_Beta regardless of altitude ; Naturally, the higher the drop altitude, the less accurate the drop will be due to wind drift, etc. ; "smokeOnWayDown", "smokeOnGround" ; These can be either "None" or "typeOfSmokeShell" ; Tested BIS Smoke Shells are "smokeShell", "smokeShellRed", "smokeShellGreen" ; 3rd party shells should work but are untested ; seaLevelTriggerName ; this should be the name of the trigger to get sea level ground level difference mentioned above. ; numberOfWeaponTypes, numberOfMagazineTypes ; this is the number of weapon and magazine types you want to put in the script. ; more on this below ; ***numberOfWeapons***, ***"weaponType"*** ; this is a pair, you can have (practically) an unlimited amount of them. The number of pairs MUST match the ; number Of Weapon Types above, or it WILL cause errors ; ***numberOfMagazines***, ***"magazineType"*** ; this is another pair, you can have (practically) an unlimited amount of them. ; The number of pairs MUST match the number Of Magazine Types above, or it WILL cause errors ; examples for the ; numberOfWeaponTypes, numberOfMagazineTypes, numberOfWeapons, "weaponType", numberOfMagazines, "magazineType" ; pairs: ; 5, 7, 4, "m16", 2 "lawLauncher", 1, "beretta", 1, "m60", 2, "M16GrenadeLauncher", 25, "m16", 4, "berettaMag", 6, "m60", 6, "lawLaucher", 6, "grenade", 6, "flare", 6, "flareRed"] ; this would be the same as scripting: ; myCrate addWeaponCargo ["m16",4] ; myCrate addWeaponCargo ["lawLauncher",2] ; myCrate addWeaponCargo ["beretta",1] ; myCrate addWeaponCargo ["m60",1] ; myCrate addWeaponCargo ["m16GrenadeLauncher",2] ; myCrate addMagazineCargo ["m16",25] ; myCrate addMagazineCargo ["berettaMag",4] ; myCrate addMagazineCargo ["m60",6] ; myCrate addMagazineCargo ["lawLaucher",6] ; myCrate addMagazineCargo ["grenade",6] ; myCrate addMagazineCargo ["flare",6] ; myCrate addMagazineCargo ["flareRed",6] ; which would add 4 m-16's, 2 law launchers, 1 beretta, 1 m-60 machine gun, ; 2 m-16s with m-203 launchers, 25 m-16 magazines, 4 beretta magazines, 6 LAWS, ; 6 Belts M-60 Ammo, 6 M-203 launched grenades, 6 flares, 6 Red Flares ; 0, 7, 25, "m16", 4, "berettaMag", 10, "m60", 5, "lawLaucher", 10, "grenade", 3, "flare", 3, "flareRed"] ; note that there is no weapons added here, only magazines ; this would be the same as scripting: ; myCrate addMagazineCargo ["m16",25] ; myCrate addMagazineCargo ["berettaMag",4] ; myCrate addMagazineCargo ["m60",10] ; myCrate addMagazineCargo ["lawLaucher",5] ; myCrate addMagazineCargo ["grenade",10] ; myCrate addMagazineCargo ["flare",3] ; myCrate addMagazineCargo ["flareRed",3] ; which would add 25 m-16 magazines, 4 beretta magazines, 5 LAWS, ; 10 Belts M-60 Ammo, 10 M-203 launched grenades, 3 flares, 3 Red Flares ; 5, 0, 4, "m16", 2 "lawLauncher", 1, "beretta", 1, "m60", 2, "M16GrenadeLauncher"] ; note that there is no magazines added here, only weapons ; this would be the same as scripting: ; myCrate addWeaponCargo ["m16",4] ; myCrate addWeaponCargo ["lawLauncher",2] ; myCrate addWeaponCargo ["beretta",1] ; myCrate addWeaponCargo ["m60",1] ; myCrate addWeaponCargo ["m16GrenadeLauncher",2] ; which would add 4 m-16's, 2 law launchers, 1 beretta, 1 m-60 machine gun, ; 2 m-16s with m-203 launchers ; BEGIN SCRIPT ; Get All Passed Data. _delayBeforeInbound = _this select 0 _pilotList = _this select 1 _dropMarker = _this select 2 _approachFrom = _this select 3 _exitTo = _this select 4 _flyHeight = _this select 5 _group = _this select 6 _acType = _this select 7 _crewType = _this select 8 _distanceToDropFrom = _this select 9 _smokeOnWayDown = _this select 10 _smokeOnGround = _this select 11 _seaLevelTrigger = _this select 12 _numberOfWeaponTypes = _this select 13 _numberOfMagazineTypes = _this select 14 ; spawn the ammo box _ammoCrate = "ReammoBoxWest" createVehicle getPos (units _group select 0) ; get the ETA to the DZ _etaToDZ = ((_delayBeforeInbound/60)+.5)-(((_delayBeforeInbound/60)+.5) mod 1) ? (_etaToDZ > 0) : units _group select 0 sideChat format["Roger, en route to DZ, ETA %1 mins over.", _etaToDZ] ? (_etaToDZ <= 0) : units _group select 0 sideChat "Roger, en route to DZ, over. " ; delay the script's execution the specified number of seconds ~_delayBeforeInbound ; check that the approach and exit directions are valid. If they're not, abort the script ? _approachFrom == _exitTo : hintC "The AI performs eratically when you set the approach and exit directions to be the same. Please set them to different directions"; exit _validApproach = false _validExit = false ? _approachFrom == "n" : _validApproach = true ? _approachFrom == "e" : _validApproach = true ? _approachFrom == "s" : _validApproach = true ? _approachFrom == "w" : _validApproach = true ? _approachFrom == "ne" : _validApproach = true ? _approachFrom == "se" : _validApproach = true ? _approachFrom == "sw" : _validApproach = true ? _approachFrom == "nw" : _validApproach = true ? !(_validApproach) : hintC format["The Approach direction specified is invalid. Must be one of ""n"" ""e"" ""s"" ""w"" ""ne"" ""se"" ""sw"" ""nw""."]; exit ? _exitTo == "n" : _validExit = true ? _exitTo == "e" : _validExit = true ? _exitTo == "s" : _validExit = true ? _exitTo == "w" : _validExit = true ? _exitTo == "ne" : _validExit = true ? _exitTo == "se" : _validExit = true ? _exitTo == "sw" : _validExit = true ? _exitTo == "nw" : _validExit = true ? !(_validExit) : hintC format["The exit direction specified is invalid. Must be one of ""n"" ""e"" ""s"" ""w"" ""ne"" ""se"" ""sw"" ""nw""."]; exit ; spawn the plane and the pilot _aircraft = _acType createVehicle [getPos ((units _group) select 0) select 0, getPos ((units _group) select 0) select 2, 3000] _crewType createunit [getPos ((units _group) select 0), _group, "", 1, "PRIVATE"] ; get the pilot from the pilot list, and stick him in the cockpit. #waitForPilot ~.5 _pilot = objNull "if (typeOf _x == _crewType) then {_x assignAsDriver _aircraft; _x moveInDriver _aircraft}" forEach _pilotList _pilot = driver _aircraft ? (IsNull _pilot) : goto "waitForPilot" ; set the strike aircraft's waypoint and flight altitude _aircraft doMove [getMarkerPos _dropMarker select 0, getMarkerPos _dropMarker select 1, _flyHeight] _aircraft flyInHeight _flyHeight ; set the pilot to be reckless so he doesn't try to engage other opponents "_x setCombatMode ""BLUE""" foreach units _group "_x setBehaviour ""CARELESS""" foreach units _group ; remove all armament from the plane to help enforce him not engaging other opponents removeAllWeapons _aircraft ; start the aircraft on his flight path. ? _approachFrom == "n" : _aircraft setPos [(getMarkerPos _dropMarker select 0), (getMarkerPos _dropMarker select 1) + 2500, _flyHeight]; _aircraft setDir 180; _aircraft setVelocity [0,-111,0] ? _approachFrom == "e" : _aircraft setPos [(getMarkerPos _dropMarker select 0) + 2500, (getMarkerPos _dropMarker select 1), _flyHeight]; _aircraft setDir 270; _aircraft setVelocity [-111,0,0] ? _approachFrom == "s" : _aircraft setPos [(getMarkerPos _dropMarker select 0), (getMarkerPos _dropMarker select 1) - 2500, _flyHeight]; _aircraft setDir 0; _aircraft setVelocity [0,111,0] ? _approachFrom == "w" : _aircraft setPos [(getMarkerPos _dropMarker select 0) - 2500, (getMarkerPos _dropMarker select 1), _flyHeight]; _aircraft setDir 90; _aircraft setVelocity [111,0,0] ? _approachFrom == "ne" : _aircraft setPos [(getMarkerPos _dropMarker select 0) + 1768, (getMarkerPos _dropMarker select 1) + 1768, _flyHeight]; _aircraft setDir 225; _aircraft setVelocity [-78,-78,0] ? _approachFrom == "se" : _aircraft setPos [(getMarkerPos _dropMarker select 0) + 1768, (getMarkerPos _dropMarker select 1) - 1768, _flyHeight]; _aircraft setDir 315; _aircraft setVelocity [-78,78,0] ? _approachFrom == "sw" : _aircraft setPos [(getMarkerPos _dropMarker select 0) - 1768, (getMarkerPos _dropMarker select 1) - 1768, _flyHeight]; _aircraft setDir 45; _aircraft setVelocity [78,78,0] ? _approachFrom == "nw" : _aircraft setPos [(getMarkerPos _dropMarker select 0) - 1768, (getMarkerPos _dropMarker select 1) + 1768, _flyHeight]; _aircraft setDir 135; _aircraft setVelocity [78,-78,0] ; keep checking that the plane is still on target ; also moves the wp to keep the plane heading towards the target, even if it moves. _halfwayToWP = false #waitForAircraftToGethalfwayToWP _aircraft doMove [getMarkerPos _dropMarker select 0, getMarkerPos _dropMarker select 1, _flyHeight] ; simply the pythagorean theorem _distanceA = (getpos _aircraft select 0) - (getMarkerPos _dropMarker select 0) _distanceB = (getpos _aircraft select 1) - (getMarkerPos _dropMarker select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? _distanceC <= 1000 : _halfwayToWP = true ~1 ? !_halfwayToWP : goto "waitForAircraftToGethalfwayToWP" ; (faster) keep checking that the plane is still on target ; also moves the wp to keep the plane heading towards the target, even if it moves. _atWP = false #waitForAircraftToReachWP _aircraft doMove [getMarkerPos _dropMarker select 0, getMarkerPos _dropMarker select 1, _flyHeight] ; simply the pythagorean theorem _distanceA = (getpos _aircraft select 0) - (getMarkerPos _dropMarker select 0) _distanceB = (getpos _aircraft select 1) - (getMarkerPos _dropMarker select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? _distanceC <= _distanceToDropFrom : _atWP = true ; aborts the run if the plane over shot the target without dropping the bomb. ? _distanceC >1000 : _pilot sideChat "Couldn't stay on target, supply drop aborted, over."; goto "abortRun" ~.25 ? !_atWP : goto "waitForAircraftToReachWP" ; drop the crate when over the target. these parameters should not be modified here [_aircraft, _smokeOnWayDown, _smokeOnGround, _seaLevelTrigger, _ammoCrate] exec "drop.sqs" _pilot sideChat "Cargo deployed, over." ; Set the Weapon and Magazine Cargo of the weaponcrate clearMagazineCargo _ammoCrate clearWeaponCargo _ammoCrate _currSelection = 15 ? _numberOfWeaponTypes == 0 : goto "skipWeapons" _weaponsCounter = 0 #startWeapons _ammoCrate addWeaponCargo[_this select (_currSelection +1), _this select _currSelection] _currSelection = _currSelection + 2 _weaponsCounter = _weaponsCounter + 1 ? (_weaponsCounter < _numberOfWeaponTypes) : goto "startWeapons" #skipWeapons ? _numberOfMagazineTypes == 0 : goto "skipMagazines" _magazinesCounter = 0 #startMagazines _ammoCrate addMagazineCargo[_this select (_currSelection + 1), _this select _currSelection] _currSelection = _currSelection + 2 _magazinesCounter = _magazinesCounter + 1 ? (_magazinesCounter < _numberOfMagazineTypes) : goto "startMagazines" #skipMagazines ; this marker is used in the event the plane had to abort the run #abortRun ; this block just makes the plane fly away after the run in the desired direction ? _exitTo == "n" : _exitLocation = [(getMarkerPos _dropMarker select 0), (getMarkerPos _dropMarker select 1) + 5000, _flyHeight] ? _exitTo == "e" : _exitLocation = [(getMarkerPos _dropMarker select 0) + 5000, (getMarkerPos _dropMarker select 1), _flyHeight] ? _exitTo == "s" : _exitLocation = [(getMarkerPos _dropMarker select 0), (getMarkerPos _dropMarker select 1) - 5000, _flyHeight] ? _exitTo == "w" : _exitLocation = [(getMarkerPos _dropMarker select 0) - 5000, (getMarkerPos _dropMarker select 1), _flyHeight] ? _exitTo == "ne" : _exitLocation = [(getMarkerPos _dropMarker select 0) + 3536, (getMarkerPos _dropMarker select 1) + 3536, _flyHeight] ? _exitTo == "se" : _exitLocation = [(getMarkerPos _dropMarker select 0) + 3536, (getMarkerPos _dropMarker select 1) - 3536, _flyHeight] ? _exitTo == "sw" : _exitLocation = [(getMarkerPos _dropMarker select 0) - 3536, (getMarkerPos _dropMarker select 1) - 3536, _flyHeight] ? _exitTo == "nw" : _exitLocation = [(getMarkerPos _dropMarker select 0) - 3536, (getMarkerPos _dropMarker select 1) + 3536, _flyHeight] _aircraft doMove _exitLocation ; wait for the plane to extract. _atWP = false #waitForAircraftToReachExit ; simply the pythagorean theorem _distanceA = (getpos _aircraft select 0) - (_exitLocation select 0) _distanceB = (getpos _aircraft select 1) - (_exitLocation select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? _distanceC <= 250 : _atWP = true ~.5 ? !_atWP : goto "waitForAircraftToReachExit" _pilot sideChat "Exiting Mission Area, over." ~1 ; once the plane has extracted, delete it so it's not taking resources anymore deleteVehicle driver _aircraft deleteVehicle _aircraft ; end of script exit drop.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Fixed Wing Air Drop Ammunition On Position by ColonelSandersLite Version V1.0 Part 2: "drop.sqs" ; Usage: ; there are no usage requirements outside of what is required by the parent script ; except that this script must be named drop.sqs, or the name of this script must ; be changed in the parent script _aircraft = _this select 0 _smokeOnWayDown = _this select 1 _smokeOnGround = _this select 2 _seaLevelTrigger = _this select 3 _ammoCrate = _this select 4 _spawnLocation = [getPos driver _aircraft select 0, getPos driver _aircraft select 1, (getPos driver _aircraft select 2)-5] _dropVelocity = [(velocity _aircraft select 0) * 0.5, (velocity _aircraft select 1) * 0.5, (velocity _aircraft select 2) * 0.5] ; create the parachute and game logic to drive it, set their velocity, and move the logic in the parachute _parachute = "ParachuteWest" camCreate _spawnLocation _parachute setVelocity _dropVelocity _parachuteDriver = "Logic" camCreate _spawnLocation _parachuteDriver setVelocity _dropVelocity _parachuteDriver moveInDriver _parachute ; create the smoke trail for the fall if it's enabled, else, just make a logic ? _smokeOnWayDown == "None" : _smokeFall = "Logic" camCreate [0, 0, 0] ? _smokeOnWayDown != "None" : _smokeFall = _smokeOnWayDown camCreate [0, 0, 0] ; loop to set the ammobox's position to stay on the parachute and the smoketrail to stay on the ammo box _inAir = true _aSL = 0 _counter = 0 #moveAmmoBox ; anything more than .01 give jerky response ~0.01 ; reset the smoke trail periodically so it doesn't go out before it hits the ground ? (_counter >= 250) AND _smokeOnWayDown != "None" : deleteVehicle _smokeFall ? (_counter >= 250) AND _smokeOnWayDown != "None" : _smokeFall = _smokeOnWayDown camCreate [0, 0, 0] ? _counter >= 250 : _counter = 0 ; move the ammo crate to the correct position _ammoCrate setPos [(getPos _parachuteDriver select 0), (getPos _parachuteDriver select 1), (getPos _parachuteDriver select 2) + 1] _ammoCrate setDir (direction _parachute) ; get the ground's altitude above sea level, only if smoke trail is enabled ? _smokeOnWayDown != "None" : _seaLevelTrigger setPos [(getPos _parachuteDriver select 0), (getPos _parachuteDriver select 1), 0] ? _smokeOnWayDown != "None" : _aSL = ((getPos _seaLevelTrigger select 2) * -1) ; set the smoke trails position to the ammo crate _smokeFall setPos [(getPos _ammoCrate select 0), (getPos _ammoCrate select 1), (getPos _ammoCrate select 2) + _aSL + 2] _smokeFall setDir (direction _parachute) _smokeFall setVelocity (velocity _parachute) ; check to see if ammo crate is on the ground ? (getPos _ammoCrate select 2) <= 3 : _inAir = false _counter = _counter + 1 ; exit loop when ammo crate is on the ground ? _inAir : goto "moveAmmoBox" ; move the ammo crate to it's final resting place _finalPos = [(getPos _ammoCrate select 0), (getPos _ammoCrate select 1), 0] _ammoCrate setPos _finalPos ; delete the old stuff so they aren't taking resources anymore deleteVehicle _smokeFall deleteVehicle _parachuteDriver deleteVehicle _parachute ; if the crate is supposed to release smoke on the ground to mark it's location, do so ? _smokeOnGround != "None" : _smokeGround = _smokeOnGround camCreate [0,0,0] ? _smokeOnGround == "None" : _smokeGround = "Logic" camCreate [0, 0, 0] _smokeGround setPos [(getPos _ammoCrate select 0), (getPos _ammoCrate select 1), 0] Now the sample mission: init.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">~1 onMapSingleClick {[_pos, _shift, _alt, "AirDropMarker", false, false] exec "CSLMapClick.sqs"} CSLMapClick.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Move Marker On Map Click by ColonelSandersLite Version V1.0 ; Note that some mods may interfere with this. ECP will when you use AI release or HELO Coms. ; the mission designer should warn the player about this potential complication. ; If this script may not be needed if the mission is designed for a mod that already does this. ; Usage: ; Create 1 Marker (emtpy), name it so you will remember it. ; The marker will be moved by this script. ; create an init.sqs file in your mission directory if you don't have one already ; at the bottom of your init.sqs, add a small delay before this script is activated like this: ; ~1 (without the semicolon or this text) ; below your delay activate this script, parameter details below: ; onMapSingleClick {[_pos, _shift, _alt, "MyMarkerName", booleanShiftRequired, booleanAltRequired] exec "CSLMapClick.sqs"} ; example usage: ; onMapSingleClick {[_pos, _shift, _alt, "FWAS_Target", false, false] exec "CSLMapClick.sqs"} ; Parameter Details: ; _pos, _shift, _alt ; these are game code and are mandatory as written. ; "MyMarkerName" ; This should be the name of the marker above in quotes. ; booleanShiftRequired ; true or false ; This specifies wether the script should require the left shift key to be held down before activating. ; booleanAltRequired ; true or false ; This specifies wether the script should require the left alt key to be held down before activating. ; BEGIN SCRIPT ; Get All Passed Data. _pos = _this select 0 _shift = _this select 1 _alt = _this select 2 _marker = _this select 3 _execOnShift = _this select 4 _execOnAlt = _this select 5 ; if the shift key requirement isn't met, exit the script ? _shift and !(_execOnShift) : exit ? !(_shift) and _execOnShift : exit ; if the alt key requirement isn't met, exit the script ? _alt and !(_execOnAlt) : exit ? !(_alt) and _execOnAlt : exit ; move the marker to the position clicked. _marker setMarkerPos _pos ; end of script exit everon mission.sqm <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">version=11; class Mission { addOns[]= { "hwk_c130", "bis_resistance" }; addOnsAuto[]= { "hwk_c130" }; randomSeed=12484099; class Intel { }; class Groups { items=2; class Item0 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={4844.812500,24.660000,10948.357422}; azimut=278.454987; id=0; side="WEST"; vehicle="OfficerW"; player="PLAYER COMMANDER"; leader=1; skill=0.600000; init="removeAllWeapons this; this addWeapon ""m16"""; }; }; }; class Item1 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={1123.719971,89.310814,11471.974609}; id=2; side="WEST"; vehicle="SoldierWB"; leader=1; rank="COLONEL"; skill=1.000000; init="Group_AirDrop = group this"; }; }; }; }; class Vehicles { items=1; class Item0 { position[]={4771.595215,24.660000,10955.657227}; id=1; side="EMPTY"; vehicle="hwk_C130g"; skill=0.600000; }; }; class Markers { items=1; class Item0 { position[]={4823.507813,24.660000,10951.650391}; name="AirDropMarker"; type="Flag"; angle=-214.957993; }; }; class Sensors { items=6; class Item0 { position[]={4969.309570,33.266895,10966.465820}; a=0.000000; b=0.000000; repeating=1; age="UNKNOWN"; text="SeaLevelTrigger"; name="SeaLevelTrigger"; class Effects { }; }; class Item1 { position[]={1147.424316,89.319298,11469.783203}; a=500.000000; b=500.000000; rectangular=1; activationBy="ANY"; repeating=1; age="UNKNOWN"; text="AirDrop_PilotList"; name="AirDrop_PilotList"; class Effects { }; }; class Item2 { position[]={5016.400391,32.976002,10941.697266}; a=0.000000; b=0.000000; activationBy="BRAVO"; repeating=1; age="UNKNOWN"; text="Ammo Drop - 200M"; name="AirDrop_1"; expActiv="[67, list AirDrop_PilotList, ""AirDropMarker"", ""w"", ""n"", 200, Group_AirDrop, ""hwk_C130g"", ""SoldierWPilot"", 150, ""SmokeShellRed"", ""SmokeShellRed"", SeaLevelTrigger, 2, 3, 1, ""LAWLauncher"", 2, ""Beretta"", 4, ""M16"", 8, ""BerettaMag"", 3, ""LAWLauncher""] Exec ""AirDropAmmo.sqs"""; class Effects { }; }; class Item3 { position[]={5014.645020,32.072227,10915.353516}; a=0.000000; b=0.000000; activationBy="CHARLIE"; repeating=1; age="UNKNOWN"; text="Ammo Drop - 400M"; name="AirDrop_1_1"; expActiv="[120, list AirDrop_PilotList, ""AirDropMarker"", ""w"", ""n"", 400, Group_AirDrop, ""hwk_C130g"", ""SoldierWPilot"", 150, ""SmokeShellGreen"", ""SmokeShellGreen"", SeaLevelTrigger, 2, 3, 1, ""LAWLauncher"", 2, ""Beretta"", 4, ""M16"", 8, ""BerettaMag"", 3, ""LAWLauncher""] Exec ""AirDropAmmo.sqs"""; class Effects { }; }; class Item4 { position[]={5014.645020,31.145327,10894.279297}; a=0.000000; b=0.000000; activationBy="DELTA"; repeating=1; age="UNKNOWN"; text="Ammo Drop - 600M"; name="AirDrop_1_1_1"; expActiv="[150, list AirDrop_PilotList, ""AirDropMarker"", ""w"", ""n"", 600, Group_AirDrop, ""hwk_C130g"", ""SoldierWPilot"", 150, ""SmokeShell"", ""SmokeShell"", SeaLevelTrigger, 2, 3, 1, ""LAWLauncher"", 2, ""Beretta"", 4, ""M16"", 8, ""BerettaMag"", 3, ""LAWLauncher""] Exec ""AirDropAmmo.sqs"""; class Effects { }; }; class Item5 { position[]={5016.400391,33.350689,10961.198242}; a=0.000000; b=0.000000; activationBy="ALPHA"; repeating=1; age="UNKNOWN"; text="Ammo Drop - 75M"; name="AirDrop"; expActiv="[25, list AirDrop_PilotList, ""AirDropMarker"", ""w"", ""n"", 75, Group_AirDrop, ""hwk_C130g"", ""SoldierWPilot"", 150, ""none"", ""none"", SeaLevelTrigger, 2, 3, 1, ""LAWLauncher"", 2, ""Beretta"", 4, ""M16"", 8, ""BerettaMag"", 3, ""LAWLauncher""] Exec ""AirDropAmmo.sqs"""; class Effects { }; }; }; }; class Intro { randomSeed=507907; class Intel { }; }; class OutroWin { randomSeed=881667; class Intel { }; }; class OutroLoose { randomSeed=6334979; class Intel { }; }; Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 29, 2006 Spawn Air Cavalry Squad The main scripts first: spawnAirCavSquad.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Spawn Air Cav Squad By ColonelSandersLite V1.0 ; Usage: ; Create a Marker, for the spawn location of the air mobile squad. ; Create 6 markers for the helicopter's flight path. Waypoint 3 will be where the helicopter is to land and unload ; the squad. Waypoint 6 will be the helicopters final destination, and the heli will be deleted once it reaches this ; You CAN use less waypoints if desired. You MUST have a minimum of 2 though, the DZ and the egress point. ; There is an important game engine limitation that must be addressed however. Do not try to make the waypoint more than ; about 4500 meters away from the previous point. (use a rectangle trigger with size 4500 X 1 as a measuring stick) ; This limitation is due to the ai pathing. Even in helicopters, the pathing will choke and it will just sit there. ; This is especially a problem when time is compressed, and probably on high intensity missions, where ai pathing ; likely gets slightly simplified (less nodes and so forth) ; It's also important to note that depending on addons, the helicopters speed, and the specified fly height, ; the dz's exact location will need to be tweaked. Helicopters land consistantly on the same spot, but due ; to different flight models, they will slow at different speeds. ; The helicopter WILL land where it's told to land. There are no checks to make sure it's not in the middle of a forest ; so intelligent placeing of the DZ is up to the mission designer. ; Create a man from the appropriate side in a safe remote area. He should not be grouped to any other units. ; name his group by putting the following in his init field: MyCrewGroupName = group this ; where "MyCrewGroupName" is what you want to name the group. ; Create 3 markers for the squads movement path. Waypoint 3 is the groups final objective. You can use less as ; for helicopters above, but you must use at least one. ; Create a man from the appropriate side in a safe remote area. He should not be grouped to any other units. ; name his group by putting the following in his init field: MySquadGroupName = group this ; where "MySquadGroupName" is what you want to name the group. ; Create your script, trigger, whatever that calls this script. The full parameter list below: ; ["mySpawnMarkersName", "helicopterWP1", "helicopterWP2", "Drop Zone", "helicopterWP4", "helicopterWP5", "helicopterEgressWP", "helicopterBehavior", "helicopterCombatMode", flyingHeightInMeters, "helicopterType", MyCrewGroupName, numberOfCrew, "crewType", "squadWP1", "squadWP2", "squadObjectiveWP", "squadBehavior", "squadCombatMode", MySquadGroupName, squadSkillLevel, numberOfSquadMates, ***"typeOfSolier"***] exec "spawnAirCavSquad.sqs" ; Example: ; ["test_spawnW", "test_Helicopter_WP1W", "test_Helicopter_WP2W", "test_Helicopter_unloadW", "test_Helicopter_WP2W", "test_Helicopter_WP1W", "test_Helicopter_EgressW", "SAFE", "BLUE", 50, "UH60", WSpawnedHelicopterGroup, 2, "SoldierWPilot", "test_squad_WP1W", "test_squad_WP2W", "test_squad_objW", "COMBAT", "RED", WSpawnedSquadGroup, 0.5, 12, "OfficerW", "SoldierWB", "SoldierWB", "SoldierWB", "SoldierWB", "SoldierWMG", "SoldierWMG", "SoldierWG", "SoldierWG", "SoldierWLAW", "SoldierWLAW", "SoldierWMedic"] exec "spawnAirCavSquad.sqs" ; Tip: with a parameter list this long, you may find it helpfull to break it up a little while constructing it, ; then put it all together to use it. Like this: ; [ ; "test_spawnW", ; "test_Helicopter_WP1W", "test_Helicopter_WP2W", "test_Helicopter_unloadW", "test_Helicopter_WP2W", "test_Helicopter_WP1W", "test_Helicopter_EgressW", ; "SAFE", "BLUE", "UH60", WSpawnedHelicopterGroup, 2, "SoldierWPilot", ; "test_squad_WP1W", "test_squad_WP2W", "test_squad_objW", ; "COMBAT", "RED", WSpawnedSquadGroup, 0.5, 12, ; "OfficerW", "SoldierWB", "SoldierWB", "SoldierWB", "SoldierWB", "SoldierWMG", "SoldierWMG", "SoldierWG", "SoldierWG", "SoldierWLAW", "SoldierWLAW", "SoldierWMedic" ; ] exec "spawnAirCavSquad.sqs" ; More information on accepted parameters ; "mySpawnMarkersName" ; The name of the marker in quotes from step 1 above. ; "helicopterWP1", "helicopterWP2", "Drop Zone", "helicopterWP4", "helicopterWP5", "helicopterEgressWP" ; The names of the markers (in quotes) used to set the helicopter's flight path from step 2 above. ; example: ; "Helicopter_WP1", "Helicopter_WP2", "Helicopter_unloadWP", "Helicopter_WP4", "Helicopter_WP5", "Helicopter_EgressWP" ; If you want fewer than 6 waypoints, try this: ; "Helicopter_unloadWP", "Helicopter_unloadWP", "Helicopter_unloadWP", "Helicopter_EgressWP", "Helicopter_EgressWP", "Helicopter_EgressWP" ; Basically, if you don't want say, waypoint 2, put the name of waypoint 3 there as well. ; You can also reuse markers. Below, I made the path taken to the egress point, the inverse of the path to the DZ, ; just by reusing the markers ; "Helicopter_WP1", "Helicopter_WP2", "Helicopter_unloadWP", "Helicopter_WP2", "Helicopter_WP1W", "mySpawnMarkersName" ; "helicopterBehavior" ; Valid Behaviors ; "SAFE" "AWARE" "COMBAT" "CARELESS" "STEALTH" ; "helicopterCombatMode" ; Valid Combat Modes ; "BLUE" =Never Fire ; "GREEN" =Hold Fire ; "WHITE" =Hold Fire, Engage At Will ; "YELLOW" =Open Fire (stay where you are at) ; "RED" =Open Fire, Engage At Will (seek targets but stay near leader) ; flyingHeightInMeters ; this should be an integer. 50 is generally pretty safe, higher works too, but there's more risk of AA fire if it's ; on the map. 30 seems to work well, as long as you have it avoiding towns and heavilly wooded areas. Tweak this number ; so the helicopter consistantly gets to the dz. ; "helicopterType" ; tested bis values: ; "mi17" ; "uh60" ; "uh60mg" ; MyCrewGroupName ; should be the name of the crew group from step 3 above ; numberOfCrew ; this will be 2 on most helicopters ; If it's an addon that only has a pilot, use 1. if there's for some reason a pilot, gunner, and commander, use 3 ; "crewType" ; The type of pilot you want in the helicopter tested bis values: ; "SoldierWPilot" ; "SoldierEPilot" ; "squadWP1", "squadWP2", "squadObjectiveWP" ; The names of the markers (in quotes) used to set the squad's path from step 4 above. ; example: ; "Squad_WP1", "Squad_WP2", "Squad_Objective" ; If you want fewer than 3 waypoints, try this: ; "Squad_Objective", "Squad_Objective", "Squad_Objective" ; Basically, if you don't want say, waypoint 2, put the name of waypoint 3 there as well. ; You can also reuse markers. ; "Squad_WP1", "Squad_Objective", "Squad_WP1" ; "squadBehavior" ; Valid Behaviors ; "SAFE" "AWARE" "COMBAT" "CARELESS" "STEALTH" ; "squadCombatMode" ; Valid Combat Modes ; "BLUE" =Never Fire ; "GREEN" =Hold Fire ; "WHITE" =Hold Fire, Engage At Will ; "YELLOW" =Open Fire (stay where you are at) ; "RED" =Open Fire, Engage At Will (seek targets but stay near leader) ; MySquadGroupName ; should be the name of the squad group from step 5 above ; squadSkillLevel ; A decimal number between 0 and 1 indicating the squad's skill level, with 1 being elite. This sets the skill of ; the entire squad. ; numberOfSquadMates ; This must be between 1 and 12. Note, that just because you use a number, doesn't mean they will all fit in your chopper. ; the BIS MI-17 and UH-60 both hold 12 men in their cargo, but others may not. Testing is advised. ; ***"typeOfSolier"*** ; there should be between 1 and 12 of these. Specifically, the number of these should match the previous parameter ; This can be any type of infantry unit, but the tested BIS values are below. Below that are examples of usage. ; "SoldierWG" "SoldierWMedic" "SoldierWCrew" "SoldierWPilot" "SoldierWMG" ; "SoldierWLAW" "SoldierWAT" "SoldierWAA" "SoldierWMortar" "SoldierWSniper" ; "SoldierWSaboteurPipe" "SoldierWSaboteurDay" "SoldierWMiner" "OfficerWNight" ; "SoldierWCaptive" ; "SoldierEB" "SoldierWFakeE" "SoldierEG" "SoldierEMedic" "SoldierECrew" ; "SoldierEPilot" "SoldierEMG" "SoldierELAW" "SoldierEAT" "SoldierEAA" ; "SoldierEMiner" "OfficerE" "OfficerENight" "GeneralE" "Angelina" ; "SoldierESniper" "SoldierESaboteurPipe" "SoldierEFakeW" ; "SoldierGB" "SoldierGMedic" "SoldierGCrew" "SoldierGPilot" "SoldierGG" ; "SoldierGMG" "SoldierGLAW" "SoldierGAT" "SoldierGAA" "OfficerG" ; "OfficerGNight" "SoldierGFakeE" "SoldierGFakeC" "SoldierGFakeC2" ; examples: ; 5, "OfficerW", "SoldierWLAW", "SoldierWMG", "SoldierWB", "SoldierWB" ; 2, "GeneralE", "Angelina" ; 3, "SoldierWSaboteurDay", "SoldierWSaboteurDay", "SoldierWSniper" ; BEGIN SCRIPT ; Get All Passed Data. _spawnLocation = _this select 0 _helicopterToDropZoneWaypoint1 = _this select 1 _helicopterToDropZoneWaypoint2 = _this select 2 _dropZone = _this select 3 _helicopterToEgressWaypoint1 = _this select 4 _helicopterToEgressWaypoint2 = _this select 5 _helicopterEgress = _this select 6 _helicopterBehavior = _this select 7 _helicopterCombatMode = _this select 8 _helicopterAltitude = _this select 9 _helicopterType = _this select 10 _crewGroup = _this select 11 _numCrew = _this select 12 _crewType = _this select 13 _squadWaypoint1 = _this select 14 _squadWaypoint2 = _this select 15 _squadObjective = _this select 16 _squadBehavior = _this select 17 _squadCombatMode = _this select 18 _squadGroup = _this select 19 _squadSkill = _this select 20 _numberOfSquadMates = _this select 21 ; initialize variables. _currSelection = 22 _crewSpawnPos = [(getmarkerpos _spawnLocation select 0) + 2, (getmarkerpos _spawnLocation select 1) + 2,(getmarkerpos _spawnLocation select 2)] _squadSpawnPos = [(getmarkerpos _spawnLocation select 0) - 2, (getmarkerpos _spawnLocation select 1) - 2,(getmarkerpos _spawnLocation select 2)] ; this is used to set the ranks of the soilders below. ; I honestly have no Idea why I did this :-D _ranks = ["SERGEANT", "CORPORAL", "CORPORAL", "PRIVATE", "PRIVATE", "PRIVATE", "PRIVATE", "PRIVATE", "PRIVATE", "PRIVATE", "PRIVATE", "PRIVATE"] ; Spawn the helicopter. _helicopter = _helicopterType createVehicle getmarkerpos _spawnLocation ; Spawn the helicopter's crew, displays a warning if the number supplied is invalid. _counter = 0 #crewCreate ? _counter == 0 : _crewType createunit [_crewSpawnPos, _crewGroup, "", 1, "CORPORAL"] ? _counter == 0 : (units _crewGroup select 0) setDammage 1 ? _counter == 0 : [(units _crewGroup select 0)] join GrpNull ? _counter == 1 : _crewType createunit [_crewSpawnPos, _crewGroup, "", 1, "SERGEANT"] ? _counter == 2 : _crewType createunit [_crewSpawnPos, _crewGroup, "", 1, "LIEUTNANT"] ? _counter > 2 : hintC "spawnAirCavSquad.sqs param 11, numCrew invalid. Valid Range is 1 to 3" _counter = _counter + 1 ?_counter != _numCrew : goto "crewCreate" ; Spawn the squad. ? (_numberOfSquadMates < 1) OR (_numberOfSquadMates > 12) : hintC "spawnAirCavSquad.sqs param 20, numberOfSquadMates invalid. Valid Range is 1 to 12"; exit _spawnCounter = 0 #startSquadSpawn _typeOfSquadMate = _this select _currSelection _typeOfSquadMate createunit [_squadSpawnPos, _squadGroup, "this allowFleeing 0", _squadSkill, (_ranks select _spawnCounter)] ; if this is the first unit spawned, replace the group place holder unit ? _spawnCounter == 0 : (units _squadGroup select 0) setDammage 1 ? _spawnCounter == 0 : [(units _squadGroup select 0)] join GrpNull ? _spawnCounter == 0 : [(units _squadGroup select 0)] join _squadGroup _currSelection = _currSelection + 1 _spawnCounter = _spawnCounter + 1 ? (_spawnCounter < _numberOfSquadMates) : goto "startSquadSpawn" ~1 ; Move the crew into their positions. _counter = 0 #crewAssign ; _crewType createUnit [(getmarkerpos _spawnLocation), _crewGroup, "", 1, "PRIVATE"] ? _counter == 0 : (units _crewGroup select 0) MoveInDriver _helicopter ? _counter == 1 : (units _crewGroup select 1) MoveInGunner _helicopter ? _counter == 2 : (units _crewGroup select 2) MoveInCommander _helicopter (units _crewGroup select _counter) SetCombatMode _helicopterCombatMode (units _crewGroup select _counter) SetBehaviour _helicopterBehavior _counter = _counter + 1 ?_counter != _numCrew : goto "crewAssign" ; Assign the squad members to an array _squad = units _squadGroup ; count the squad members _numberOfSquadMembers = count _squad ; Move the squad into the helicopter's cargo _counter = 0 #squadAssign (_squad select _counter) moveInCargo _helicopter (_squad select _counter) SetCombatMode _squadCombatMode (_squad select _counter) SetBehaviour _squadBehavior _counter = _counter + 1 ?_counter != _numberOfSquadMembers : goto "squadAssign" ; start part 2 or the script (squad control) running [_squadGroup, _squadWaypoint1, _squadWaypoint2, _squadObjective] exec "spawnAirCavSquadPart2.sqs" ; Wait for the Helicopter to reach WP 1 _atWP = false #waitForHelicopterToReachDropZoneWP1 ; Make the helicopter move to the unload WP _helicopter commandMove getMarkerPos _helicopterToDropZoneWaypoint1 ; Make the helicopter fly at the specified altitude _helicopter flyinheight _helicopterAltitude ; simply the pythagorean theorem _distanceA = (getpos _helicopter select 0) - (getMarkerPos _helicopterToDropZoneWaypoint1 select 0) _distanceB = (getpos _helicopter select 1) - (getMarkerPos _helicopterToDropZoneWaypoint1 select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? (_distanceC <= 200) OR (!(canMove _helicopter)): _atWP = true ~1 ? !_atWP : goto "waitForHelicopterToReachDropZoneWP1" ; Wait for the Helicopter to reach WP 2 _atWP = false #waitForHelicopterToReachDropZoneWP2 ; Make the helicopter move to the unload WP _helicopter commandMove getMarkerPos _helicopterToDropZoneWaypoint2 ; Make the helicopter fly at the specified altitude _helicopter flyinheight _helicopterAltitude ; simply the pythagorean theorem _distanceA = (getpos _helicopter select 0) - (getMarkerPos _helicopterToDropZoneWaypoint2 select 0) _distanceB = (getpos _helicopter select 1) - (getMarkerPos _helicopterToDropZoneWaypoint2 select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? (_distanceC <= 200) OR (!(canMove _helicopter)): _atWP = true ~1 ? !_atWP : goto "waitForHelicopterToReachDropZoneWP2" ; Wait for the Helicopter to reach the DZ _atWP = false #waitForHelicopterToReachDropZone ; Make the helicopter move to the unload WP _helicopter commandMove getMarkerPos _dropZone ; Make the helicopter fly at the specified altitude _helicopter flyinheight _helicopterAltitude ; simply the pythagorean theorem _distanceA = (getpos _helicopter select 0) - (getMarkerPos _dropZone select 0) _distanceB = (getpos _helicopter select 1) - (getMarkerPos _dropZone select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? (_distanceC <= 100) OR (!(canMove _helicopter)): _atWP = true ~1 ? !_atWP : goto "waitForHelicopterToReachDropZone" ; ; ; HELICOPTER UNLOAD ROUTINE ; Modified "HeliDrop by ColonelSandersLite Version 2.0" ; ; ; initialize variables. _leader = leader _squadGroup _grounded = false _landed = false ; This loop waits until the helicopter is about to land (a couple of meters off the ground) ; then forces the to helicopter finish landing quickly and efficently, #groundedCheckLoop _xVelocity = (velocity _helicopter select 0) * 0.875 _yVelocity = (velocity _helicopter select 1) * 0.875 _zVelocity = (velocity _helicopter select 2) _helicopter setVelocity [_xVelocity, _yVelocity, _zVelocity] _helicopter flyinheight 0 ~0.5 ? (GetPos _helicopter select 2) <= 3 : _grounded = true ? !_grounded : goto "groundedCheckLoop" ; This loop checks that the helicopter is landed and wont let the script progress till it does. #landedCheckLoop ~0.5 ? (GetPos _helicopter select 2) <=1 : _landed = true; ? !_landed : goto "landedCheckLoop" ; This unloads everyone, even players, quickly. ; reset getOutLoop counter _tmp = 0 ; count the living squad mates _num = "alive _x" count _squad #getOutLoop ? (((_squad select _tmp) in _helicopter) AND (alive (_squad select _tmp))) : unassignVehicle (_squad select _tmp); (_squad select _tmp) action ["eject", _helicopter] ~.85 _tmp = _tmp + 1 ? _tmp < _num : goto "getOutLoop" ; make double sure that everyone is out by running the getOutLoop Again without the delay between members ; reset getOutLoop2 counter _tmp = 0 ; count the living squad mates _num = "alive _x" count _squad #getOutLoop2 ? (((_squad select _tmp) in _helicopter) AND (alive (_squad select _tmp))) : unassignVehicle (_squad select _tmp); (_squad select _tmp) action ["eject", _helicopter] _tmp = _tmp + 1 ? _tmp < _num : goto "getOutLoop2" ; ; ; END OF HELICOPTER UNLOAD ROUTINE ; ; ; Wait for the Helicopter to reach WP 4 _atWP = false #waitForHelicopterToReachEgressWP1 ; Make the helicopter move to the Egress WP _helicopter commandMove getMarkerPos _helicopterToEgressWaypoint1 ; Make the helicopter fly at the specified altitude _helicopter flyinheight _helicopterAltitude ; simply the pythagorean theorem _distanceA = (getpos _helicopter select 0) - (getMarkerPos _helicopterToEgressWaypoint1 select 0) _distanceB = (getpos _helicopter select 1) - (getMarkerPos _helicopterToEgressWaypoint1 select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? (_distanceC <= 200) OR (!(canMove _helicopter)): _atWP = true ~1 ? !_atWP : goto "waitForHelicopterToReachEgressWP1" ; Wait for the Helicopter to reach WP 5 _atWP = false #waitForHelicopterToReachEgressWP2 ; Make the helicopter move to the Egress WP _helicopter commandMove getMarkerPos _helicopterToEgressWaypoint2 ; Make the helicopter fly at the specified altitude _helicopter flyinheight _helicopterAltitude ; simply the pythagorean theorem _distanceA = (getpos _helicopter select 0) - (getMarkerPos _helicopterToEgressWaypoint2 select 0) _distanceB = (getpos _helicopter select 1) - (getMarkerPos _helicopterToEgressWaypoint2 select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? (_distanceC <= 200) OR (!(canMove _helicopter)): _atWP = true ~1 ? !_atWP : goto "waitForHelicopterToReachEgressWP2" ; Wait for the Helicopter to reach the Egress Point _atWP = false #waitForHelicopterToReachEgress ; Make the helicopter move to the Egress WP _helicopter commandMove getMarkerPos _helicopterEgress ; Make the helicopter fly at the specified altitude _helicopter flyinheight _helicopterAltitude ; simply the pythagorean theorem _distanceA = (getpos _helicopter select 0) - (getMarkerPos _helicopterEgress select 0) _distanceB = (getpos _helicopter select 1) - (getMarkerPos _helicopterEgress select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? (_distanceC <= 300) OR (!(canMove _helicopter)): _atWP = true ~1 ? !_atWP : goto "waitForHelicopterToReachEgress" ; if the helicopter got shot down, leave it's wreckage alone ? (!(canMove _helicopter)) : exit ; otherwise, delete the helicopter and crew so it stops taking up resources "deleteVehicle _x" forEach (units _crewGroup) deleteVehicle _helicopter spawnAirCavSquadPart2.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Spawn Air Cav Squad Part 2 (squad controller) By ColonelSandersLite V1.0 ; This script simply requires the successfull execution of it's parent script, as it takes all the information ; it needs from that. ; Begin Script ; Get All Passed Data _squadGroup = _this select 0 _squadWaypoint1 = _this select 1 _squadWaypoint2 = _this select 2 _squadObjective = _this select 3 ; Initialize Variables _squad = units _squadGroup ; Small Delay, to allow the squad to get in the vehicle ~10 ; Wait for the squad to disembark the vehicle #checkInHelicopterLoop1 ~2 _stillIn = false _tmp = 0 _num = "alive _x" count _squad #checkInHelicopterLoop2 ? ((vehicle (_squad select _tmp) != (_squad select _tmp)) AND (alive (_squad select _tmp))) : _stillIn = true _tmp = _tmp + 1 ? _tmp < _num : goto "checkInHelicopterLoop2" ? _stillIn : goto "checkInHelicopterLoop1" ; Wait for the squad to reach WP 1 _atWP = false #waitForSquadToReachWaypoint1 ; Make the squad move to the unload WP _squad commandMove getMarkerPos _squadWaypoint1 ; simply the pythagorean theorem _distanceA = (getpos (leader _squadGroup) select 0) - (getMarkerPos _squadWaypoint1 select 0) _distanceB = (getpos (leader _squadGroup) select 1) - (getMarkerPos _squadWaypoint1 select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? (_distanceC <= 50): _atWP = true ~1 ? !_atWP : goto "waitForSquadToReachWaypoint1" ; Wait for the squad to reach WP 2 _atWP = false #waitForSquadToReachWaypoint2 ; Make the squad move to the unload WP _squad commandMove getMarkerPos _squadWaypoint2 ; simply the pythagorean theorem _distanceA = (getpos (leader _squadGroup) select 0) - (getMarkerPos _squadWaypoint2 select 0) _distanceB = (getpos (leader _squadGroup) select 1) - (getMarkerPos _squadWaypoint2 select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? (_distanceC <= 50): _atWP = true ~1 ? !_atWP : goto "waitForSquadToReachWaypoint2" ; Wait for the squad to reach the Objective _atWP = false #waitForSquadToReachObjective ; Make the squad move to the unload WP _squad commandMove getMarkerPos _squadObjective ; simply the pythagorean theorem _distanceA = (getpos (leader _squadGroup) select 0) - (getMarkerPos _squadObjective select 0) _distanceB = (getpos (leader _squadGroup) select 1) - (getMarkerPos _squadObjective select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? (_distanceC <= 50): _atWP = true ~1 ? !_atWP : goto "waitForSquadToReachObjective" Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 29, 2006 Spawn Air Cavalry Squad Sample Mission (didn't fit on the other post) Everon Mission: mission.sqm <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">version=11; class Mission { randomSeed=16418819; class Intel { resistanceEast=1.000000; startWeather=0.375188; forecastWeather=0.124562; forecastFog=0.181341; }; class Groups { items=18; class Item0 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={1119.549316,89.372643,11493.719727}; id=0; side="WEST"; vehicle="SoldierWB"; leader=1; rank="COLONEL"; skill=0.600000; init="WSpawnedHelicopterGroup = group this;"; }; }; }; class Item1 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={1129.315430,89.853889,11494.052734}; id=1; side="WEST"; vehicle="SoldierWB"; leader=1; rank="COLONEL"; skill=0.600000; init="WSpawnedSquadGroup = group this;"; }; }; }; class Item2 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={10980.062500,24.525000,11671.916016}; id=2; side="EAST"; vehicle="SoldierEB"; leader=1; rank="COLONEL"; skill=0.600000; init="ESpawnedHelicopterGroup = group this;"; }; }; }; class Item3 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={10989.828125,24.525000,11672.250000}; id=3; side="EAST"; vehicle="SoldierEB"; leader=1; rank="COLONEL"; skill=0.600000; init="ESpawnedSquadGroup = group this;"; }; }; }; class Item4 { side="GUER"; class Vehicles { items=1; class Item0 { position[]={5783.401855,209.587021,7172.701172}; azimut=176.114319; id=4; side="GUER"; vehicle="OfficerG"; leader=1; rank="CAPTAIN"; skill=0.600000; init="this addRating 999999"; }; }; }; class Item5 { side="GUER"; class Vehicles { items=1; class Item0 { position[]={6109.266113,180.629318,6994.648926}; azimut=85.831902; id=5; side="GUER"; vehicle="OfficerG"; leader=1; rank="CAPTAIN"; skill=0.600000; }; }; }; class Item6 { side="EAST"; class Vehicles { items=8; class Item0 { position[]={5766.762207,192.599991,7069.457520}; id=6; side="EAST"; vehicle="OfficerE"; leader=1; rank="SERGEANT"; skill=0.466667; }; class Item1 { position[]={5769.762207,192.599991,7064.457520}; id=7; side="EAST"; vehicle="SoldierEMG"; rank="CORPORAL"; skill=0.333333; }; class Item2 { position[]={5773.762207,192.599991,7064.457520}; id=8; side="EAST"; vehicle="SoldierEB"; rank="CORPORAL"; skill=0.333333; }; class Item3 { position[]={5775.762207,192.599991,7064.457520}; id=9; side="EAST"; vehicle="SoldierELAW"; rank="CORPORAL"; skill=0.333333; }; class Item4 { position[]={5777.762207,192.599991,7064.457520}; id=10; side="EAST"; vehicle="SoldierEMG"; skill=0.200000; }; class Item5 { position[]={5779.762207,192.599991,7064.457520}; id=11; side="EAST"; vehicle="SoldierEB"; skill=0.200000; }; class Item6 { position[]={5781.762207,192.599991,7064.457520}; id=12; side="EAST"; vehicle="SoldierEB"; skill=0.200000; }; class Item7 { position[]={5783.762207,192.599991,7064.457520}; id=13; side="EAST"; vehicle="SoldierEB"; skill=0.200000; }; }; class Waypoints { items=1; class Item0 { position[]={5795.299805,192.599991,7058.257324}; combatMode="RED"; combat="COMBAT"; class Effects { }; showWP="NEVER"; }; }; }; class Item7 { side="GUER"; class Vehicles { items=1; class Item0 { position[]={1983.055542,94.367073,5853.803711}; azimut=361.368011; id=14; side="GUER"; vehicle="SoldierGMG"; player="PLAYER COMMANDER"; leader=1; rank="CAPTAIN"; skill=0.600000; init="this addRating 999999"; }; }; }; class Item8 { side="GUER"; class Vehicles { items=1; class Item0 { position[]={2841.491943,56.725964,6520.560059}; azimut=361.368011; id=15; side="GUER"; vehicle="OfficerG"; leader=1; rank="CAPTAIN"; skill=0.600000; init="this addRating 999999"; }; }; }; class Item9 { side="GUER"; class Vehicles { items=1; class Item0 { position[]={2289.759521,54.932335,6147.504883}; azimut=361.368103; id=16; side="GUER"; vehicle="OfficerG"; leader=1; rank="CAPTAIN"; skill=0.600000; init="this addRating 999999"; }; }; }; class Item10 { side="GUER"; class Vehicles { items=1; class Item0 { position[]={1381.602173,66.286064,5794.331543}; azimut=361.368103; id=17; side="GUER"; vehicle="OfficerG"; leader=1; rank="CAPTAIN"; skill=0.600000; init="this addRating 999999"; }; }; }; class Item11 { side="GUER"; class Vehicles { items=1; class Item0 { position[]={5992.306641,171.262161,6845.432617}; azimut=202.139999; id=18; side="GUER"; vehicle="OfficerG"; leader=1; rank="CAPTAIN"; skill=0.600000; init="this addRating 999999"; }; }; }; class Item12 { side="GUER"; class Vehicles { items=1; class Item0 { position[]={7255.087402,30.374998,6812.846680}; azimut=180.000000; id=19; side="GUER"; vehicle="OfficerG"; leader=1; rank="CAPTAIN"; skill=0.600000; init="this addRating 999999"; }; }; }; class Item13 { side="GUER"; class Vehicles { items=1; class Item0 { position[]={6111.722656,79.848808,5709.332031}; azimut=361.368103; id=20; side="GUER"; vehicle="OfficerG"; leader=1; rank="CAPTAIN"; skill=0.600000; init="this addRating 999999"; }; }; }; class Item14 { side="GUER"; class Vehicles { items=1; class Item0 { position[]={7148.194336,107.419113,6016.909180}; azimut=361.368103; id=21; side="GUER"; vehicle="OfficerG"; leader=1; rank="CAPTAIN"; skill=0.600000; init="this addRating 999999"; }; }; }; class Item15 { side="WEST"; class Vehicles { items=6; class Item0 { position[]={1125.699829,89.146461,11512.784180}; azimut=202.139999; id=22; side="WEST"; vehicle="OfficerW"; leader=1; rank="CAPTAIN"; skill=0.600000; }; class Item1 { position[]={1122.067993,87.157654,11532.801758}; azimut=202.139999; id=23; side="WEST"; vehicle="SoldierWB"; rank="CAPTAIN"; skill=0.600000; }; class Item2 { position[]={1113.989380,86.821594,11536.096680}; azimut=202.139999; id=24; side="WEST"; vehicle="SoldierWMedic"; rank="CAPTAIN"; skill=0.600000; }; class Item3 { position[]={1136.957153,87.773209,11522.379883}; azimut=202.139999; id=25; side="WEST"; vehicle="SoldierWLAW"; rank="CAPTAIN"; skill=0.600000; }; class Item4 { position[]={1131.002075,87.354286,11528.334961}; azimut=202.139999; id=26; side="WEST"; vehicle="SoldierWMG"; rank="CAPTAIN"; skill=0.600000; }; class Item5 { position[]={1147.378052,87.584457,11516.422852}; azimut=202.139999; id=27; side="WEST"; vehicle="SoldierWG"; rank="CAPTAIN"; skill=0.600000; }; }; }; class Item16 { side="EAST"; class Vehicles { items=6; class Item0 { position[]={11345.925781,67.777779,11165.355469}; azimut=202.139999; id=28; side="EAST"; vehicle="OfficerE"; leader=1; rank="CAPTAIN"; skill=0.600000; }; class Item1 { position[]={11351.780273,68.030540,11177.066406}; azimut=202.139999; id=29; side="EAST"; vehicle="SoldierELAW"; rank="CAPTAIN"; skill=0.600000; }; class Item2 { position[]={11347.095703,68.146431,11178.238281}; azimut=202.139999; id=30; side="EAST"; vehicle="SoldierEB"; rank="CAPTAIN"; skill=0.600000; }; class Item3 { position[]={11358.807617,67.688255,11174.724609}; azimut=202.139999; id=31; side="EAST"; vehicle="SoldierEMedic"; rank="CAPTAIN"; skill=0.600000; }; class Item4 { position[]={11364.664063,67.321465,11172.382813}; azimut=202.139999; id=32; side="EAST"; vehicle="SoldierEMG"; rank="CAPTAIN"; skill=0.600000; }; class Item5 { position[]={11340.069336,68.234306,11182.921875}; azimut=202.139999; id=33; side="EAST"; vehicle="SoldierEG"; rank="CAPTAIN"; skill=0.600000; }; }; }; class Item17 { side="WEST"; class Vehicles { items=8; class Item0 { position[]={1253.231323,65.474998,5937.431152}; azimut=103.245705; id=36; side="WEST"; vehicle="OfficerW"; leader=1; rank="SERGEANT"; skill=0.466667; }; class Item1 { position[]={1247.676392,65.474998,5935.658691}; azimut=103.245705; id=37; side="WEST"; vehicle="SoldierWMG"; rank="CORPORAL"; skill=0.333333; }; class Item2 { position[]={1246.760010,65.474998,5931.765137}; azimut=103.245705; id=38; side="WEST"; vehicle="SoldierWB"; rank="CORPORAL"; skill=0.333333; }; class Item3 { position[]={1246.301636,65.474998,5929.818848}; azimut=103.245705; id=39; side="WEST"; vehicle="SoldierWLAW"; rank="CORPORAL"; skill=0.333333; }; class Item4 { position[]={1245.843506,65.474998,5927.870605}; azimut=103.245705; id=40; side="WEST"; vehicle="SoldierWMG"; skill=0.200000; }; class Item5 { position[]={1245.385376,65.474998,5925.925781}; azimut=103.245705; id=41; side="WEST"; vehicle="SoldierWB"; skill=0.200000; }; class Item6 { position[]={1244.925903,65.474998,5923.978516}; azimut=103.245705; id=42; side="WEST"; vehicle="SoldierWB"; skill=0.200000; }; class Item7 { position[]={1244.468628,65.474998,5922.029785}; azimut=103.245705; id=43; side="WEST"; vehicle="SoldierWB"; skill=0.200000; }; }; class Waypoints { items=1; class Item0 { position[]={1256.469604,65.474998,5936.043945}; combatMode="RED"; combat="COMBAT"; class Effects { }; showWP="NEVER"; }; }; }; }; class Vehicles { items=2; class Item0 { position[]={1142.448242,88.686890,11510.592773}; azimut=202.139999; id=34; side="EMPTY"; vehicle="UH60"; leader=1; skill=0.600000; }; class Item1 { position[]={11356.464844,67.115829,11155.986328}; azimut=202.139999; id=35; side="EMPTY"; vehicle="Mi17"; leader=1; skill=0.600000; }; }; class Markers { items=17; class Item0 { position[]={7254.357422,30.374998,6780.349121}; name="test_spawnW"; type="Empty"; }; class Item1 { position[]={5934.949219,145.203903,6774.500977}; name="test_Helicopter_unloadW"; type="Empty"; }; class Item2 { position[]={874.660522,30.056107,11576.781250}; name="asdf"; text="West Spawn Placeholders"; type="Flag1"; colorName="ColorGreen"; a=5.000000; b=5.000000; }; class Item3 { position[]={9750.765625,1.520651,11682.756836}; name="asdf_1"; text="East Spawn Placeholders"; type="Flag1"; a=4.000000; b=4.000000; }; class Item4 { position[]={5711.053223,192.599991,7013.139648}; name="test_squad_objW"; type="Empty"; }; class Item5 { position[]={7632.731934,1.123185,6035.977539}; name="test_Helicopter_WP1W"; type="Empty"; }; class Item6 { position[]={6065.986816,80.890228,5709.682129}; name="test_Helicopter_WP2W"; type="Empty"; }; class Item7 { position[]={5612.493652,190.509277,7101.413574}; name="test_squad_WP1W"; type="Empty"; }; class Item8 { position[]={5859.584473,195.683121,7060.907227}; name="test_squad_WP2W"; type="Empty"; }; class Item9 { position[]={12173.556641,1.495118,7490.098145}; name="test_Helicopter_EgressW"; type="Empty"; }; class Item10 { position[]={2825.597656,52.479809,6574.384766}; name="test_spawnE"; type="Empty"; }; class Item11 { position[]={1969.741089,84.719421,5891.445801}; name="test_Helicopter_unloadE"; type="Empty"; }; class Item12 { position[]={1363.255493,64.675697,6017.247070}; name="test_squad_objE"; type="Empty"; }; class Item13 { position[]={2069.232422,15.003857,6191.290527}; name="test_Helicopter_WP1E"; type="Empty"; }; class Item14 { position[]={1732.382935,84.302956,5758.474121}; name="test_squad_WP1E"; type="Empty"; }; class Item15 { position[]={1177.383911,63.225281,5917.443359}; name="test_squad_WP2E"; type="Empty"; }; class Item16 { position[]={352.533478,1.165492,10048.445313}; name="test_Helicopter_EgressE"; type="Empty"; }; }; class Sensors { items=3; class Item0 { position[]={7326.251465,16.505604,6835.940430}; a=0.000000; b=0.000000; activationBy="ALPHA"; age="UNKNOWN"; text="Spawn West"; expActiv="[""test_spawnW"", ""test_Helicopter_WP1W"", ""test_Helicopter_WP2W"", ""test_Helicopter_unloadW"", ""test_Helicopter_WP2W"", ""test_Helicopter_WP1W"", ""test_Helicopter_EgressW"", ""SAFE"", ""BLUE"", 50, ""uh60"", WSpawnedHelicopterGroup, 2, ""SoldierWPilot"", ""test_squad_WP1W"", ""test_squad_WP2W"", ""test_squad_objW"", ""COMBAT"", ""RED"", WSpawnedSquadGroup, 0.5, 12, ""OfficerW"", ""SoldierWB"", ""SoldierWB"", ""SoldierWB"", ""SoldierWB"", ""SoldierWMG"", ""SoldierWMG"", ""SoldierWG"", ""SoldierWG"", ""SoldierWLAW"", ""SoldierWLAW"", ""SoldierWMedic""] exec ""spawnAirCavSquad.sqs"""; class Effects { }; }; class Item1 { position[]={2850.465332,54.330700,6574.644043}; a=0.000000; b=0.000000; activationBy="BRAVO"; age="UNKNOWN"; text="Spawn East"; expActiv="[""test_spawnE"", ""test_Helicopter_WP1E"", ""test_Helicopter_WP1E"", ""test_Helicopter_unloadE"", ""test_Helicopter_EgressE"", ""test_Helicopter_EgressE"", ""test_Helicopter_EgressE"", ""SAFE"", ""BLUE"", 50, ""mi17"", ESpawnedHelicopterGroup, 2, ""SoldierEPilot"", ""test_squad_WP1E"", ""test_squad_WP2E"", ""test_squad_objE"", ""COMBAT"", ""RED"", ESpawnedSquadGroup, 0.5, 12, ""OfficerE"", ""SoldierEB"", ""SoldierEB"", ""SoldierEB"", ""SoldierEB"", ""SoldierEMG"", ""SoldierEMG"", ""SoldierEG"", ""SoldierEG"", ""SoldierELAW"", ""SoldierELAW"", ""SoldierEMedic""] exec ""spawnAirCavSquad.sqs"""; class Effects { }; }; class Item2 { position[]={1990.128418,89.932732,5870.414063}; a=4500.000000; b=1.000000; angle=68.588943; rectangular=1; age="UNKNOWN"; class Effects { }; }; }; }; class Intro { randomSeed=14504963; class Intel { }; }; class OutroWin { randomSeed=1281539; class Intel { }; }; class OutroLoose { randomSeed=4226563; class Intel { }; }; Share this post Link to post Share on other sites
Guest Posted May 2, 2006 good stuff, thanks for those helo scripts ColonelSandersLite Share this post Link to post Share on other sites
hero42 0 Posted August 12, 2006 I'm making a mission where you can control five groups of soldiers with the handsignal, can anyone help me! Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted August 18, 2007 I'm making a mission where you can control five groups of soldiers with the handsignal, can anyone help me! I'm sorry man, I've long since moved on to arma. It was pure chance that I stumbled onto this at all. All I can offer you is what I've since termed my original recipe bucket of scripts, which contains all my publicly released ofp scripts. Many have demo missions if I recall. You can find it on my site under misc if that interests you. Share this post Link to post Share on other sites