ColonelSandersLite 0 Posted April 11, 2006 With ofpec down, I thought I might post these for anyone who may have problems with vehicle embarking/disembarking involving a player and WP synchronisation. Most of the experienced editors will probably have written their own versions already (or gotten one off of ofpec). Still, I thought I'd post these for anyone who's not very experienced, or just doesn't have something similar. Anyways, Looking through these forums, this seems like it's actually one of the few worthwhile communities on the internet. There's no real trolling or flaming to speak of, and this community seems to be full of helpfull people. So, I think I'll start taking an active part. I'll be posting assorted scripts that I write, and maybe start putting out missions for the public if you guys would give me some good leads on where they should be hosted. Anyways, without further ado, here's the promissed scripts. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Vehicle Unload by ColonelSandersLite Version 1.0 ; Requirements: ; ; The Transporting vehicle is assumed to be a truck/apc/whatever, but helicopters wont work ; The squad needs to have a group name. This can be acheived by putting the following in the ; init feild of the squad leader: myGroupName = group this; ; The Transporting vehicle must have a name ; The squad must be in the vehicle before getting out of the vehicle;) ; Usage (who controls the squad doesn't matter at all): ; ; make a move waypoint (NOT A TRANSPORT UNLOAD) for your vehicle where you want ; the squad to disembark from and put the following in the on activation box. ; ; [myVehicleName, (leader MyGroupName), delayInSeconds] exec "vehunload.sqs" ; Example : [testVeh1, (leader testGroup1), 20] exec "vehunload.sqs" ; ; DelayInSeconds is the time the truck will wait to leave after everyone is out. ; Reccomended value is 15-30 seconds, but testing is reccomended. This is here, so the ; squad is clear of the vehicle before it drives off, in order to prevent ; ai driver wonkieness. It can be set to 0 if you don't care to have it. ; ; The squad does not need a get out waypoint, just a normal waypoint to their destination ; after the truck has unloaded them. ; BEGIN SCRIPT ; Get All Passed Data. _veh = _this select 0 _leader = _this select 1 _delay = _this select 2 ; initialize variables. _stopped = false _squad = units group _leader ; Stop the vehicle from trying to go to the next WP. _veh LockWP true ; Stop the vehicle. _veh action ["Engine Off"] ; This loop checks that the vehicle is stopped and wont let the script progress till it does. #stoppedCheckLoop ? (velocity _veh select 0 == 0) AND (velocity _veh select 1 == 0) AND (velocity _veh select 2 == 0) : _stopped = true ~1 ? !_stopped : goto "stoppedCheckLoop" ; 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 _veh) AND (alive (_squad select _tmp))) : unassignVehicle (_squad select _tmp); (_squad select _tmp) action ["eject", _veh] ~.85 _tmp = _tmp + 1 ? _tmp < _num : goto "getOutLoop" ; make double sure that everyone is out by runngin 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 _veh) AND (alive (_squad select _tmp))) : unassignVehicle (_squad select _tmp); (_squad select _tmp) action ["eject", _veh] _tmp = _tmp + 1 ? _tmp < _num : goto "getOutLoop2" ; timer loop to make the vehicle wait the designated amount of time after squad disembarks. _timewaited = 0 #waitLoop ~1 _timewaited = _timewaited + 1 ? _timewaited < _delay : goto "waitLoop" ; Since everyone is out and clear, let the vehicle resume it's path. _veh LockWP false ; finished <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Vehicle Pickup by ColonelSandersLite Version 1.0 ; Requirements: ; ; The Transporting vehicle is assumed to be a truck/apc/whatever, but helicopters wont work ; The squad needs to have a group name. This can be acheived by putting the following in the ; init feild of the squad leader: myGroupName = group this; ; The Transporting vehicle must have a name ; Usage if the squad is DEFINATELY going to be PLAYER controlled: ; ; Make a move waypoint (NOT LOAD) for your vehicle where you want the vehicle to wait at and ; put the following in the on activation box: ; [myVehicleName, (leader MyGroupName)] exec "vehpickup.sqs" ; ; The vehicle will wait for the player's squad to board ; Usage if the squad may possibly be player controlled, such as in the event of casualties: ; ; Make a move waypoint (NOT LOAD) for your vehicle where you want the vehicle to wait at and ; put the following in the on activation box: ; [myVehicleName, (leader MyGroupName)] exec "vehpickup.sqs" ; ; Make a small radius (10X10) trigger where the vehicle moves to pick up the men. ; Group it to the vehicle with "vehicle present (once)" being the activation. ; The Condition Should be: ; (this AND ((velocity myVehicleName select 0 == 0) AND (velocity myVehicleName select 1 == 0) AND (velocity myVehicleName select 2 == 0))) OR (!canMove myVehicleName) ; The on activation should read: myVehicleNameIsHere = 1; ; ; Give the squad a move/seek and destroy/guard/whatever waypoint. This is what the ; squad is doing before the truck comes to pick them up. ; The condition box should read: myVehicleNameIsHere == 1; ; The on activation should read: ("_x assignAsCargo myVehicleName") forEach (units MyGroupName); ; ; Give the squad a Get In waypoint near where the vehicle is going to load the squad. ; ; Give the Vehicle a move/seek and destroy/guard/whatever waypoint for where it goes after ; the squad is aboard. ; Usage if there's no possible way for the squad to be player controlled: ; ; Don't use this script, although it WILL WORK. ; It's simpler to just use synched load and get in waypoints. ; If you insist, follow the instructions for a squad may possibly be player controlled ; BEGIN SCRIPT ; Get All Passed Data. _veh = _this select 0 _leader = _this select 1 ; initialize variables. _stopped = false _squad = units group _leader _squadGroup = group _leader _veh LockWP true _veh action ["Engine Off"] ; This loop checks that the vehicle is stopped and wont let the script progress till it does. #stoppedCheckLoop ? (velocity _veh select 0 == 0) AND (velocity _veh select 1 == 0) AND (velocity _veh select 2 == 0) : _stopped = true ~1 ? !_stopped : goto "stoppedCheckLoop" ; This loop keeps going until everyone is aboard #waitForBoardLoop ; count the living squad mates _num = "alive _x" count _squad ; reset counter for squad mates boarded _inCount = 0 ; reset testInLoop counter _tmp = 0 ; this loop counts the number of living squad mates in the vehicle and checks the whole squad #testInLoop ? (((_squad select _tmp) in _veh) AND (alive (_squad select _tmp))) : _inCount = _inCount + 1 _tmp = _tmp + 1 ? _tmp < (count _squad) : goto "testInLoop" ; small delay so the script doesn't eat too many resources ~1 ; if all living squad members are not in the truck, loop ? _inCount != _num : goto "waitForBoardLoop" ; since everyone is aboard, let the truck move out _veh LockWP false ; finished Share this post Link to post Share on other sites
Guest Posted April 11, 2006 Thanks. Copied and pasted to scripts reference document. Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 12, 2006 BTW, feedback, bug reports, feature requests, script requests, etc, are ALWAYS welcome. I'll also put together sample missions with examples on usage on request as well. Share this post Link to post Share on other sites
Guest Posted April 12, 2006 Alright, ColonelSandersLite, now that you offered ..... A very helpfull script for myself and prolly for others too that I have been hoping to find in the near future would be: A script that: spawns a bmp in a particular spot, the bmp spawns completely loaded with units, driver, gunner, commander, and cargo is loaded with units as well. Then script sends bmp to a location, unloads the troops, then moves to one last position. This would show I would think everything one would need to do basic plans for spawning units, spawning units within vehicles in all vehicle positions, moving them thru script use and loading and unloading them - of course the loading and unloading you did put down, although it would be neat to see it mixed in a script like this. This isnt a request or anything, if you feel like doin it. Thanks for the offer, didnt take long to get a response eh? lol Share this post Link to post Share on other sites
funnyguy1 0 Posted April 12, 2006 I`m looking for a: CAS script for helos (move in to player`s possition, make a mess (limited time) and fly away). Would this be possible to lase the targets for indirect strikes like in CoC arty? A helo targets the lased spot and fires missile, no matter where it`s pointed. precision strike for a10 or other aircraft (realistic altitude and speed), for both mapclicked or lased targets. evac script for helo that I could incorporate with GB`s handsignals ressuplyscript where ammo creates are dropped from a helo, not spawned over the area I want to make a mission with the GB`s handisgnals, so I need .sqs files that can be executed by this system. As you know you can`t use the ofp`s radio codes in order to call support. I posted it here because i didn`t wanted to start a new thread about it, I`m a beginner so at least tell me what can be done from my whish list . I wish i could do it myself... regards Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 13, 2006 Wow, ok, ok, slow down. I'm rewriting my old heliload and helipickups at the moment. I felt embarrassed about posting something so old that was based on someone elses work anyways. They are actually already done but I need to test them out still. I'll look over your script ideas and get on them once I'm done with these. ------------------------------------------------------ Ok the afformentioned Helicopter Scripts are finished and tested. So: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; HeliDrop by ColonelSandersLite Version 2.0 ; Requirements: ; ; The Transporting helicopter is assumed to be a helicopter ; The squad needs to have a group name. This can be acheived by putting the following in the ; init feild of the squad leader: myGroupName = group this; ; The Transporting helicopter must have a name ; The squad must be in the helicopter before getting out of the helicopter;) ; Usage (who controls the squad doesn't matter at all): ; ; Put a H or H(invisible) on the ground where the helicopter is supposed to land ; ; make a move waypoint (NOT A TRANSPORT UNLOAD) for your helicopter where you want ; the squad to disembark from and put the following in the on activation box. ; ; [myhelicopterName, (leader MyGroupName), DesiredFlyOutHeightInMeters] exec "helidrop2.sqs" ; Example : [testHeli1, (leader testGroup1), 50] exec "helidrop2.sqs" ; ; the distance between the move waypoint and H should be tweaked so the helicopter lands quickly and ; efficiently on normal time acc ; ; The squad does not need a get out waypoint, just a normal waypoint to their destination ; after the helicopter has unloaded them. ; BEGIN SCRIPT ; Get All Passed Data. _heli = _this select 0 _leader = _this select 1 _flyOutHeight = _this select 2 ; initialize variables. _grounded = false _landed = false _squad = units group _leader ; Stop the helicopter from trying to go to the next WP. _heli LockWP true ; Stop the helicopter. _heli land "GET OUT" ; 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 ~0.5 ? (GetPos _heli select 2) <= 2 : _heli flyinheight 0; _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 _heli select 2) <=.5 : _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 _heli) AND (alive (_squad select _tmp))) : unassignVehicle (_squad select _tmp); (_squad select _tmp) action ["eject", _heli] ~.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 _heli) AND (alive (_squad select _tmp))) : unassignVehicle (_squad select _tmp); (_squad select _tmp) action ["eject", _heli] _tmp = _tmp + 1 ? _tmp < _num : goto "getOutLoop2" ; Since everyone is out and clear, let the helicopter resume it's path and set the flyInHeight as passed. _heli LockWP false _heli flyinheight _flyOutHeight ; finished <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; HeliPickup by ColonelSandersLite Version 2.0 ; Requirements: ; ; The Transporting helicopter is assumed to be a helicopter, ; The squad needs to have a group name. This can be acheived by putting the following in the ; init feild of the squad leader: myGroupName = group this; ; The Transporting helicopter must have a name ; Usage if the squad is DEFINATELY going to be PLAYER controlled: ; ; Put a H or H(invisible) on the ground where the helicopter is supposed to land ; ; Make a move waypoint (NOT LOAD) for your helicopter where you want the helicopter to wait at and ; put the following in the on activation box: ; [myhelicopterName, (leader MyGroupName), DesiredFlyOutHeightInMeters] exec "helipickup2.sqs" ; ; the distance between the move waypoint and H should be tweaked so the helicopter lands quickly and ; efficiently on normal time acc ; ; The helicopter will wait for the player's squad to board ; Usage if the squad may possibly be player controlled, such as in the event of casualties: ; ; Put a H or H(invisible) on the ground where the helicopter is supposed to land ; ; Make a move waypoint (NOT LOAD) for your helicopter where you want the helicopter to wait at and ; put the following in the on activation box: ; [myhelicopterName, (leader MyGroupName), DesiredFlyOutHeightInMeters] exec "helipickup2.sqs" ; ; the distance between the move waypoint and H should be tweaked so the helicopter lands quickly and ; efficiently on normal time acc ; ; Make a medium radius (100X100) trigger where the helicopter moves to pick up the men. ; Group it to the helicopter with "vehicle present (once)" being the activation. ; The Condition Should be: ; this OR (!canMove myhelicopterName) ; The on activation should read: myhelicopterNameIsHere = 1; ; ; Give the squad a move/seek and destroy/guard/whatever waypoint. This is what the ; squad is doing before the helicopter comes to pick them up. ; The condition box should read: myhelicopterNameIsHere == 1; ; The on activation should read: ("_x assignAsCargo myhelicopterName") forEach (units MyGroupName); ; ; Give the squad a Get In waypoint near where the helicopter is going to load the squad. ; ; Give the helicopter a move/seek and destroy/guard/whatever waypoint for where it goes after ; the squad is aboard. ; Usage if there's no possible way for the squad to be player controlled: ; ; Don't use this script, although it WILL WORK. ; It's simpler to just use synched load and get in waypoints. ; If you insist, follow the instructions for a squad may possibly be player controlled ; BEGIN SCRIPT ; Get All Passed Data. _heli = _this select 0 _leader = _this select 1 _flyOutHeight = _this select 2 ; initialize variables. _grounded = false _landed = false _squad = units group _leader ; Stop the helicopter from trying to go to the next WP. _heli LockWP true ; Stop the helicopter. _heli land "GET OUT" ; 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 ~0.5 ? (GetPos _heli select 2) <= 2 : _heli flyinheight 0; _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 _heli select 2) <=.5 : _landed = true; ? !_landed : goto "landedCheckLoop" ; This loop keeps going until everyone is aboard #waitForBoardLoop ; count the living squad mates _num = "alive _x" count _squad ; reset counter for squad mates boarded _inCount = 0 ; reset testInLoop counter _tmp = 0 ; this loop counts the number of living squad mates in the helicopter and checks the whole squad #testInLoop ? (((_squad select _tmp) in _heli) AND (alive (_squad select _tmp))) : _inCount = _inCount + 1 _tmp = _tmp + 1 ? _tmp < (count _squad) : goto "testInLoop" ; small delay so the script doesn't eat too many resources ~1 ; if all living squad members are not in the helicopter, loop ? _inCount != _num : goto "waitForBoardLoop" ; Make double sure everyone is aboard ; This loop keeps going until everyone is aboard #waitForBoardLoop2 ; Wait a second to check again, also serves as a small delay so the script ; doesn't eat too many resources in the event the first check was inacurate ~1 ; count the living squad mates _num = "alive _x" count _squad ; reset counter for squad mates boarded _inCount = 0 ; reset testInLoop counter _tmp = 0 ; this loop counts the number of living squad mates in the helicopter and checks the whole squad #testInLoop2 ? (((_squad select _tmp) in _heli) AND (alive (_squad select _tmp))) : _inCount = _inCount + 1 _tmp = _tmp + 1 ? _tmp < (count _squad) : goto "testInLoop2" ; if all living squad members are not in the helicopter, loop ? _inCount != _num : goto "waitForBoardLoop2" ; Since everyone is in, let the helicopter resume it's path and set the flyInHeight as passed. _heli LockWP false _heli flyinheight _flyOutHeight ; finished Now to Start the requests. Special Ed came first, so first come first serve I guess. I really don't see a truly usefull application of a script like this, but what the heck, I'll do it anyways. I'll start it now. funnyguy1: It looks like everything you want is possible, but I have some notes and questions. Quote[/b] ]I want to make a mission with the GB`s handisgnals, so I need .sqs files that can be executed by this system. As you know you can`t use the ofp`s radio codes in order to call support. I'm not familiar with GB's handsignals, a link would be nice. I disagree about the limitations of the ofp radio codes, I have no problems rigging radio alpha or whatever to say, move a heli to a position to extract a squad. Quote[/b] ]CAS script for helos (move in to player`s possition, make a mess (limited time) and fly away). Easy. There is a snag though. It is difficult for the ofp AI to detect infantry on the ground and there's not really anything I can do about that. It would be effective against vehicles though. I suppose it would be possible to just let it know where every enemy soilder is in an area, it would be too effective then however. Maybe with some messing around, I could find a nice balance. Quote[/b] ]Would this be possible to lase the targets for indirect strikes like in CoC arty? A helo targets the lased spot and fires missile, no matter where it`s pointed. Almost certainly possible, although I've never tried it. This one'll be fun to work out. Quote[/b] ]Precision strike for a10 or other aircraft (realistic altitude and speed), for both mapclicked or lased targets. I actually did something with this a long time ago. Well, on mapclick, not I'll have to see if I still have it and revamp it so it's not another embarrasment. Quote[/b] ]evac script for helo that I could incorporate with GB`s handsignals Again, the only wild card here is the gb's hand signals. This can be done with the radio easilly, in fact the scripts above provide the means to do it. I can find out more if you link me to the hand signals however. Quote[/b] ]ressuplyscript where ammo creates are dropped from a helo, not spawned over the area Yes, this can be done. FYI though, helicopters tend to land and unload their cargo on the ground. Parachutes are mostly used for fixed wing aircraft providing resupply. Although I suppose that a script to make ANY flyer be able to do this would be good. Share this post Link to post Share on other sites
funnyguy1 0 Posted April 13, 2006 Ok, thx for the attention...I`ll post a larger comment later, now I`m just doing what I think I should do... HANDSIGNALS THREAD! edit: Firstly, you can`t use the standard radio comms along with the hs signals as far as I`m concerned... Secondly, you should contact General Barron if you want to know more about it (and certainly you should try it), If I knew how to use this kind of knowledge I would ask him myslef . Share this post Link to post Share on other sites
Guest Posted April 13, 2006 Thank you ColonelSandersLite' would be great to see that. I didnt really expect anything to materialize, so this is really great. I have some, I say some references of how to use units from spawns in CTI, but the scripting is so mixed with other checks for the cti mission its hard, very hard to pick out whats needed. A few very nice features in using spawned units and then of course sending them around to do whatever is needed- Spawned units cane be thrown in a mission at any time, where maybe in some cases this would reduce lag (like cti res spawns), reinforcement spawns would be another good example, of course done in a reasonable way, keeping the spawns far away from the battle they are reinforcing, in my particular mission the spawns would occur in a few 'primary' town bases which would send them out to battles across the map. The real big plus in using not just spawns, but also markers to move units, u can change their path plans, unlike thru the editor where once u start setting waypoints thats it, those units can only follow that waypoint system, thru using markers and script if certain events occurr within the mission the script can 're-assign' units to new plans, making a mission more versitile. So really this type of script is more directed towards larger scale missions that may either use alot of units which some of them could be spawned at appropriate times and/or missions that could use multiple plans for unit groups depending on certain criteria during the mission. Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 13, 2006 Ok Special Ed and anyone that wants it, Here's the script with a sample mission below. When editing the sample mission, be sure to turn on markers so you can see what's going on. Also, note that there are observers at various locations. These should be made playable whenever you want to see the actions. Ok, script first: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;Spawn Mechanized Infantry Squad By ColonelSandersLite V1.0 ; Usage: ; Create 4 Markers, name them so you will remember them. ; The first marker will be where your unit will spawn ; The second marker will be where your unit will unload at ; The third marker is the infantry units objective ; The fourth marker is the Vehicles Objective ; Create 2 men (ungrouped) and name their groups by putting mygroupname = group this in their init feild. ; The group names must be different. ; Create a trigger/script/whatever that calls this script. Parameter details below ; ["myVehType", "mySpawnMarker", numberOfCrewVehNeeds, "myCrewType", apcGroupName, infSquadGroupName, numberOfSoilderType1, "soilderType1", numberOfSoilderType2, "soilderType2", numberOfSoilderType3, "soilderType3", numberOfSoilderType4, "soilderType4", numberOfSoilderType5, "soilderType5", numberOfSoilderType6, "soilderType6", infantrySkillLevel, "test_apc_unloadW", "test_apc_objW", "test_squad_objW", "myAPCBehavior", "myAPCCombatMode", "myInfSquadBehavior", "myInfSquadCombatMode", timeForAPCToWaitAfterUnloadingSquad] exec "spawnMechInfSquad.sqs" ; Example: ; ["Bradley", "test_spawnW", 3, "SoldierWCrew", WSpawnedAPCGroup, WSpawnedSquadGroup, 1, "OfficerW", 1, "SoldierWG", 2, "SoldierWLAW", 1, "SoldierWMG", 1, "SoldierWB", 0, "SoldierWAT", 0.5, "test_apc_unloadW", "test_apc_objW", "test_squad_objW", "COMBAT", "RED", "COMBAT", "RED", 180] exec "spawnMechInfSquad.sqs" ; More information on accepted parameters ; "myVehType" ; Vehicle Types Sorted by Side, and type. Not all inclusive I'm sure. ; "M113" "Bradley" "M113Ambul" "Truck5t" "Truck5tOpen" ; "HMMWV" "Jeep" "JeepMG" "BoatW" ; "BMP" "BMP2" "BMPAmbul" "UAZ" "Ural" ; "UralRepair" "UralReammo" "UralRefuel" "BRDM" "Scud" ; "BoatE" ; "BMPRes" "TruckV3SG" "GJeep" "TruckV3SCivil" "TruckV3SGRefuel" ; "TruckV3SGRepair" "TruckV3SGReammo" "UAZG" "SGUAZG" "GJeep" ; "SkodaBlue" "SkodaRed" "SkodaGreen" ; "myCrewType" ; Unit Types Sorted By Side. Also not all inclusive. ; "Civilian" "Civilian2" "SoldierWB" ; "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" ; apcGroupName, infSquadGroupName ; These should be the group names of the men created earlier. As a note, those men should be put ; someplace practically inaccessable and secret, and WILL be killed by the script. ; numberOfSoilderTypeX, "soilderType1" ; These allow you to mix and match different soilder types in the squad. 2, "SoldierWLAW" puts ; 2 west LAW soilders in the squad. Note you are limited to six different unit types. ; numberOfSoilderType1 must be at least 1-12. All the others can be 0-12. The types are listed above ; infantrySkillLevel ; A decimal number between and including 0 and 1. This sets the skill level of every man in the squad ; "myAPCBehavior", "myAPCCombatMode", "myInfSquadBehavior", "myInfSquadCombatMode" ; Valid Behaviors ; "SAFE" "AWARE" "COMBAT" "CARELESS" "STEALTH" ; 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) ; timeForAPCToWaitAfterUnloadingSquad ; this is the number of seconds the apc will wait before moving out. 0 is valid, although I reccomend ; you at least give the squad time to clear out before moving so the vehicle doesn't display some of ofp's ; ai quirks. ; This is especially usefull if the vehicle is an apc that is going to support an attack by the infantry squad ; In this fashion, it can be tweaked to act similar to a bounding overwatch, or perhaps wait until the infantry ; has already made contact with the enemy before moving in. This would reduce the chance of getting slagged by ; someone with a LAW/RPG considerably since it would then have mutual support from the infantry. ; BEGIN SCRIPT ; Get All Passed Data. _vehicleType = _this select 0 _spawnLocMarker = _this select 1 _numCrew = _this select 2 _crewType = _this select 3 _crewGroup = _this select 4 _squadGroup = _this select 5 _numSquad1 = _this select 6 _typeSquad1 = _this select 7 _numSquad2 = _this select 8 _typeSquad2 = _this select 9 _numSquad3 = _this select 10 _typeSquad3 = _this select 11 _numSquad4 = _this select 12 _typeSquad4 = _this select 13 _numSquad5 = _this select 14 _typeSquad5 = _this select 15 _numSquad6 = _this select 16 _typeSquad6 = _this select 17 _squadSkill = _this select 18 _apcUnload = _this select 19 _apcObjective = _this select 20 _squadObjective = _this select 21 _apcBehavior = _this select 22 _apcCombatMode = _this select 23 _squadBehavior = _this select 24 _squadCombatMode = _this select 25 _waitTime = _this select 26 ; initialize variables. _crewSpawnPos = [(getmarkerpos _spawnLocMarker select 0) + 2, (getmarkerpos _spawnLocMarker select 1) + 2,(getmarkerpos _spawnLocMarker select 2)] _squadSpawnPos = [(getmarkerpos _spawnLocMarker select 0) - 2, (getmarkerpos _spawnLocMarker select 1) - 2,(getmarkerpos _spawnLocMarker select 2)] ; Spawn the vehicle. _apc = _vehicleType createVehicle getmarkerpos _spawnLocMarker ; Spawn the vehicle'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 "spawnMechInfSquad.sqs param 3, numCrew invalid. Valid Range is 1 to 3" _counter = _counter + 1 ?_counter != _numCrew : goto "crewCreate" ; Move the crew into their positions. _counter = 0 #crewAssign ; _crewType createUnit [(getmarkerpos _spawnLocMarker), _crewGroup, "", 1, "PRIVATE"] ? _counter == 0 : (units _crewGroup select 0) MoveInDriver _apc ? _counter == 1 : (units _crewGroup select 1) MoveInGunner _apc ? _counter == 2 : (units _crewGroup select 2) MoveInCommander _apc ? _counter > 2 : hintC "spawnMechInfSquad.sqs param 3, numCrew invalid. Valid Range is 1 to 3" (units _crewGroup select _counter) SetCombatMode _apcCombatMode (units _crewGroup select _counter) SetBehaviour _apcBehavior _counter = _counter + 1 ?_counter != _numCrew : goto "crewAssign" ; Spawn the squad. Unit Type 1 _counter = 0 #squadSpawn1 ? _numSquad1 == 0 : hintC "spawnMechInfSquad.sqs param 7, numSquad1 invalid. Valid Range is 1 to 12"; goto "endSquadSpawn1" _typeSquad1 createunit [_squadSpawnPos, _squadGroup, "", _squadSkill, "SERGEANT"] ? _counter == 0 : (units _squadGroup select 0) setDammage 1 ? _counter == 0 : [(units _squadGroup select 0)] join GrpNull _counter = _counter + 1 ?_counter != _numSquad1 : goto "squadSpawn1" #endSquadSpawn1 ; Spawn the squad. Unit Type 2 _counter = 0 #squadSpawn2 ? _numSquad2 == 0 : goto "endSquadSpawn2" _typeSquad2 createunit [_squadSpawnPos, _squadGroup, "", _squadSkill, "CORPORAL"] _counter = _counter + 1 ?_counter != _numSquad2 : goto "squadSpawn2" #endSquadSpawn2 ; Spawn the squad. Unit Type 3 _counter = 0 #squadSpawn3 ? _numSquad3 == 0 : goto "endSquadSpawn3" _typeSquad3 createunit [_squadSpawnPos, _squadGroup, "", _squadSkill, "CORPORAL"] _counter = _counter + 1 ?_counter != _numSquad3 : goto "squadSpawn3" #endSquadSpawn3 ; Spawn the squad. Unit Type 4 _counter = 0 #squadSpawn4 ? _numSquad4 == 0 : goto "endSquadSpawn4" _typeSquad4 createunit [_squadSpawnPos, _squadGroup, "", _squadSkill, "CORPORAL"] _counter = _counter + 1 ?_counter != _numSquad4 : goto "squadSpawn4" #endSquadSpawn4 ; Spawn the squad. Unit Type 5 _counter = 0 #squadSpawn5 ? _numSquad5 == 0 : goto "endSquadSpawn5" _typeSquad5 createunit [_squadSpawnPos, _squadGroup, "", _squadSkill, "SERGEANT"] _counter = _counter + 1 ?_counter != _numSquad5 : goto "squadSpawn5" #endSquadSpawn5 ; Spawn the squad. Unit Type 6 _counter = 0 #squadSpawn6 ? _numSquad6 == 0 : goto "endSquadSpawn6" _typeSquad6 createunit [_squadSpawnPos, _squadGroup, "", _squadSkill, "SERGEANT"] _counter = _counter + 1 ?_counter != _numSquad6 : goto "squadSpawn6" #endSquadSpawn6 ; Assign the squad members to an array _squad = units _squadGroup ; count the squad members _numberOfSquadMembers = count _squad ; Move the squad into the vehicle's cargo _counter = 0 #squadAssign (_squad select _counter) MoveInCargo _apc _counter = _counter + 1 (_squad select _counter) SetCombatMode _squadCombatMode (_squad select _counter) SetBehaviour _squadBehavior ?_counter != _numberOfSquadMembers : goto "squadAssign" ; Make the apc move to the unload WP _apc commandMove getMarkerPos _apcUnload ; Wait for the APC to reach the unload WP _atWP = false #waitForAPCToReachWP ; simply the pythagorean theorem _distanceA = (getpos _apc select 0) - (getMarkerPos _apcUnload select 0) _distanceB = (getpos _apc select 1) - (getMarkerPos _apcUnload select 1) _distanceC = sqrt ((_distanceA * _distanceA) + (_distanceB * _distanceB)) ? _distanceC <= 10 : _atWP = true ~1 ? !_atWP : goto "waitForAPCToReachWP" ; ; ; APC UNLOAD ROUTINE ; Modified Vehicle Unload by ColonelSandersLite Version 1.0 ; ; ; initialize variables. _stopped = false ; Stop the vehicle. _apc action ["Engine Off"] ; This loop checks that the vehicle is stopped and wont let the script progress till it does. #stoppedCheckLoop ? (velocity _apc select 0 == 0) AND (velocity _apc select 1 == 0) AND (velocity _apc select 2 == 0) : _stopped = true ~1 ? !_stopped : goto "stoppedCheckLoop" ; This unloads everyone, quickly. ; reset getOutLoop counter _tmp = 0 ; count the living squad mates _num = "alive _x" count _squad #getOutLoop ? (((_squad select _tmp) in _apc) AND (alive (_squad select _tmp))) : unassignVehicle (_squad select _tmp); (_squad select _tmp) action ["eject", _apc] ~.85 _tmp = _tmp + 1 ? _tmp < _num : goto "getOutLoop" ; make double sure that everyone is out by runngin 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 _apc) AND (alive (_squad select _tmp))) : unassignVehicle (_squad select _tmp); (_squad select _tmp) action ["eject", _apc] _tmp = _tmp + 1 ? _tmp < _num : goto "getOutLoop2" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;Non-Original Code Block;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; make squad move to objective _squad commandMove getMarkerPos _squadObjective ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; timer loop to make the vehicle wait a small amount of time after squad disembarks. _timewaited = 0 #waitLoop ~1 _timewaited = _timewaited + 1 ? _timewaited < _waitTime : goto "waitLoop" ; ; ; END OF APC UNLOAD ROUTINE ; ; ; make apc move to objective _apc commandMove getMarkerPos _apcObjective ; finished Now, the mission. <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[]= { "bmp2", "bradley" }; randomSeed=16418819; class Intel { }; class Groups { items=10; class Item0 { side="WEST"; class Vehicles { items=2; class Item0 { position[]={6113.209961,180.064148,6989.717285}; azimut=85.831902; id=0; side="WEST"; vehicle="OfficerW"; player="PLAYER COMMANDER"; leader=1; rank="CAPTAIN"; skill=0.600000; text="observer_1"; }; class Item1 { position[]={6100.331055,181.711899,7007.060547}; azimut=270.000000; id=1; side="WEST"; vehicle="SoldierWB"; rank="CAPTAIN"; skill=0.600000; text="observer_2"; }; }; }; class Item1 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={1119.549316,89.372643,11493.719727}; id=2; side="WEST"; vehicle="SoldierWB"; leader=1; rank="COLONEL"; skill=0.600000; init="WSpawnedAPCGroup = group this;"; }; }; }; class Item2 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={1129.315430,89.853889,11494.052734}; id=3; side="WEST"; vehicle="SoldierWB"; leader=1; rank="COLONEL"; skill=0.600000; init="WSpawnedSquadGroup = group this;"; }; }; }; class Item3 { side="WEST"; class Vehicles { items=2; class Item0 { position[]={6468.914063,141.884995,7138.881348}; azimut=85.831902; id=4; side="WEST"; vehicle="OfficerW"; leader=1; rank="CAPTAIN"; skill=0.600000; text="observer_1_1"; }; class Item1 { position[]={6459.533203,141.884995,7156.223633}; azimut=270.000000; id=5; side="WEST"; vehicle="OfficerW"; rank="CAPTAIN"; skill=0.600000; text="observer_2_1"; }; }; }; class Item4 { side="WEST"; class Vehicles { items=2; class Item0 { position[]={5695.334961,198.705292,7135.165039}; azimut=85.831902; id=6; side="WEST"; vehicle="OfficerW"; leader=1; rank="CAPTAIN"; skill=0.600000; text="observer_1_2"; }; class Item1 { position[]={5685.954102,198.947296,7152.507324}; azimut=270.000000; id=7; side="WEST"; vehicle="SoldierWB"; rank="CAPTAIN"; skill=0.600000; text="observer_2_2"; }; }; }; class Item5 { side="EAST"; class Vehicles { items=2; class Item0 { position[]={1818.965088,98.718559,5718.448730}; azimut=258.248993; id=8; side="EAST"; vehicle="OfficerE"; leader=1; rank="CAPTAIN"; skill=0.600000; text="observer_1_3"; }; class Item1 { position[]={1816.285522,98.114128,5721.408203}; azimut=270.000000; id=9; side="EAST"; vehicle="SoldierEB"; rank="CAPTAIN"; skill=0.600000; text="observer_2_3"; }; }; }; class Item6 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={10980.062500,24.525000,11671.916016}; id=10; side="EAST"; vehicle="SoldierEB"; leader=1; rank="COLONEL"; skill=0.600000; init="ESpawnedAPCGroup = group this;"; }; }; }; class Item7 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={10989.828125,24.525000,11672.250000}; id=11; side="EAST"; vehicle="SoldierEB"; leader=1; rank="COLONEL"; skill=0.600000; init="ESpawnedSquadGroup = group this;"; }; }; }; class Item8 { side="EAST"; class Vehicles { items=2; class Item0 { position[]={2479.701660,82.908936,5329.519531}; azimut=-71.545891; id=12; side="EAST"; vehicle="OfficerE"; leader=1; rank="CAPTAIN"; skill=0.600000; text="observer_1_1_1"; }; class Item1 { position[]={2479.718994,82.830223,5319.073730}; azimut=333.461456; id=13; side="EAST"; vehicle="OfficerE"; rank="CAPTAIN"; skill=0.600000; text="observer_2_1_1"; }; }; }; class Item9 { side="EAST"; class Vehicles { items=2; class Item0 { position[]={1399.872192,69.730782,5864.356445}; azimut=85.831902; id=14; side="EAST"; vehicle="OfficerE"; leader=1; rank="CAPTAIN"; skill=0.600000; text="observer_1_2_1"; }; class Item1 { position[]={1394.418945,69.279915,5857.544922}; azimut=136.024734; id=15; side="EAST"; vehicle="SoldierEB"; rank="CAPTAIN"; skill=0.600000; text="observer_2_2_1"; }; }; }; }; class Markers { items=10; class Item0 { position[]={6494.594727,141.884995,7108.217285}; name="test_spawnW"; type="Empty"; }; class Item1 { position[]={5727.100586,192.599991,7074.211426}; name="test_squad_objW"; type="Empty"; }; class Item2 { position[]={6126.424805,178.031570,6978.399414}; name="test_apc_unloadW"; type="Empty"; }; class Item3 { position[]={5748.052246,208.777695,7160.914551}; name="test_apc_objW"; type="Empty"; }; class Item4 { position[]={874.660522,30.056107,11576.781250}; name="asdf"; text="West Spawn Placeholders"; type="Flag1"; colorName="ColorGreen"; a=5.000000; b=5.000000; }; class Item5 { position[]={9750.765625,1.520651,11682.756836}; name="asdf_1"; text="East Spawn Placeholders"; type="Flag1"; a=4.000000; b=4.000000; }; class Item6 { position[]={2449.780029,82.883934,5345.060547}; name="test_spawnE"; type="Empty"; }; class Item7 { position[]={1235.105347,65.474998,5973.201172}; name="test_squad_objE"; type="Empty"; }; class Item8 { position[]={1781.427124,95.467613,5710.897949}; name="test_apc_unloadE"; type="Empty"; }; class Item9 { position[]={1448.115845,75.225960,5838.219238}; name="test_apc_objE"; type="Empty"; }; }; class Sensors { items=2; class Item0 { position[]={6133.463867,168.764786,7176.156738}; a=0.000000; b=0.000000; activationBy="ALPHA"; age="UNKNOWN"; text="Spawn West"; expActiv="[""Bradley"", ""test_spawnW"", 3, ""SoldierWCrew"", WSpawnedAPCGroup, WSpawnedSquadGroup, 1, ""OfficerW"", 1, ""SoldierWG"", 2, ""SoldierWLAW"", 1, ""SoldierWMG"", 1, ""SoldierWB"", 0, ""SoldierWAT"", 0.5, ""test_apc_unloadW"", ""test_apc_objW"", ""test_squad_objW"", ""COMBAT"", ""RED"", ""COMBAT"", ""RED"", 180] exec ""spawnMechInfSquad.sqs"""; class Effects { }; }; class Item1 { position[]={1887.892578,102.871704,5773.496582}; a=0.000000; b=0.000000; activationBy="BRAVO"; age="UNKNOWN"; text="Spawn East"; expActiv="[""BMP2"", ""test_spawnE"", 3, ""SoldierECrew"", ESpawnedAPCGroup, ESpawnedSquadGroup, 1, ""OfficerE"", 1, ""SoldierEG"", 2, ""SoldierELAW"", 1, ""SoldierEMG"", 1, ""SoldierEB"", 0, ""SoldierEAT"", 0.5, ""test_apc_unloadE"", ""test_apc_objE"", ""test_squad_objE"", ""COMBAT"", ""RED"", ""COMBAT"", ""RED"", 300] exec ""spawnMechInfSquad.sqs"""; class Effects { }; }; }; }; class Intro { randomSeed=14504963; class Intel { }; }; class OutroWin { randomSeed=1281539; class Intel { }; }; class OutroLoose { randomSeed=4226563; class Intel { }; }; -------------------------------------------------- The basic fixed wing laser guided bomb script is done. Works with the blackop(laser) and the oh58's laser designator. and any fixed wing aircraft you choose to use. Heck, it probably would work with a helicopter should you really want to drop laser guided bombs from a rotorary wing aircraft for some reason. Once I sleep, I'll flesh it out a little more, test it some more, and document it. Then I'll post it. In the mean time, . Share this post Link to post Share on other sites
Guest Posted April 14, 2006 Wow Thanks a lot ColonelSandersLite, looks like it was alot more work than I realized to put that together, extremely kind of you. I have decided that if, big IF this mission of mine gets done I will be giving you the credit for this script, wether I use the whole thing or just parts of it, its not much and I know its not like your doing this expecting something in return, but it is the least I can do. I.... lol, dont know what to say, wow, Im confident after looking over the whole script that I can edit it as I see fit to get stuff goin right when the time comes, otherwise if it were not for your very generous help just looking at the size of the script I can see it would have been a task to figure it all out 10 times what I thought it would be. Cheers to you. Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 15, 2006 Ah hell, it wasn't nothin. I just like writing code people will find usefull. Wether it's c++, java, or ofp++ . Anyways, there is a small thing you can do in return, put the modified script up here. Hell, even in the same thread if you like. The more scripts like this available, the better... Anyways, now I've got to work on funnyguy1's stuff. He sure did give me a stack of things to have fun with. Share this post Link to post Share on other sites
Guest Posted April 15, 2006 No problem. Its defenitley seeming a great idea to have alot more scripts that cover basic actions of a mission, ofpec had a lot of stuff, but it was still lacking some in having scripts that would cover basic actions of certain applications, that is not just limited to a particular action like helo drops, but a slew of actions that would make up a 'basic' function that could be used over and over again in larger scale missions, which of course would broaden the horizens for mission makers with little coding/scripting knowledge. It almost does seem odd to me that somehow the editor wasnt set up to utilize spawned units and also multiple waypoint systems for units and groups, it would have made things much easier for these applications, which are used often in large scale missions and certainly used alot in big MP missions. Gl with those new scripts and thanks again for helping out the user mission creating community. Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 16, 2006 Just an update this time. I'm working on the LGB script, and it's working pretty well right now. I had hit a snag using spawned pilots and planes, but I worked around it. If only createunit returned a local unit name like createvehicle. Still, a solution has presented itself and I now have a pretty badass script nearly ready to release. I'll post it once I finish testing and documentation tomorrow. I also have an idea for a decent single player/coop mission that uses some of the scripts seen here. I think I just might put it together once I've finished this LGB script. Just for shits and giggles. Share this post Link to post Share on other sites
mattxr 9 Posted April 16, 2006 sorry to hyjack your thred but can anyone tell me whats what for this.. [0,0,0] which one is up and down and left and right so on?? Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 16, 2006 Not a problem. [0,0,0] is [x,y,z] When refering to position, these coordinate with map coordinates in meters (I think it's meters). When refering to velocity, it's in meters/second. I'm thinking east and north are higher, but I quickly forget such things. Create a quick test mission with some guy as the player. Put this in a text file called reportpos.sqs in the mission folder. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_veh = _this select 0 #reporting _report = format["X %1 Y %2 Z %3", (getpos _veh select 0), (getpos _veh select 1), (getpos _veh select 2)] _veh GlobalChat _report goto "reporting" and put: [this] exec "reportpos.sqs" in the guys init bar. This will tell you for sure. Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 16, 2006 Now, for the LGB script, documented and tested. *deleted by me, updated version below* Share this post Link to post Share on other sites
Garcia 0 Posted April 16, 2006 sorry to hyjack your thred but can anyone tell me whats what for this.. [0,0,0] which one is up and down and left and right so on?? Â [x,y,z] where x is east/west, y is north/south and z is up/down (altitude). It starts in the bottom left corner (so [0,0,0] will be in the bottom left corner). Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 17, 2006 Now, it's time to post the Laser Designated, Fixed Wing Aircraft Launched, Air to Surface Missile Script. *deleted by me, updated version below* Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 20, 2006 1: The laser guided bomb and air to surface missile scripts, modified to support General Barrons Hand signals mod. 2: Due to the nature of HS missions, it's not practical to post the contents of all the mission related files here. If anyone wants the sample HS mission with the scripts, let me know and I'll e-mail it to you. If a bunch of people want it, I'll see about getting it hosted. So, the scripts: fixedWingLaserHS.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Fixed Wing Laser Guided Bombs by ColonelSandersLite Version V1.0 ; Modified to support General Barron's Hand Signals ; Instructions: ; 1: Create a valid HS mission by following the directions from the HS Mission Notes. ; In the Editor: ; 2: Create 1 Marker (empty), name it so you will remember it. ; This marker will be used by the script to keep track of the lased target. ; 3: Create a trigger that covers the area that can be lased, name it whatever you want. I ; used CSL_FWAS_unitlist . It must be an "anybody present, repeatedly, condition this, ; on activation blank" type. ; 4: Create 1 man (ungrouped) and name his group by putting mygroupname = group this ; in his init feild. I used CSL_FWAS_groupAirSupport . This man should be tucked out of the way ; 5: Create a trigger that covers the man above, it must be named "CSL_FWAS_PilotList" and ; be an "anybody present, repeatedly, condition this, on activation blank" type. ; I reccomend a 500X500 rectangle. ; In windows: ; 6: Put fixedWingLaserHS.sqs in the support folder of your choice. ; I chose \support\fixedWingLaserHS\fixedWingLaserHS.sqs ; Time to start playing with the sqs files now: ; 7: In "init.sqs", Just below the line that says ";YOU CAN EDIT BELOW THIS POINT" insert: ; myNumberOfStrikes = X (leave off the; at the begining) ; Where myNumberOfStrikes is a global variable name (I used CSL_FWAS_NumberOfStrikesAvailable) ; and X is the number of strikes you want to be available (I used 9999 for the sample). ; 8: In "hs_init.sqs", just above the line that says ; ";code to be executed when radio is first used. If you don't want anything, just use empty braces" ; insert: (leave off the; at the begining of these lines) ; _tmp = ["myText", "mypath\fixedWingLaserHS.sqs"] ; _rto_opts = _rto_opts + [_tmp] ; Where myText is the text you want to display in the radio dialog, and myPath is the path to ; fixedWingLaserHS.sqs from step 6. ; Example: (leave off the; at the begining of these lines) ; _tmp = ["Request LGB Air Strike", "support\fixedWingLaserHS\fixedWingLaserHS.sqs"] ; _rto_opts = _rto_opts + [_tmp] ; 9: Edit the values as instructed below. ; BEGIN SCRIPT ; Get All Passed Data. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Changed for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; change: HS Radio System cannot support Parameters. The Values must be altered by hand. ;_delayBeforeInbound = _this select 0 ;_unitList = _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 ; CSL_FWAS_AttackTarget should be changed to whatever you named the marker you're using in step 2. _attackMarker = "CSL_FWAS_AttackTarget" ; list is game code and is mandatory. CSL_FWAS_unitlist should be changed to whatever you named the trigger ; covering the paintable area as in step 3. _unitList = list CSL_FWAS_unitlist ; CSL_FWAS_groupAirSupport should be changed to the group name from step 4. _group = CSL_FWAS_groupAirSupport ; list is game code and is mandatory. CSL_FWAS_PilotList should be changed to whatever you named the trigger ; covering the paintable area as in step 5. _pilotList = list CSL_FWAS_PilotList ; This number lets you set the time between the call for support and the actual attack run of the aircraft. ; The number is in seconds. _delayBeforeInbound = 30 ; Dictates "approach target from the" direction. Valid Values: ; "n" "ne" "e" "se" "s" "sw" "w" "nw" _approachFrom = "w" ; Dictates the "exit target area to the" direction. Must be different from "_approachFrom" above. ; Valid Values: ; "n" "ne" "e" "se" "s" "sw" "w" "nw" _exitTo = "ne" ; 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. On Flat maps, you can probably get ; it pretty low, but you need some room for the aircraft to clear the blast. _flyHeight = 50 ; The type of aircraft providing support. Tested BIS values: ; "Su25" ; "A10" ; "A10LGB" ; "Cessna" _acType = "A10" ; The pilot type. Tested BIS values: ; "SoldierWPilot" ; "SoldierEPilot" ; "SoldierGPilot" ; "Civilian" _crewType = "SoldierWPilot" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Added for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; this is the time the player won't be able to use the radio after calling the strike hs_rto_dly = 5 ; finished, the support should work now. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Added for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; takes care of Number of strikes check and RTO messages ? ((CSL_FWAS_NumberOfStrikesAvailable == 0) AND (call hs_hearRTO)) : [units _group select 0, "Negative, there are no strike aircraft on station, over."] call hs_sidechat ? (CSL_FWAS_NumberOfStrikesAvailable == 0) : exit CSL_FWAS_NumberOfStrikesAvailable = CSL_FWAS_NumberOfStrikesAvailable - 1 ? call hs_hearRTO : [units _group select 0, "Roger, setting up for attack run, over."] call hs_sidechat ; delay the script's execution the specified number of seconds ~_delayBeforeInbound ; get the designated spot _designator = objNull "if (typeOf _x == ""LaserTargetW"") then {_designator = _x}" forEach _unitList ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Changed for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; if nothing is designated, abort the attack run ; ? (IsNull _designator) : units _group select 0 sideChat "We are not receiveing a signal, aborting run, over."; exit ; change: converted to HS message system ? ((IsNull _designator) AND (call hs_hearRTO)) : [units _group select 0, "We are not receiveing a signal, aborting run, over."] call hs_sidechat ? (IsNull _designator) : exit ; if something is designated, set the marker's position to the designated spot. _attackMarker setMarkerPos [getPos _designator select 0, getPos _designator select 1] ; 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, _flyHeight] _crewType createunit [getPos ((units _group) select 0), _group, "", 1, "PRIVATE"] ; give the pilot time to spawn and show up in the _pilotList ~1 ; get the pilot from the pilot list, and stick him in the cockpit. "if (typeOf _x == _crewType) then {_x assignAsDriver _aircraft; _x moveInDriver _aircraft}" forEach (_pilotList) _pilot = driver _aircraft ; 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] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Changed for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; announce the begining of the attack run to the player ;_pilot sideChat "Inbound on attack run, over" ; change: converted to HS message system ? call hs_hearRTO : [_pilot, "Inbound on attack run, over."] call hs_sidechat ; keep checking to see that the target is still lased. If it isn't, abort the run. ; also moves the wp to keep the plane heading towards the lased target, even if it moves. _halfwayToWP = false #waitForAircraftToGethalfwayToWP _designator = objNull "if (typeOf _x == ""LaserTargetW"") then {_designator = _x}" forEach _unitList ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Changed for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;? (IsNull _designator) : _pilot sideChat "Signal Lost, aborting run, over."; goto "abortRun" ; change: converted to HS message system ? ((IsNull _designator) AND (call hs_hearRTO)) : [_pilot, "Signal Lost, aborting run, over."] call hs_sidechat ? (IsNull _designator) : goto "abortRun" _attackMarker setMarkerPos [getPos _designator select 0, getPos _designator select 1] _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 to see that the target is still lased. If it isn't, abort the run. ; also moves the wp to keep the plane heading towards the lased target, even if it moves. _atWP = false #waitForAircraftToReachWP _designator = objNull "if (typeOf _x == ""LaserTargetW"") then {_designator = _x}" forEach _unitList ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Changed for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;? (IsNull _designator) : _pilot sideChat "Signal Lost, aborting run, over."; goto "abortRun" ; change: converted to HS message system ? ((IsNull _designator) AND (call hs_hearRTO)) : [_pilot, "Signal Lost, aborting run, over."] call hs_sidechat ? (IsNull _designator) : "abortRun" _attackMarker setMarkerPos [getPos _designator select 0, getPos _designator select 1] _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 <= 50 : _atWP = true ; aborts the run if the plane over shot the target without dropping the bomb. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Changed for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;? _distanceC >1000 : _pilot sideChat "Couldn't keep lock, attack run aborted, over"; goto "abortRun" ; change: converted to HS message system ? ((_distanceC > 1000) AND (call hs_hearRTO)) : [_pilot, "Couldn't keep lock, attack run aborted, over."] call hs_sidechat ? (_distanceC > 1000) : goto "abortRun" ~.25 ? !_atWP : goto "waitForAircraftToReachWP" ; drop the bomb when over the target. "laserGuidedBomb" camcreate [getMarkerPos _attackMarker select 0, getMarkerPos _attackMarker select 1, (getPos _aircraft select 2)-40] ; 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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Added for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; change: Added to make communication more consistant with HS Radio System ? ((_atWP) AND (call hs_hearRTO)) : [_pilot, "Weapon deployed, over."] call hs_sidechat ; 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 <= 1000 : _atWP = true ~.5 ? !_atWP : goto "waitForAircraftToReachExit" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Added for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; change: Added to make communication more consistant with HS Radio System ? (call hs_hearRTO) : [_pilot, "Exiting Mission Area, over."] call hs_sidechat ~1 ; once the plane has extracted, delete it so it's not taking resources anymore deleteVehicle driver _aircraft deleteVehicle _aircraft ; end of script fixedWingASMLaserHS.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Laser Designated, Fixed Wing Aircraft Launched, Air to Surface Missile Script by ColonelSandersLite Version V1.0 ; Modified to support General Barron's Hand Signals ; Credit: ; "xenom" for "hint format["weapons: %1, magazines: %2",weapons this,magazines this]" in this thread: ; http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?act=ST;f=7;t=16179;st=15 ; used in reccomendation for editors trying to figure out the weapon/magazine names of an aircraft. ; Instructions: ; 1: Create a valid HS mission by following the directions from the HS Mission Notes. ; In the Editor: ; 2: Create 1 Marker (empty), name it so you will remember it. ; This marker will be used by the script to keep track of the lased target. ; 3: Create a trigger that covers the area that can be lased, name it whatever you want. I ; used CSL_FWAS_unitlist . It must be an "anybody present, repeatedly, condition this, ; on activation blank" type. ; 4: Create 1 man (ungrouped) and name his group by putting mygroupname = group this ; in his init feild. I used CSL_FWAS_groupAirSupport . This man should be tucked out of the way ; 5: Create a trigger that covers the man above, name it whatever you want. I ; used CSL_FWAS_PilotList . It must be an "anybody present, repeatedly, condition this, ; on activation blank" type. I reccomend a 500X500 rectangle for size. ; In windows: ; 6: Put fixedWingLaserHS.sqs in the support folder of your choice. ; I chose \support\fixedWingLaserHS\fixedWingLaserHS.sqs ; Time to start playing with the sqs files now: ; 7: In "init.sqs", Just below the line that says ";YOU CAN EDIT BELOW THIS POINT" insert: ; myNumberOfStrikes = X (leave off the; at the begining) ; Where myNumberOfStrikes is a global variable name (I used CSL_FWAS_NumberOfStrikesAvailable) ; and X is the number of strikes you want to be available (I used 9999 for the sample). ; 8: In "hs_init.sqs", just above the line that says ; ";code to be executed when radio is first used. If you don't want anything, just use empty braces" ; insert: (leave off the; at the begining of these lines) ; _tmp = ["myText", "mypath\fixedWingLaserHS.sqs"] ; _rto_opts = _rto_opts + [_tmp] ; Where myText is the text you want to display in the radio dialog, and myPath is the path to ; fixedWingLaserHS.sqs from step 6. ; Example: (leave off the; at the begining of these lines) ; _tmp = ["Request LGB Air Strike", "support\fixedWingLaserHS\fixedWingLaserHS.sqs"] ; _rto_opts = _rto_opts + [_tmp] ; 9: Edit the values as instructed below. ; BEGIN SCRIPT ; Get All Passed Data. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Changed for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; change: HS Radio System cannot support Parameters. The Values must be altered by hand. ;_delayBeforeInbound = _this select 0 ;_unitList = _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 ; CSL_FWAS_AttackTarget should be changed to whatever you named the marker you're using in step 2. _attackMarker = "CSL_FWAS_AttackTarget" ; list is game code and is mandatory. CSL_FWAS_unitlist should be changed to whatever you named the trigger ; covering the paintable area as in step 3. _unitList = list CSL_FWAS_unitlist ; CSL_FWAS_groupAirSupport should be changed to the group name from step 4. _group = CSL_FWAS_groupAirSupport ; list is game code and is mandatory. CSL_FWAS_PilotList should be changed to whatever you named the trigger ; covering the paintable area as in step 5. _pilotList = list CSL_FWAS_PilotList ; This number lets you set the time between the call for support and the actual attack run of the aircraft. ; The number is in seconds. _delayBeforeInbound = 30 ; Dictates "approach target from the" direction. Valid Values: ; "n" "ne" "e" "se" "s" "sw" "w" "nw" _approachFrom = "w" ; Dictates the "exit target area to the" direction. Must be different from "_approachFrom" above. ; Valid Values: ; "n" "ne" "e" "se" "s" "sw" "w" "nw" _exitTo = "ne" ; 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. On Flat maps, you can probably get ; it pretty low, but you need some room for the aircraft to clear the blast. _flyHeight = 50 ; The type of aircraft providing support. Tested BIS values: ; "Su25" ; "A10" ; "A10LGB" ; "Cessna" _acType = "A10" ; The pilot type. Tested BIS values: ; "SoldierWPilot" ; "SoldierEPilot" ; "SoldierGPilot" ; "Civilian" _crewType = "SoldierWPilot" ; The type of missile to deploy ; There is a limitation of the OFP engine, the plane must be able to carry the related weapon (built into the game) ; in order to actually use it. The Su-25 and both A-10s use: "MaverickLauncher" as their weapon name. The magazine ; for these planes are also "MaverickLauncher" . This parameter is really only here so this script can be used ; with mods without having to modify the script. If you're going with standard clean ofp, this should always ; be "MaverickLauncher" . ; If you want to use an addon aircraft that's not documented do this: ; Create a test aircraft on a blank map with the player as the pilot. ; Put the following in the aircraft's init feild. ; hintC format["Weapons: ""%1"", Magazines: ""%2""", weapons this, magazines this] ; (credit to "xenom" as above) ; This will tell you everything the aircraft carries as soon as the test mission starts _missileTypeWeapon = "MaverickLauncher" ; See missileTypeWeapon Above _missileTypeMagazine = "MaverickLauncher" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Added for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; this is the time the player won't be able to use the radio after calling the strike hs_rto_dly = 5 ; finished, the support should work now. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Added for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; takes care of Number of strikes check and RTO messages ? ((CSL_FWAS_NumberOfStrikesAvailable == 0) AND (call hs_hearRTO)) : [units _group select 0, "Negative, there are no strike aircraft on station, over."] call hs_sidechat ? (CSL_FWAS_NumberOfStrikesAvailable == 0) : exit CSL_FWAS_NumberOfStrikesAvailable = CSL_FWAS_NumberOfStrikesAvailable - 1 ? call hs_hearRTO : [units _group select 0, "Roger, setting up for attack run, over."] call hs_sidechat ; delay the script's execution the specified number of seconds ~_delayBeforeInbound ; get the designated spot _designator = objNull "if (typeOf _x == ""LaserTargetW"") then {_designator = _x}" forEach _unitList ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Changed for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; if nothing is designated, abort the attack run ; ? (IsNull _designator) : units _group select 0 sideChat "We are not receiveing a signal, aborting run, over."; exit ; change: converted to HS message system ? ((IsNull _designator) AND (call hs_hearRTO)) : [units _group select 0, "We are not receiveing a signal, aborting run, over."] call hs_sidechat ? (IsNull _designator) : exit ; if something is designated, set the marker's position to the designated spot. _attackMarker setMarkerPos [getPos _designator select 0, getPos _designator select 1] ; 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, _flyHeight] _crewType createunit [getPos ((units _group) select 0), _group, "", 1, "PRIVATE"] ; give the pilot time to spawn and show up in the _pilotList ~1 ; get the pilot from the pilot list, and stick him in the cockpit. "if (typeOf _x == _crewType) then {_x assignAsDriver _aircraft; _x moveInDriver _aircraft}" forEach (_pilotList) _pilot = driver _aircraft ; 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 ; give it some missiles to fire at the target _aircraft addWeapon _missileTypeWeapon _aircraft addMagazine _missileTypeMagazine ; 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] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Changed for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; announce the begining of the attack run to the player ;_pilot sideChat "Inbound on attack run, over" ; change: converted to HS message system ? call hs_hearRTO : [_pilot, "Inbound on attack run, over."] call hs_sidechat ; keep checking to see that the target is still lased. If it isn't, abort the run. ; also moves the wp to keep the plane heading towards the lased target, even if it moves. _halfwayToWP = false #waitForAircraftToGethalfwayToWP _designator = objNull "if (typeOf _x == ""LaserTargetW"") then {_designator = _x}" forEach _unitList ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Changed for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;? (IsNull _designator) : _pilot sideChat "Signal Lost, aborting run, over."; goto "abortRun" ; change: converted to HS message system ? ((IsNull _designator) AND (call hs_hearRTO)) : [_pilot, "Signal Lost, aborting run, over."] call hs_sidechat ? (IsNull _designator) : goto "abortRun" _attackMarker setMarkerPos [getPos _designator select 0, getPos _designator select 1] _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 to see that the target is still lased. If it isn't, abort the run. ; also moves the wp to keep the plane heading towards the lased target, even if it moves. _atWP = false #waitForAircraftToReachWP _designator = objNull "if (typeOf _x == ""LaserTargetW"") then {_designator = _x}" forEach _unitList ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Changed for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;? (IsNull _designator) : _pilot sideChat "Signal Lost, aborting run, over."; goto "abortRun" ; change: converted to HS message system ? ((IsNull _designator) AND (call hs_hearRTO)) : [_pilot, "Signal Lost, aborting run, over."] call hs_sidechat ? (IsNull _designator) : "abortRun" _attackMarker setMarkerPos [getPos _designator select 0, getPos _designator select 1] _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 <= 750 : _atWP = true ; aborts the run if the plane over shot the target without dropping the bomb. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Changed for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;? _distanceC >1000 : _pilot sideChat "Couldn't keep lock, attack run aborted, over"; goto "abortRun" ; change: converted to HS message system ? ((_distanceC > 1000) AND (call hs_hearRTO)) : [_pilot, "Couldn't keep lock, attack run aborted, over."] call hs_sidechat ? (_distanceC > 1000) : goto "abortRun" ~.25 ? !_atWP : goto "waitForAircraftToReachWP" ; Get's the target, the target has to be materiel, and can't be a bush or something. _target = objNull "if (((_x distance _designator) < 7) AND (typeOf _x != ""LaserTargetW"") AND (typeOf driver _x != typeOf _x))then {_target = _x}" forEach _unitList ; if nothing is targeted, abort the attack run ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Changed for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ? (IsNull _target) : _pilot sideChat "You are not painting a lockable target. Aborting run. Over."; goto "abortRun" ; change: converted to HS message system ? ((IsNull _target) AND (call hs_hearRTO)) : [_pilot, "You are not painting a lockable target. Aborting run, over."] call hs_sidechat ? (IsNull _target) : goto "abortRun" ; fire the ASM ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Changed for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; _pilot sideChat "Firing ASM. Over" ; change: converted to HS message system ? (call hs_hearRTO) : [_pilot, "Firing ASM, over"] call hs_sidechat _aircraft doTarget _target _aircraft doFire _target ~.5 _aircraft doFire _target ; 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 ; 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 <= 1000 : _atWP = true ~.5 ? !_atWP : goto "waitForAircraftToReachExit" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;Added for HS Radio Support;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; change: Added to make communication more consistant with HS Radio System ? (call hs_hearRTO) : [_pilot, "Exiting Mission Area, over."] call hs_sidechat ~1 ; once the plane has extracted, delete it so it's not taking resources anymore deleteVehicle driver _aircraft deleteVehicle _aircraft ; end of script Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 21, 2006 Updated Versions of the fixed wing air support scripts with example mission. fixedWingASMLaser1.1.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Laser Designated, Fixed Wing Aircraft Launched, Air to Surface Missile Script by ColonelSandersLite Version V1.1 ; Version 1.1 updates: ; _pilotList is now a parameter rather than a mandatory name ; modified and added several messages for consistancy ; Credit: ; "xenom" for "hint format["weapons: %1, magazines: %2",weapons this,magazines this]" in this thread: ; http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?act=ST;f=7;t=16179;st=15 ; used in reccomendation for editors trying to figure out the weapon/magazine names of an aircraft. ; Usage: ; Create 1 Marker (emtpy), name it so you will remember it. ; The marker will be used by the script to keep track of the lased target. ; Create a trigger that covers the area that can be lased, name it whatever you want, but it must be ; an "anybody present, repeatedly, condition this, on activation blank" type ; 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 MyTargetAreaList, list MyPilotList, "myTargetMarker", "approachFromTheDirection", "exitToTheDirection", preferedFlyingHeight, myGroupName, "myAircraftType", "myPilotType", "missileTypeWeapon", "missileTypeMagazine"] exec "fixedWingASMLaser1.1.sqs" ; Parameter Example: ; [5, list FWAS_TargetList, list FWAS_PilotList, "attackTarget", "w", "ne", 50, groupAirSupport, "A10", "SoldierWPilot", "MaverickLauncher", "MaverickLauncher"] Exec "fixedWingASMLaser1.1.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 MyTargetAreaList ; list is game code and is mandatory. MyTargetAreaList should be the trigger covering the laseable area as above. ; 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 ; "Su25" ; "A10" ; "A10LGB" ; "myPilotType" ; tested working standard ofp types below ; "SoldierWPilot" ; "SoldierEPilot" ; "SoldierGPilot" ; "Civilian" ; "missileTypeWeapon" ; There is a limitation of the OFP engine, the plane must be able to carry this weapon (built into the game) in order ; to actually use it. The Su-25 and both A-10s use: "MaverickLauncher" as their weapon name. This parameter is ; really only here so this script can be used with mods without having to modify the script. If you're going with ; standard clean ofp, this should always be "MaverickLauncher" . ; "missileTypeMagazine" ; There is a limitation of the OFP engine, the plane must be able to carry the related weapon (built into the game) ; in order to actually use it. The Su-25 and both A-10s use: "MaverickLauncher" as their weapon name. The magazine ; for these planes are also "MaverickLauncher" . This parameter is really only here so this script can be used ; with mods without having to modify the script. If you're going with standard clean ofp, this should always ; be "MaverickLauncher" . ; If you want to use an addon aircraft that's not documented do this: ; Create a test aircraft on a blank map with the player as the pilot. ; Put the following in the aircraft's init feild. ; hintC format["Weapons: ""%1"", Magazines: ""%2""", weapons this, magazines this] ; (credit to "xenom" as above) ; This will tell you everything the aircraft carries as soon as the test mission starts ; BEGIN SCRIPT ; Get All Passed Data. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;Updated 1.1 _pilotList uses a parameter;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;rather than a mandatory name;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; _delayBeforeInbound = _this select 0 _unitList = _this select 1 _pilotList = _this select 2 _attackMarker = _this select 3 _approachFrom = _this select 4 _exitTo = _this select 5 _flyHeight = _this select 6 _group = _this select 7 _acType = _this select 8 _crewType = _this select 9 _missileTypeWeapon = _this select 10 _missileTypeMagazine = _this select 11 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;Updated 1.1 Added message for consistancy;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ? (_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 ; get the designated spot _designator = objNull "if (typeOf _x == ""LaserTargetW"") then {_designator = _x}" forEach _unitList ; if nothing is designated, abort the attack run ? (IsNull _designator) : units _group select 0 sideChat "We are not receiveing a signal, aborting run, over."; exit ; if something is designated, set the marker's position to the designated spot. _attackMarker setMarkerPos [getPos _designator select 0, getPos _designator select 1] ; 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, _flyHeight] _crewType createunit [getPos ((units _group) select 0), _group, "", 1, "PRIVATE"] ; give the pilot time to spawn and show up in the _pilotList ~1 ; get the pilot from the pilot list, and stick him in the cockpit. "if (typeOf _x == _crewType) then {_x assignAsDriver _aircraft; _x moveInDriver _aircraft}" forEach _pilotList _pilot = driver _aircraft ; 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 ; give it some missiles to fire at the target _aircraft addWeapon _missileTypeWeapon _aircraft addMagazine _missileTypeMagazine ; 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 to see that the target is still lased. If it isn't, abort the run. ; also moves the wp to keep the plane heading towards the lased target, even if it moves. _halfwayToWP = false #waitForAircraftToGethalfwayToWP _designator = objNull "if (typeOf _x == ""LaserTargetW"") then {_designator = _x}" forEach _unitList ? (IsNull _designator) : _pilot sideChat "Signal lost, aborting run, over."; goto "abortRun" _attackMarker setMarkerPos [getPos _designator select 0, getPos _designator select 1] _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 to see that the target is still lased. If it isn't, abort the run. ; also moves the wp to keep the plane heading towards the lased target, even if it moves. _atWP = false #waitForAircraftToReachWP _designator = objNull "if (typeOf _x == ""LaserTargetW"") then {_designator = _x}" forEach _unitList ? (IsNull _designator) : _pilot sideChat "Signal Lost, aborting run, over."; goto "abortRun" _attackMarker setMarkerPos [getPos _designator select 0, getPos _designator select 1] _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 <= 750 : _atWP = true ; aborts the run if the plane over shot the target without firing. ? _distanceC >1000 : _pilot sideChat "Couldn't keep lock, attack run aborted, over."; goto "abortRun" ~.25 ? !_atWP : goto "waitForAircraftToReachWP" ; Get's the target, the target has to be materiel, and can't be a bush or something. _target = objNull ; get the designated target "if (((_x distance _designator) < 7) AND (typeOf _x != ""LaserTargetW"") AND (typeOf driver _x != typeOf _x))then {_target = _x}" forEach _unitList ; if nothing is targeted, abort the attack run ? (IsNull _target) : _pilot sideChat "You are not painting a lockable target. Aborting run, over."; goto "abortRun" ; fire the ASM _pilot sideChat "Firing ASM, over." _aircraft doTarget _target _aircraft doFire _target ~.5 _aircraft doFire _target ~1 ; this marker is used in the event the plane had to abort the run #abortRun ; leave the mission area _aircraft doTarget _aircraft _pilot setCombatMode "BLUE" _pilot setBehaviour "CARELESS" ; 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 ; 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" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;Updated 1.1 Added message for consistancy;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; _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 fixedWingLaser1.1.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Fixed Wing Laser Guided Bombs by ColonelSandersLite Version V1.1 ; Version 1.1 updates: ; _pilotList is now a parameter rather than a mandatory name ; modified and added several messages for consistancy ; Usage: ; Create 1 Marker (emtpy), name it so you will remember it. ; The marker will be used by the script to keep track of the lased target. ; Create a trigger that covers the area that can be lased, name it whatever you want, but it must be ; an "anybody present, repeatedly, condition this, on activation blank" type ; 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 MyTargetAreaList, list MyPilotList, "myTargetMarker", "approachFromTheDirection", "exitToTheDirection", preferedFlyingHeight, myGroupName, "myAircraftType", "myPilotType"] exec "fixedWingLaser1.1.sqs" ; Parameter Example: ; [60, list FWAS_TargetList, list FWAS_PilotList, "attackTarget", "w", "ne", 50, groupAirSupport, "A10", "SoldierWPilot"] Exec "fixedWingLaser1.1.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 MyTargetAreaList ; list is game code and is mandatory. MyTargetAreaList should be the trigger covering the laseable area as above. ; 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" ; BEGIN SCRIPT ; Get All Passed Data. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;Updated 1.1 _pilotList uses a parameter;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;rather than a mandatory name;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; _delayBeforeInbound = _this select 0 _unitList = _this select 1 _pilotList = _this select 2 _attackMarker = _this select 3 _approachFrom = _this select 4 _exitTo = _this select 5 _flyHeight = _this select 6 _group = _this select 7 _acType = _this select 8 _crewType = _this select 9 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;Updated 1.1 Added message for consistancy;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ? (_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 ; get the designated spot _designator = objNull "if (typeOf _x == ""LaserTargetW"") then {_designator = _x}" forEach _unitList ; if nothing is designated, abort the attack run ? (IsNull _designator) : units _group select 0 sideChat "We are not receiveing a signal, aborting run, over."; exit ; if something is designated, set the marker's position to the designated spot. _attackMarker setMarkerPos [getPos _designator select 0, getPos _designator select 1] ; 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, _flyHeight] _crewType createunit [getPos ((units _group) select 0), _group, "", 1, "PRIVATE"] ; give the pilot time to spawn and show up in the _pilotList ~.5 ; get the pilot from the pilot list, and stick him in the cockpit. "if (typeOf _x == _crewType) then {_x assignAsDriver _aircraft; _x moveInDriver _aircraft}" forEach _pilotList _pilot = driver _aircraft ; 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 to see that the target is still lased. If it isn't, abort the run. ; also moves the wp to keep the plane heading towards the lased target, even if it moves. _halfwayToWP = false #waitForAircraftToGethalfwayToWP _designator = objNull "if (typeOf _x == ""LaserTargetW"") then {_designator = _x}" forEach _unitList ? (IsNull _designator) : _pilot sideChat "Signal Lost, aborting run, over."; goto "abortRun" _attackMarker setMarkerPos [getPos _designator select 0, getPos _designator select 1] _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 to see that the target is still lased. If it isn't, abort the run. ; also moves the wp to keep the plane heading towards the lased target, even if it moves. _atWP = false #waitForAircraftToReachWP _designator = objNull "if (typeOf _x == ""LaserTargetW"") then {_designator = _x}" forEach _unitList ? (IsNull _designator) : _pilot sideChat "Signal Lost, aborting run, over."; goto "abortRun" _attackMarker setMarkerPos [getPos _designator select 0, getPos _designator select 1] _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 <= 50 : _atWP = true ; aborts the run if the plane over shot the target without dropping the bomb. ? _distanceC >1000 : _pilot sideChat "Couldn't keep lock, attack run aborted, over."; goto "abortRun" ~.25 ? !_atWP : goto "waitForAircraftToReachWP" ; drop the bomb when over the target. "laserGuidedBomb" camcreate [getMarkerPos _attackMarker select 0, getMarkerPos _attackMarker select 1, (getPos _aircraft select 2)-40] ; 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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;Updated 1.1 Added message for consistancy;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; _pilot sideChat "Weapon 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" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;Updated 1.1 Added message for consistancy;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; _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 stopmovingdangit.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Stop Moving DANGIT! by ColonelSandersLite Version V1.0 ; Usage: ; Just start this script from the vehicle's init line. ; Parameter details below ; [vehicle, mode] exec "stopmovingdangit.sqs" ; Parameter Example: ; [this, 0] exec "stopmovingdangit.sqs" ; More information on accepted parameters ; vehicle ; name of the vehicle or this if starting from the init line ; mode ; 0 when it's to damaged to move anymore, disable all movement ; 1 stop it from moving when damaged at all (with slight tolerance) ; BEGIN SCRIPT ; Get All Passed Data. _veh = _this select 0 _stopMode = _this select 1 _stop = 0 #damageloop ~0.1 ? (_stopMode == 0) and !(canMove _veh) : _stop = 1 ? (_stopMode == 1) and (getDammage _veh > 0.02) : _stop = 1 ? _stop == 0 : goto "damageloop" #stoperloop _veh setVelocity[0,0,0] ~0.1 goto "stoperloop" ; END SCRIPT mission.sqm everon mission, be sure turn on markers in the editor to see everything. edit: This was moved below due to hitting the max message length. Thank you for bringing it to my attention. Share this post Link to post Share on other sites
DCurrahee 0 Posted April 21, 2006 Hey! Long time OFP Fan returning to the forums fiending for ofpec scripting help. Thanks for giving back to the community man these scripts are superb. I can make my helicopters land properly now! Fixedwing bombardment is the next thing I wanted to tackle. Your mission.sqm file cuts off halfway through for me. I'm trying to recreate it now according to what your script calls for. I'm having some trouble and I'm sure it's something small n stupid I'm missing. Share this post Link to post Share on other sites
DCurrahee 0 Posted April 22, 2006 Great job man! These scripts clear up a lot of trouble I've always had with trying to get bombing runs more dynamic. What I always have trouble with is trying to release the bomb in front of the target and use setvelocity to guide the bomb in an arc down to the target. I don't want 100% accuracy and am always after the more 'traditional' bomber. Especially since a laser guider bomb would be dropped from altitude, and I love the way you get this plane to dive at the target. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? _distanceC <= 500 : _atWP = true <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_number = 3 _counter = 0 #pickle ; drop the bomb when over the target. _bomb = "LaserGuidedBomb" camcreate [getPos _aircraft select 0, getPos _aircraft select 1, (getPos _aircraft select 2)-5] _bomb setVelocity [(velocity _aircraft select 0),(velocity _aircraft select 1),0] _counter = _counter + 1 ~0.2 ? _number > _counter : goto "pickle" So i create the bomb at the position of the plane, with the planes velocity. This of course then needs to be tweaked for the altitude the aircracft is flying at. Except no matter what kind of odd math formulae I try to come up with I can never get it and any better then just this. I tweak and tweak and end up just makng it worse and worse it seems. I don't think it's really possible to do this? Since the AI would have to have a velocity that carries the bombs on target. If there was some way to find the needed bomb trajectory, and then if the plane ever crosses that path to release them. ... I don't know ... any ideas? Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 22, 2006 ***sample mission for the fixedWingASMLaser1.1.sqm and fixedWingLaser1.1.sqm scripts above. Moved here due to max message lenght limit. mission.sqm everon mission, be sure turn on markers in the editor to see everything. <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[]= { "LaserGuided", "OH58", }; addOnsAuto[]= { "OH58", "LaserGuided" }; randomSeed=7874563; class Intel { resistanceEast=1.000000; }; class Groups { items=22; class Item0 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={4560.954590,13.671191,12383.697266}; id=4; side="WEST"; vehicle="OfficerW"; leader=1; skill=1.000000; }; }; }; class Item1 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={4552.893555,133.028656,7279.747559}; azimut=90.000000; special="FLY"; id=5; side="WEST"; vehicle="OH58"; leader=1; rank="COLONEL"; skill=0.200000; }; }; }; class Item2 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={5103.844238,45.116009,4183.262207}; azimut=904.385986; id=10; side="WEST"; vehicle="SoldierWSaboteurLaser"; leader=1; skill=1.000000; }; }; class Waypoints { items=1; class Item0 { position[]={5103.816406,45.081703,4183.016602}; combatMode="BLUE"; combat="STEALTH"; class Effects { }; showWP="NEVER"; }; }; }; class Item3 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={5162.763672,16.334999,3920.458496}; azimut=-309.229004; id=12; side="EAST"; vehicle="T80"; leader=1; rank="LIEUTNANT"; skill=0.600000; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; }; }; class Item4 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={5198.876953,17.989479,4035.550781}; azimut=60.404499; id=16; side="EAST"; vehicle="T72"; leader=1; rank="LIEUTNANT"; skill=0.600000; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; }; }; class Item5 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4843.792480,16.334999,3994.100342}; azimut=-36.750000; id=22; side="EAST"; vehicle="T72"; leader=1; rank="CORPORAL"; skill=0.333333; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; }; }; class Item6 { side="EAST"; class Vehicles { items=9; class Item0 { position[]={5533.635742,35.905758,4003.853760}; id=23; side="EAST"; vehicle="OfficerE"; leader=1; rank="SERGEANT"; skill=0.466667; }; class Item1 { position[]={5536.635742,35.532982,3998.853760}; id=24; side="EAST"; vehicle="SoldierEMG"; rank="CORPORAL"; skill=0.333333; }; class Item2 { position[]={5538.635742,35.462780,3998.853760}; id=25; side="EAST"; vehicle="SoldierEG"; rank="CORPORAL"; skill=0.333333; }; class Item3 { position[]={5540.635742,35.392578,3998.853760}; id=26; side="EAST"; vehicle="SoldierEB"; rank="CORPORAL"; skill=0.333333; }; class Item4 { position[]={5542.635742,35.322376,3998.853760}; id=27; side="EAST"; vehicle="SoldierELAW"; rank="CORPORAL"; skill=0.333333; }; class Item5 { position[]={5544.635742,35.252174,3998.853760}; id=28; side="EAST"; vehicle="SoldierEMG"; skill=0.200000; }; class Item6 { position[]={5546.635742,35.181984,3998.853760}; id=29; side="EAST"; vehicle="SoldierEB"; skill=0.200000; }; class Item7 { position[]={5548.635742,35.111782,3998.853760}; id=30; side="EAST"; vehicle="SoldierEB"; skill=0.200000; }; class Item8 { position[]={5550.635742,35.037006,3998.853760}; id=31; side="EAST"; vehicle="SoldierEB"; skill=0.200000; }; }; class Waypoints { items=1; class Item0 { position[]={5533.635742,35.905758,4003.853760}; id=23; combatMode="RED"; combat="COMBAT"; class Effects { }; showWP="NEVER"; }; }; }; class Item7 { side="EAST"; class Vehicles { items=9; class Item0 { position[]={5009.079590,16.334999,3938.372559}; id=32; side="EAST"; vehicle="OfficerE"; leader=1; rank="SERGEANT"; skill=0.466667; }; class Item1 { position[]={5012.079590,16.334999,3933.372559}; id=33; side="EAST"; vehicle="SoldierEMG"; rank="CORPORAL"; skill=0.333333; }; class Item2 { position[]={5014.079590,16.334999,3933.372559}; id=34; side="EAST"; vehicle="SoldierEG"; rank="CORPORAL"; skill=0.333333; }; class Item3 { position[]={5016.079590,16.334999,3933.372559}; id=35; side="EAST"; vehicle="SoldierEB"; rank="CORPORAL"; skill=0.333333; }; class Item4 { position[]={5018.079590,16.334999,3933.372559}; id=36; side="EAST"; vehicle="SoldierELAW"; rank="CORPORAL"; skill=0.333333; }; class Item5 { position[]={5020.079590,16.334999,3933.372559}; id=37; side="EAST"; vehicle="SoldierEMG"; skill=0.200000; }; class Item6 { position[]={5022.079590,16.334999,3933.372559}; id=38; side="EAST"; vehicle="SoldierEB"; skill=0.200000; }; class Item7 { position[]={5024.079590,16.334999,3933.372559}; id=39; side="EAST"; vehicle="SoldierEB"; skill=0.200000; }; class Item8 { position[]={5026.079590,16.334999,3933.372559}; id=40; side="EAST"; vehicle="SoldierEB"; skill=0.200000; }; }; class Waypoints { items=1; class Item0 { position[]={5011.540039,16.334999,3938.900879}; combatMode="BLUE"; speed="LIMITED"; combat="CARELESS"; class Effects { }; showWP="NEVER"; }; }; }; class Item8 { side="EAST"; class Vehicles { items=9; class Item0 { position[]={4694.042969,22.511713,4093.783691}; id=41; side="EAST"; vehicle="OfficerE"; leader=1; rank="SERGEANT"; skill=0.466667; }; class Item1 { position[]={4697.042969,21.352406,4088.783691}; id=42; side="EAST"; vehicle="SoldierEMG"; rank="CORPORAL"; skill=0.333333; }; class Item2 { position[]={4699.042969,20.978598,4088.783691}; id=43; side="EAST"; vehicle="SoldierEG"; rank="CORPORAL"; skill=0.333333; }; class Item3 { position[]={4701.042969,20.766315,4088.783691}; id=44; side="EAST"; vehicle="SoldierEB"; rank="CORPORAL"; skill=0.333333; }; class Item4 { position[]={4703.042969,20.668741,4088.783691}; id=45; side="EAST"; vehicle="SoldierELAW"; rank="CORPORAL"; skill=0.333333; }; class Item5 { position[]={4705.042969,20.571167,4088.783691}; id=46; side="EAST"; vehicle="SoldierEMG"; skill=0.200000; }; class Item6 { position[]={4707.042969,20.473612,4088.783691}; id=47; side="EAST"; vehicle="SoldierEB"; skill=0.200000; }; class Item7 { position[]={4709.042969,20.376038,4088.783691}; id=48; side="EAST"; vehicle="SoldierEB"; skill=0.200000; }; class Item8 { position[]={4711.042969,20.278461,4088.783691}; id=49; side="EAST"; vehicle="SoldierEB"; skill=0.200000; }; }; class Waypoints { items=1; class Item0 { position[]={4696.825684,20.524586,4082.154053}; combatMode="RED"; combat="COMBAT"; class Effects { }; showWP="NEVER"; }; }; }; class Item9 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={5007.652832,16.334999,3953.294434}; azimut=-113.764000; id=50; side="EAST"; vehicle="ZSU"; leader=1; skill=1.000000; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; }; }; class Item10 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={5298.869629,22.642403,3966.412354}; azimut=35.012299; id=15; side="EAST"; vehicle="T72"; leader=1; rank="CAPTAIN"; skill=0.733333; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; }; }; class Item11 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={5315.377930,20.857853,3955.555420}; azimut=60.404499; id=17; side="EAST"; vehicle="T72"; leader=1; rank="LIEUTNANT"; skill=0.600000; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; }; }; class Item12 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={5141.754883,16.334999,4048.445313}; azimut=71.203598; id=18; side="EAST"; vehicle="T72"; leader=1; rank="CORPORAL"; skill=0.333333; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; }; }; class Item13 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4780.148438,16.334999,3978.690674}; azimut=-81.850502; id=20; side="EAST"; vehicle="T72"; leader=1; rank="LIEUTNANT"; skill=0.600000; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; }; }; class Item14 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4957.295898,47.011402,4268.202637}; azimut=-59.095001; id=19; side="EAST"; vehicle="T72"; leader=1; rank="CAPTAIN"; skill=0.733333; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; }; }; class Item15 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4922.097168,42.410103,4247.230469}; azimut=-41.658901; id=21; side="EAST"; vehicle="T72"; leader=1; rank="LIEUTNANT"; skill=0.600000; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; }; }; class Item16 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4955.345703,16.334999,3984.023438}; azimut=-53.265099; id=14; side="EAST"; vehicle="T80"; leader=1; rank="CORPORAL"; skill=0.333333; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; }; }; class Item17 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={4945.371582,16.334999,3952.692871}; azimut=-100.764000; id=13; side="EAST"; vehicle="T80"; leader=1; rank="LIEUTNANT"; skill=0.600000; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; }; }; class Item18 { side="EAST"; class Vehicles { items=1; class Item0 { position[]={5144.689453,16.334999,3990.276855}; azimut=48.852501; id=11; side="EAST"; vehicle="T80"; leader=1; rank="CAPTAIN"; skill=0.733333; init="[this, 0] exec ""stopmovingdangit.sqs"";"; }; }; }; class Item19 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={1132.235718,89.702469,11495.490234}; id=51; side="WEST"; vehicle="SoldierWB"; leader=1; skill=1.000000; init="groupAirSupport = group this"; }; }; }; class Item20 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={5049.434570,146.131348,6804.276855}; azimut=817.732971; id=52; side="WEST"; vehicle="SoldierWSaboteurLaser"; player="PLAYER COMMANDER"; leader=1; skill=1.000000; }; }; }; class Item21 { side="WEST"; class Vehicles { items=1; class Item0 { position[]={4741.345703,24.660000,11766.399414}; azimut=817.732971; id=54; side="WEST"; vehicle="SoldierWSaboteurLaser"; leader=1; skill=1.000000; }; }; }; }; class Vehicles { items=10; class Item0 { position[]={5246.059082,110.416626,6697.615234}; id=0; side="EMPTY"; vehicle="T80"; skill=1.000000; text="t2"; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; class Item1 { position[]={5336.880859,94.591873,6556.827148}; id=1; side="EMPTY"; vehicle="T80"; skill=1.000000; text="t1"; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; class Item2 { position[]={5250.796875,102.271034,6628.715332}; id=2; side="EMPTY"; vehicle="T80"; skill=1.000000; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; class Item3 { position[]={5355.709961,143.670090,6805.929688}; id=3; side="EMPTY"; vehicle="T80"; skill=1.000000; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; class Item4 { position[]={5167.070313,115.946228,6748.248535}; id=6; side="EMPTY"; vehicle="T80"; skill=1.000000; text="t3"; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; class Item5 { position[]={5292.216797,137.152069,6791.082520}; id=7; side="EMPTY"; vehicle="T80"; skill=1.000000; text="t1_1"; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; class Item6 { position[]={5314.982422,112.749512,6664.417969}; id=8; side="EMPTY"; vehicle="T80"; skill=1.000000; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; class Item7 { position[]={5176.418945,99.558868,6663.516113}; id=9; side="EMPTY"; vehicle="ZSU"; skill=1.000000; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; class Item8 { position[]={4861.938477,24.660000,11718.755859}; id=53; side="EMPTY"; vehicle="T80"; skill=1.000000; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; class Item9 { position[]={4324.033203,1.135712,16791.433594}; id=55; side="EMPTY"; vehicle="T80"; skill=1.000000; init="[this, 0] exec ""stopmovingdangit.sqs"""; }; }; class Markers { items=27; class Item0 { position[]={5383.245117,64.114777,5871.656738}; name="attackTarget"; type="Empty"; }; class Item1 { position[]={6394.555176,1.295366,12034.335938}; name="asdf"; text="Notes:"; type="Flag"; colorName="ColorBlack"; a=0.000000; b=0.000000; }; class Item2 { position[]={6653.941406,1.577000,11777.271484}; name="asdfasdf_6_1"; text="limited by using a smaller radius trigger"; type="Dot"; colorName="ColorBlack"; a=0.000000; b=0.000000; }; class Item3 { position[]={6660.921387,1.505407,10635.197266}; name="asdfasdf_6_5"; text="the enemy material from flying too far when"; type="Dot"; colorName="ColorBlack"; a=0.000000; b=0.000000; }; class Item4 { position[]={6400.549805,1.577000,11268.968750}; name="asdfasdf_6_7"; text="There must be a hidden man with a group name"; type="Dot"; colorName="ColorBlack"; }; class Item5 { position[]={6404.492676,1.577000,11396.835938}; name="asdfasdf_6_8"; text="Please note the NW Island"; type="Dot"; colorName="ColorBlack"; }; class Item6 { position[]={6406.273926,1.577000,11902.794922}; name="asdfasdf_6_11"; text="Acceptable area for laser designation can be"; type="Dot"; colorName="ColorBlack"; }; class Item7 { position[]={6656.679688,1.577000,11641.999023}; name="asdfasdf_6_13"; text="to get the list"; type="Dot"; colorName="ColorBlack"; a=0.000000; b=0.000000; }; class Item8 { position[]={6656.776367,1.577000,11134.444336}; name="asdfasdf_6_16"; text="in the mission for the script to work"; type="Dot"; colorName="ColorBlack"; a=0.000000; b=0.000000; }; class Item9 { position[]={4932.063965,19.172930,4110.956543}; name="LiveFireArea"; text="Live Fire Area"; type="Flag"; colorName="ColorRed"; a=0.000000; b=0.000000; }; class Item10 { position[]={5121.515137,16.334999,4069.835449}; name="LiveFireArea_1"; text="0"; markerType="ELLIPSE"; type="Flag"; colorName="ColorRedAlpha"; a=500.000000; b=500.000000; }; class Item11 { position[]={5063.048340,128.085342,6722.431152}; name="dummyTargetArea"; text="Dummy Target Area"; type="Flag"; colorName="ColorGreen"; a=0.000000; b=0.000000; }; class Item12 { position[]={5315.975098,113.374611,6665.440430}; name="dummyTargetArea_1"; text="0"; markerType="ELLIPSE"; type="Flag"; colorName="ColorGreenAlpha"; a=500.000000; b=500.000000; }; class Item13 { position[]={6662.936523,1.505407,10891.769531}; name="asdfasdf_6_5_1"; text="to designate the target"; type="Dot"; colorName="ColorBlack"; a=0.000000; b=0.000000; }; class Item14 { position[]={6406.530273,1.505407,10761.615234}; name="asdfasdf_6_5_2"; text="""stopmovingdangit.sqs"" is a little script to stop"; type="Dot"; colorName="ColorBlack"; }; class Item15 { position[]={6663.458008,1.505407,10508.947266}; name="asdfasdf_6_5_3"; text="hit by a LGB. In otherwords, a workaround"; type="Dot"; colorName="ColorBlack"; a=0.000000; b=0.000000; }; class Item16 { position[]={6402.001953,1.505407,11013.611328}; name="asdfasdf_6_5_4"; text="Both blackop(laser)s and the oh-58 can be used"; type="Dot"; colorName="ColorBlack"; }; class Item17 { position[]={6659.297363,1.505407,10384.120117}; name="asdfasdf_6_5_3_1"; text="for an OFP flaw."; type="Dot"; colorName="ColorBlack"; a=0.000000; b=0.000000; }; class Item18 { position[]={6660.920898,1.505407,10127.399414}; name="asdfasdf_6_5_5"; text="this is due to a limitation of the OFP engine,"; type="Dot"; colorName="ColorBlack"; a=0.000000; b=0.000000; }; class Item19 { position[]={6406.529785,1.505407,10253.817383}; name="asdfasdf_6_5_2_1"; text="Only vehicles can be designated as ASM targets"; type="Dot"; colorName="ColorBlack"; }; class Item20 { position[]={6663.457520,1.505407,10001.149414}; name="asdfasdf_6_5_3_2"; text="and there's nothing I can think of to do about"; type="Dot"; colorName="ColorBlack"; a=0.000000; b=0.000000; }; class Item21 { position[]={6659.296875,1.505407,9876.322266}; name="asdfasdf_6_5_3_1_1"; text="it. The script filters out targets that won't"; type="Dot"; colorName="ColorBlack"; a=0.000000; b=0.000000; }; class Item22 { position[]={6662.987305,1.505407,9743.466797}; name="asdfasdf_6_5_3_1_1_1"; text="work automatically"; type="Dot"; colorName="ColorBlack"; a=0.000000; b=0.000000; }; class Item23 { position[]={6660.920898,1.505407,9477.326172}; name="asdfasdf_6_5_5_1"; text="buildings, people, etc, use the LGB version"; type="Dot"; colorName="ColorBlack"; a=0.000000; b=0.000000; }; class Item24 { position[]={6406.529785,10.631971,9603.744141}; name="asdfasdf_6_5_2_1_1"; text="If you really wish to have the player designate"; type="Dot"; colorName="ColorBlack"; }; class Item25 { position[]={4525.143066,27.941410,11795.108398}; name="OutOfTargetAreaTest"; text="Out Of Target Area Test"; type="Flag"; colorName="MAP_blau1"; a=0.000000; b=0.000000; }; class Item26 { position[]={4833.839355,24.660000,11727.486328}; name="dummyTargetArea_1_1"; text="0"; markerType="ELLIPSE"; type="Flag"; colorName="ColorBlue"; a=500.000000; b=500.000000; }; }; class Sensors { items=4; class Item0 { position[]={5355.032715,76.182793,5628.857422}; a=2000.000000; b=2000.000000; rectangular=1; activationBy="ANY"; repeating=1; age="UNKNOWN"; text="FWAS_TargetList"; name="FWAS_TargetList"; class Effects { }; }; class Item1 { position[]={5528.854004,85.538116,5881.415527}; a=0.000000; b=0.000000; activationBy="ALPHA"; repeating=1; age="UNKNOWN"; text="Strike - A10 ASM"; expActiv="[5, list FWAS_TargetList, list FWAS_PilotList, ""attackTarget"", ""w"", ""ne"", 50, groupAirSupport, ""A10"", ""SoldierWPilot"", ""MaverickLauncher"", ""MaverickLauncher""] Exec ""fixedWingASMLaser1.1.sqs"""; class Effects { }; }; class Item2 { position[]={5582.584473,94.296593,5882.154297}; a=0.000000; b=0.000000; activationBy="BRAVO"; repeating=1; age="UNKNOWN"; text="Strike - A10 LGB"; expActiv="[5, list FWAS_TargetList, list FWAS_PilotList, ""attackTarget"", ""w"", ""ne"", 50, groupAirSupport, ""A10LGB"", ""SoldierWPilot""] Exec ""fixedWingLaser1.1.sqs"""; class Effects { }; }; class Item3 { position[]={1139.104858,89.476242,11492.824219}; a=500.000000; b=500.000000; rectangular=1; activationBy="ANY"; repeating=1; age="UNKNOWN"; text="FWAS_PilotList"; name="FWAS_PilotList"; class Effects { }; }; }; }; class Intro { randomSeed=11453955; class Intel { }; }; class OutroWin { randomSeed=13874179; class Intel { }; }; class OutroLoose { randomSeed=14005251; class Intel { }; }; Share this post Link to post Share on other sites
ColonelSandersLite 0 Posted April 22, 2006 Great job man! These scripts clear up a lot of trouble I've always had with trying to get bombing runs more dynamic. What I always have trouble with is trying to release the bomb in front of the target and use setvelocity to guide the bomb in an arc down to the target. I don't want 100% accuracy and am always after the more 'traditional' bomber. Especially since a laser guider bomb would be dropped from altitude, and I love the way you get this plane to dive at the target. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? _distanceC <= 500 : _atWP = true <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_number = 3 _counter = 0 #pickle ; drop the bomb when over the target. _bomb = "LaserGuidedBomb" camcreate [getPos _aircraft select 0, getPos _aircraft select 1, (getPos _aircraft select 2)-5] _bomb setVelocity [(velocity _aircraft select 0),(velocity _aircraft select 1),0] _counter = _counter + 1 ~0.2 ? _number > _counter : goto "pickle" So i create the bomb at the position of the plane, with the planes velocity. This of course then needs to be tweaked for the altitude the aircracft is flying at. Except no matter what kind of odd math formulae I try to come up with I can never get it and any better then just this. I tweak and tweak and end up just makng it worse and worse it seems. I don't think it's really possible to do this? Since the AI would have to have a velocity that carries the bombs on target. If there was some way to find the needed bomb trajectory, and then if the plane ever crosses that path to release them. ... I don't know ... any ideas? Ok, this can probably be done, but there are snags that have to be worked around. Due to the somewhat crappy nature of the ofp AI's piloting ability, you'd have to constantly loop and set the aircraft so it always points at the target. You would also have to constantly set the velocity and height of the aircraft to eliminate potential problems with inconsistancy. Due to OFP's non newtonian physics engine (ever seen a tank fly 500 yards through the air?), you would have to do a looping set velocity to get the bomb trajectory right. The catch is that there is a LOT of math that needs to be done in the script to get this to work correctly and versatilly. It would be realitively simple if we where talking about a fixed direction approach path, fixed ordanance type, fixed altitude, and fixed speed. I just don't do that though. If you like, I'll work on doing this after 1: I'm putting together the framework for a mission right now. Once I have the rough draft done, I'll be happy with it for a little while. 2: I still have a few scripts that funnyguy1 wanted done. Share this post Link to post Share on other sites
DCurrahee 0 Posted April 22, 2006 If you're ever bored! I've tried the math, seems like every year I try to get this to work. I've tried the loop to set the velocity. After about 3 days I get bored of trying and like I said what I tried above works as good as what I come up with. I've long fed my OFP addiction because of the people who've contributed their scripts. Work on whatever you want, I thank you for contributing and maybe I'll try to help out more too. And yes I've seen tanks fly. One of the first little stupid things I found myself doing within OFP was putting a bunch of small cars several hundred yards from a city and then bombarding the city with satchel charged flying cars. Share this post Link to post Share on other sites