Jump to content

SNAFU

Members
  • Posts

    772
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by SNAFU

  1. Hi Midnight, I took a look at your miz and rearranged the trigger slightly to the way I am used to. For the BDU targets: They need to be units and have the unitname "target1","target2" etc, not static. ;) But I also made one version, in which the aimpoint is a zone center, might be better for your puropose. You just place the zone with the name "target" over the static position and voila. I attached the script below, that might suite your purpose better. To the random traffic: Airfield Lochini is named Tbilisi-Lochini, that was the bug. Thought is was otherwise, but good to know. ;) I attached the modified miz below, so you can see what I mean. BDUIndicatorZone.lua Tbilisi ILS Training - MP1 Day_snafumod.miz
  2. I wrote a little script for practicing with BDU-50LD/HD bombs. This script indicates the BDU hit in relation to you attack path and the target, therefore it prints out: -total off in m -how far short or long in m -how far to left or right in m The target unit to drop your BDUs on is marked with a green flare every 5 seconds. After one drop the next unit with the name "target(n)" (n=1,2,..) will be marked with flares But you need MIST2.0 and have to place units in the ME with the names "target1", "target2"... I found it helpfull in practicing bomb deliveries, so someone might agree. ;) Ah, btw works also with WP rockets. PS: The second file with the name BDUIndicatorMultipleZones_v1.lua uses triggerzones as target and prints out the weapon impact in relation to the closest triggerzone with the name "target1", "target2",... BDUIndicatorMultipleTargets.lua BDUIndicatorMultipleZones_v1.lua
  3. Don´t know if it works, but you could try following: do player1 = 'test' -- playerunitname local _player = Unit.getByName(player1) local _playergroup = _player:getGroup() local _playerid = _playergroup:getID() function SpawnSmoke(player1) local _player = Unit.getByName(player1) local _smokepos = _player:getPosition().p trigger.action.smoke({x=_smokepos.x + math.random(5,10), y= land.getHeight({x = _smokepos.x, y = _smokepos.z}), z=_smokepos.z + math.random(5,10)}, trigger.smokeColor.Green) end missionCommands.addCommandForGroup(_playerid, "Drop smoke", nil, SpawnSmoke, player1) end
  4. Huh, I guess winter is the best time of the year for that trip? Only travelled the Karoo once, think it was '97, never made it up that far north, so it`s still on my todo list... ;) Let me know, if it works.
  5. Basically yes, but due to the fact that the functions need to be called in a certain order (spawn - give route - check if idle) I had troubles with randomizing the interval value. I need to generate a new random value after every cycle, looks easy, but I have to stop the cycle in between, because I got difficulties changing the value, while the function is active. So all the intervalls got mixed up. If I have some time I can look further into this, but so far it is not so important methinks. Yes, I have to call the functions on a different way, but as this is just scenery enhancement... Will do, but not today, as I am not home. 1. Download Speed&Grimes MIST 2.0 script collection 2. Open your mission in the mission editor 3. Open the trigger page 4. Below you find a row with which you initialize the MIST 2.0 file 5. Choose airfield nr 1 you want to have traffic on, place a trigger zone with the name "airfield1" over the airfield. Write the name of the airfield, in the script in line 12 6. Choose airfield nr 2 you want to have traffic on, place a trigger zone with the name "airfield2" over the airfield. Write the name of the airfield, in the script in line 13 7. Choose airfield nr 3 you want to have traffic on, place a trigger zone with the name "airfield3" over the airfield. Write the name of the airfield, in the script in line 14 8. Place a triggerzone called "airlanehub1" somewhere on the map. The radius of the zone defines the spread of points the planes will fly to after take off. (They take off fly to a random point in the zone and land at a random airfield (1-3)) 9. Create a "Once->Time more than 1 seconds -> Do script file (load the script)" Trigger 10. Start the mission You can edit the script randomization in a way, that you only spawn planes of certain nations or types in lines 26-28. "math.random(x,y)" means it chooses a random value in the range of [x,y], so if you edit x and y you can define the range aircrafttypes and therefore nations, because every type is only available for one nation, except a few like Uh-1, Mi-8, Yak-40 and the like. In line 10 you can edit the spawnintervall, if you feel the map gets too crowded, or you want to have more traffic.
  6. Thanks for the communication, good to have something looking forward to. Most curious concerning multiplayer option / crew too. IMHO this (multiple players in one huey) would make the Huey the best module of DCS so far.
  7. Yes, the functions are repeated with the mist.scheduleFunction and "intervall" sets the time-intervall it is repeated. The single functions are scheduled with an offset, because the mist.goRoute function needs existing units to work and therefore I have to spawn the units, before I can give them a route. I am also looking for a way to randomise the spawn intervall more than just once in the beginning, but havent´t figured out a working path so far. 300 seconds minimum might be a little too low intervall and mission might get crowded too fast. Than the intervall must be set to lower a frequenzy.
  8. @Midnight: Another thought I had, is Tbilisi-Lochini should be AF Id 29, might also be just called "Lochini". If you uncomment the line --trigger.action.outText(string.format(AF1ID).."-" ..string.format(AF2ID).."-" ..string.format(AF3ID),10) By deleting the "--" in the beginning the aifield IDs should be displayed, when the script is loaded. If there is something wrong with this, you should find out this way. This should be the airdrome IDs: 0 Airdrome_0 1 Khersones 2 Saki 3 Simpheropol 4 Razdolnoe 5 Dzhankoy 6 Kirovskoe 7 Kerch 8 Belbek 9 Krasnogvardeyskoye 10 Octyabrskoe 11 Gvardeyskoe 12 Anapa 13 Krasnodar 14 Novorossiysk 15 Krymsk 16 Maykop 17 Gelendzhik 18 Sochi 19 Krasnodar_P 20 Sukhumi 21 Gudauta 22 Batumi 23 Tskhakaya 24 Kobuleti 25 Kutaisi 26 MinVody 27 Nalchik 28 Mozdok 29 Lochini 30 TbilisiMilitary 31 Vaziani 32 Beslan
  9. Methinks as glider pilot you experience the best of freedom you can get in aviation. But even as glider pilot you have to ask for permission for almost anything you, outside your given room. At least in Europe - in the US or other less restricted airspaces it might be different. But that was the reason I stopped flying glider planes and went back to sailing boats - the only room for being free are the seas and big streams in my opinion. ;)
  10. Hi Midnight, Following questions come into my mind: Did you also placed triggerzones with the corresponding zone names 'airfield1' (over Tbilisi-Lochini), 'airfield2' (over Beslan) and 'airfield3' over Kutaisi? Additionally it requires a Waypoint to be generated by placing a trigger zone calles 'airlanehub1'. Prior to loading the script, Mist2.0 needs to be intialized. Did you get an error message? Did you check the airfield names? If you click on the airfield in ME, a field appears with the ressource manager window, from which you can also copy and paste the airfield name. Do you have other scripts in the mission? If so, do they also use varaibles as "groupcounter"? (This can be a variable also used in other scripts, so you might need to rename the "groupcounter" to "_groupcounter" or something by using the Notepad++ replace function (ctrl+h))
  11. Schön übersichtliche Zusammenfassung. :thumbup: Ergänzend zu tinifaxl, ist eine GBU12 nicht eine Mk82 mit Laserlenkung?
  12. This is my attempt to script random AI airtraffic at airfields. This script generates AI airplanes and helicopters of all available type (except P51,F190, F-117) at 3 airfields. The aircraft startup, takeoff and fly to a random point inside a zone and return to one of the 3 airfields randomly, which are to be defined in the ME and in the script. After landing and shutting down, the aircraft despawn. Also after an traffic accident on the taxi or runway, the aircraft will be removed. Every aircraft will have its own weapon loadout and skin. Fighter and bomber will fly as two-ship formation, helicopter, recon, transport will fly solo. For warning the player of AI activity around, the aircraft will trigger messages to the coalition it belongs to, reflecting the phase of the procedure the craft is in. As example an RFF IL78M spawned on Kutiasi: "Kutaisi, RFF5897, IL-78M, taxiing to active runway!" [unit spawned on Apron] "Kutaisi, RFF5897, departing active runway and leaving control zone!" [(2nd of Flight) Unit started takeoff roll] "Kutaisi, RFF5897, airborne" [ (2nd of Flight) Unit is 15m above ground] "Kutaisi, RFF5897, is bearing: 308 for 3 nautical miles at altitude 1800, leaving control zone." [(2nd of Flight) Unit leaves triggerzone you have to set in the ME around airfield] "Tbilisi-West, RFF5897, is N42,125 - E 042,045 at altitude 20000, checking in." [(1st of Flight)Unit enters triggerzone "trafficzone"] "Kobuleti, RFF5897, is bearing: 102 for 3 nautical miles at altitude 2000, for landing." [(1st of Flight) Unit enters triggerzone you have to set in the ME around airfield] "Kobuleti, RFF5897, on final!" [(1st of Flight) Unit is lower than 500m above ground] "Kobuleti, RFF5897, touchdown!" [(2nd of Flight) Unit is lower than 15m above ground] "Kobuleti, RFF5897, runway vacated!" [(2nd of Flight) Unit is not moving anymore and taken out of game] The nations are set to Russia, Georgia, USA, UK, Germany, France and Netherlands, so if you want deconflict according to your coalition setup, you have to edit the script in line 26-28: randomAirplane = math.random(1,18) -- random for airplanettype; Russian AC 10-18 , for russion only set (10,18), or otherwise for other nations randomHeli = math.random(1,18) --Russian AC 13-18, for russion only set (13,18), or otherwise for other nations randomFighter = math.random(1,36) --Russian AC 18-36, for russion only set (18,36), or otherwise for other nations In line 10 the spawnintervall can be set: intervall = math.random(300,900) --(x,y) minimum x seconds, max. y seconds You have define 4 zones in the ME in order to implement the script. Zones "airfield1" to "airfield3" (the name must be exact this) mus lie over the 3 airfields on which the traffic shall be generated. According to this zones you have to write the name of the corresponding airfield into the script in the lines 12-14. Zone 4 must be named "trafficzone". This is the zone which defines the random waypoint to which the aircraft will fly after takeoff. The radius defines the spread. Triggerzones to be set in the ME: Zone 1. "Name-of-airfield-AF1-as-in-script line 12" <- defines one of the airfields Zone 2. "Name-of-airfield-AF2-as-in-script line 13", <- defines one of the airfields Zone 3. "Name-of-airfield-AF3-as-in-script line 14" <- defines one of the airfields Zone 4."trafficzone" <- defines the waypoint spread between takeoff and landing in zone 1-3. Note this is version 6 and requires MIST2.0 or newer Any feedback, ideas, bug hints etc welcome! Note that I am no programmer, so this script is not really efficient I guess, but it worked. PS: 1. Updated to v4, fixed some issues with other scripts, when random AI planes was destroyed. 2. Updated to v5, some issue with despawning is hopefully fixed 3. Updated r6, fixing issues with removal of landed flights in combination with other scripts. 4. Update currently no tested version at hand, will upload one asap 5. Uploaded MIST3_2_RandAirtraffic_r5.lua and example *.miz file (miz file including a script simulating autonomous GCI / CAP AI in final testing) 6. Added radio transmissions (text message to coalition the aircraft belongs to) and reworked clean up part of script, to remove idle or damaged planes MIST3_2_RandAirtraffic_r5.lua randomairtraffic_scripttest.miz MIST3_2_RandAirtraffic_r6.lua
  13. Hier eine neue Version, die an 3 Flugfelder zufälligen Verkehr erzeugt. Zufällige Flugzeuge und Helikopter spawnen, starten, fliegen zu einem zufälligen Punkt in einer Zone und landen an einem anderen Flugfeld wieder. Jäger und Bomber fliegen als 2er Formation, ansonsten sind alle Fluggeräte mit Skin und Waffenladung im Pool (ausnahme P51,Fw190, F-117). Nach dem der Flieger seine Maschinen runtergefahren hat, wird er von der Karte entfernt. Auch wenn es zu einem Unfall auf der Bahn kommt, wird der Flieger entfernt, so daß Staus vermieden werden sollten. Die vertretenen Nationen bestehen aus Russland, Georgrien, USA, UK, France, Germany und Niederland. Um Komplikation mit Flugabwehr zu vermeiden, sollten im Skript die folgenden Parameter in Zeile 26-28 editiert werden. randomAirplane = math.random(1,18) -- random for airplanettype; Russian AC 10-18 , for russion only set (10,18), or otherwise for other nations randomHeli = math.random(1,18) --Russian AC 13-18, for russion only set (13,18), or otherwise for other nations randomFighter = math.random(1,36) --Russian AC 18-36, for russion only set (18,36), or otherwise for other nations In Zeile 10 kann die Spawnintervallzeit editiert werden: intervall = math.random(300,900) --(x,y) minimum x seconds, max. y seconds Dafür muß allerdings im ME 4 Triggerzonen gesetzt werden und in dem Skript in Zeilen 12-14, die Namen der Flugplätze entsprechen den Zonen 1-3 eingetragen werden. 3 Zonen müßen über den Flugplätzen liegen, dessen Namen in entsprechender Reihenfolge im Skript eingetragen wurden. Zone 1. "airfield1", Zone 2. "airfield2", Zone 3. "airfield3" bestimmen die 3 Flugplätze wo der Verkehr erzeugt wird, während die Zone 4. "airlanehub1" den Bereich bestimmt, welchen die Flieger anfliegen, bevor sie wieder auf einem Flugplatz landen. Achja, das ganze benötigt wieder "MIST2.0". RandAT3AF_v1.zip
  14. So, hier mal ein einfaches Skript (nicht schön aber es funktioniert), welches zufälligen Luftverkehr durch mehrstrahlige Transporter, Aufklärer, Tanker, AWACS etc an 3 Flugplätzen generiert. In gewissen Abständen spawnt ein zufälliges Flugzeugmuster an einem der 3 Plätze, startet und fliegt in einem Bereich einen zufälligen Punkt an und landet an einem der 3 Flugplätze. Nach dem der Flieger seine Maschinen runtergefahren hat, wird er von der Karte entfernt. Auch wenn es zu einem Unfall auf der Bahn kommt, wird der Flieger entfernt, so daß Staus vermieden werden sollten. Dafür muß allerdings im ME 4 Triggerzonen gesetzt werden und in dem Skript, die Namen der Flugplätze eingetragen werden. 3 Zonen müßen über den Flugplätzen liegen, dessen Namen in entsprechender Reihenfolge im Skript eingetragen wurden. Zone 1. "airfield1", Zone 2. "airfield2", Zone 3. "airfield3" bestimmen die 3 Flugplätze wo der Verkehr erzeugt wird, während die Zone 4. "airlanehub1" den Bereich bestimmt, welchen die Flieger anfliegen, bevor sie wieder auf einem Flugplatz landen. Das gleiche Skript wollte ich noch in kompatibler Version für Helis schreiben und für Fighter (Jäger, Bomber), das aber ein anderes mal. Achja, das ganze benötigt wieder "MIST2.0". RandSuppAT3AF_v1.zip
  15. Found the answer myself, finally ;) AF1 = 'Batumi' --Exact name of airfield with the zone "airfield1" AF2 = 'Kobuleti' --Exact name of airfield with the zone "airfield2" AF3 = 'Kutaisi' --Exact name of airfield with the zone "airfield3" AF1IDname = Airbase.getByName(AF1) AF1ID = AF1IDname:getID() AF2IDname = Airbase.getByName(AF2) AF2ID = AF2IDname:getID() AF3IDname = Airbase.getByName(AF3) AF3ID = AF3IDname:getID()
  16. Neverminde, I found a workaround: ClearApron = {}; function ClearApron:onEvent(event) if (world.event.S_EVENT_ENGINE_SHUTDOWN == event.id) then trigger.action.outText("EVENT1",10) --local arrivalgroup = event.initiator:getPoint() arrivalgroupname = event.initiator:getName() arrivalgroup = Group.getByName(arrivalgroupname) trigger.action.outText("EVENT2",20) end end; world.addEventHandler(ClearApron); function clear() if arrivalgroup ~= nil then arrivalgroup:destroy() end end mist.scheduleFunction(clear, {}, timer.getTime() + 5, 10)
  17. Does anybody have any idea, why this little script part is not working?: ClearApronHandler = {} function ClearApronHandler:onEvent(event) if (world.event.S_EVENT_ENGINE_SHUTDOWN == event.id) then local arrivalgroup = event.initator:getGroup() arrivalgroup:destroy() trigger.action.outText( " (" .. arrivalgroup .. ") removed", 7) end end; world.addEventHandler(ClearApronHandler) AI is not removed.
  18. Thank you 2, will do so. Just had the idea to enforce ROE with this by trying the event händler: ROEViolationHandler = {} function ROEViolationHandler:onEvent(event) if event.id == world.event.S_EVENT_SHOT then local ROEViolation = event.initator:getGroup() if ROEInForce == "Weapons Safe" then ROEViolation:destroy() end end end world.addEventHandler(ROEViolationHandler) And sorry Galwran for hijacking, but I thought my questions fit the thread.
  19. Mbot, would you then address the unit, which caused the event with somthing like: . . . if event.id == world.event.S_EVENT_SHOT then local wpnorigin = event.unit lcoal wpnorigingrp = wpnorigin:getGroup() . . . Would this in case of the event, set wpnorigingrp to the group, which caused the event?
  20. Depends on the specifications. If you say general g limit of the design is 1,5g, then it would limit also the acceleration I would say. But usually every axis has its own G-limit I would guess.
  21. With 1,5G max, it would need 80 seconds acceleration to get to 1200m/s?
  22. In addition: I tried to combine the functions in one script and the airplane spawns, but does not follow the waypoints of the mist.goRoute function. If I place and airplane in the ME and use the 2nd function the airplane follows the waypoints. How do I combine these 2 functions in one script, so the spawned aircraft follows the waypoints? I tried it this way: --Following trigger zones need to be placed in the ME: --1: Zone called 'airspawnzone1', which defines the area in which planes will airspawn --2: Zone called 'landingpoint', which includes the airport on which the planes will land --3: Zone called 'entrypoint1', which defines the entry/exit point of the airfield the planes are set to land or takeoff groupcounter = 0 function generateAirplanedata() randomnr1 = math.random(1,2) -- random for spawnpoints; 1=arrival, 2=depature randomnr2 = math.random(1,2) -- random for aircrafttype groupcounter = groupcounter + 1 if randomnr2 == 1 then _aircrafttype = "C-17A" else if randomnr2 == 2 then _aircrafttype = "Yak-40" end end if randomnr1 == 1 then _spawnairplane = trigger.misc.getZone('airspawnzone1') _spawnairplanepos = {} _spawnairplanepos.x = _spawnairplane.point.x + math.random(_spawnairplane.radius * -1, _spawnairplane.radius) _spawnairplanepos.z = _spawnairplane.point.z + math.random(_spawnairplane.radius * -1, _spawnairplane.radius) _alt = 6000 _speed = 250 _waypointtype = "Turning Point" _waypointaction = "Turning Point" _airdromeId = nil route = 'arrival' else if randomnr1 == 2 then _spawnairplane = trigger.misc.getZone('landingpoint') _spawnairplanepos = {} _spawnairplanepos.x = _spawnairplane.point.x + math.random(_spawnairplane.radius * -1, _spawnairplane.radius) _spawnairplanepos.z = _spawnairplane.point.z + math.random(_spawnairplane.radius * -1, _spawnairplane.radius) _alt = 88 _speed = 0 _waypointtype = "TakeOffParking" _waypointaction = "From Parking Area" _airdromeId = 24 route = 'departure' end end _airplanedata = { ["modulation"] = 0, ["tasks"] = { }, -- end of ["tasks"] ["task"] = "CAS", ["uncontrolled"] = false, ["route"] = { ["points"] = { [1] = { ["alt"] = _alt, ["type"] = _waypointtype, ["action"] = _waypointaction, ["alt_type"] = "BARO", ["formation_template"] = "", ["ETA"] = 0, ["airdromeId"] = _airdromeId, ["y"] = _spawnairplanepos.z, ["x"] = _spawnairplanepos.x, ["speed"] = _speed, ["ETA_locked"] = true, ["task"] = { ["id"] = "ComboTask", ["params"] = { ["tasks"] = { }, -- end of ["tasks"] }, -- end of ["params"] }, -- end of ["task"] ["speed_locked"] = true, }, -- end of [1] }, -- end of ["points"] }, -- end of ["route"] ["groupId"] = 1, ["hidden"] = false, ["units"] = { [1] = { ["alt"] = _alt, ["heading"] = 0, ["type"] = _aircrafttype, ["psi"] = 0, ["onboard_num"] = "10", ["parking"] = 19, ["y"] = _spawnairplanepos.z, ["x"] = _spawnairplanepos.x, ["name"] = string.format(groupcounter), ["payload"] = { }, -- end of ["payload"] ["speed"] = _speed, ["unitId"] = string.format(groupcounter), ["alt_type"] = "BARO", ["skill"] = "High", }, -- end of [1] }, -- end of ["units"] ["y"] = _spawnairplanepos.z, ["x"] = _spawnairplanepos.x, ["name"] = string.format(groupcounter), ["communication"] = true, ["start_time"] = 0, ["frequency"] = 124, } trigger.action.outText("airplane data generated", 3) coalition.addGroup(country.id.USA, Group.Category.AIRPLANE, _airplanedata) genericairtraffic = Group.getByName(string.format(groupcounter)) end generateAirplanedata() function goRoute() function generateWaypoints(_spawnairplane, _entrypoint1, _landingpoint1, waypointType) local waypoints = {} _spawnairplane = trigger.misc.getZone('airspawnzone1') _spawnairplanepos = {} _spawnairplanepos.x = _spawnairplane.point.x + math.random(_spawnairplane.radius * -1, _spawnairplane.radius) _spawnairplanepos.z = _spawnairplane.point.z + math.random(_spawnairplane.radius * -1, _spawnairplane.radius) _entrypoint1 = trigger.misc.getZone('entrypoint1') _entrypoint1pos = {} _entrypoint1pos.x = _entrypoint1.point.x + math.random(_entrypoint1.radius * -1, _entrypoint1.radius) _entrypoint1pos.z = _entrypoint1.point.z + math.random(_entrypoint1.radius * -1, _entrypoint1.radius) _landingpoint1 = trigger.misc.getZone('landingpoint') _landingpoint1pos = {} _landingpoint1pos.x = _landingpoint1.point.x + math.random(_landingpoint1.radius * -1, _landingpoint1.radius) _landingpoint1pos.z = _landingpoint1.point.z + math.random(_landingpoint1.radius * -1, _landingpoint1.radius) local startpoint1 = { ["alt"] = 6000, ["type"] = "Turning Point", ["action"] = "Turning Point", ["alt_type"] = "RADIO", ["formation_template"] = "", ["ETA"] = 0, ["y"] = _spawnairplanepos.z, ["x"] = _spawnairplanepos.x, ["speed"] = 250, ["ETA_locked"] = false, ["task"] = { ["id"] = "ComboTask", ["params"] = { ["tasks"] = { }, -- end of ["tasks"] }, -- end of ["params"] }, -- end of ["task"] ["speed_locked"] = true, } -- end of [1] local entrypoint1 = { ["alt"] = 3000, ["type"] = "Turning Point", ["action"] = "Turning Point", ["alt_type"] = "RADIO", ["formation_template"] = "", ["ETA"] = 0, ["y"] = _entrypoint1pos.z, ["x"] = _entrypoint1pos.x, ["speed"] = 250, ["ETA_locked"] = false, ["task"] = { ["id"] = "ComboTask", ["params"] = { ["tasks"] = { }, -- end of ["tasks"] }, -- end of ["params"] }, -- end of ["task"] ["speed_locked"] = true, } local landingpoint1 = { ["alt"] = 3000, ["type"] = "LAND", ["action"] = "Landing", ["alt_type"] = "RADIO", ["formation_template"] = "", ["ETA"] = 0, ["y"] = _landingpoint1pos.z, ["x"] = _landingpoint1pos.x, ["speed"] = 200, ["ETA_locked"] = false, ["task"] = { ["id"] = "ComboTask", ["params"] = { ["tasks"] = { }, -- end of ["tasks"] }, -- end of ["params"] }, -- end of ["task"] ["speed_locked"] = true, } local takeoffpoint = { ["alt"] = _alt, ["type"] = "TakeOffParking", ["action"] = "From Parking Area", ["alt_type"] = "RADIO", ["formation_template"] = "", ["ETA"] = 0, ["y"] = _landingpoint1pos.z, ["x"] = _landingpoint1pos.x, ["speed"] = 0, ["ETA_locked"] = false, ["task"] = { ["id"] = "ComboTask", ["params"] = { ["tasks"] = { }, -- end of ["tasks"] }, -- end of ["params"] }, -- end of ["task"] ["speed_locked"] = true, } if waypointType == 'arrival' then waypoints[#waypoints+1] = mist.fixedWing.buildWP(startpoint1, "Turning Point", 250, 3000, "RADIO") waypoints[#waypoints+1] = mist.fixedWing.buildWP(entrypoint1, "Turning Point", 250, 3000, "RADIO") waypoints[#waypoints+1] = mist.fixedWing.buildWP(landingpoint1, "LAND", 250, 3000, "RADIO") --string type, number speed, number altitude, string altitudeType else if waypointType == 'departure' then waypoints[#waypoints+1] = mist.fixedWing.buildWP(takeoffpoint, "TakeOffParking", 250, 3000, "RADIO") waypoints[#waypoints+1] = mist.fixedWing.buildWP(entrypoint1, "Turning Point", 250, 3000, "RADIO") waypoints[#waypoints+1] = mist.fixedWing.buildWP(startpoint1, "Turning Point", 250, 3000, "RADIO") waypoints[#waypoints+1] = mist.fixedWing.buildWP(entrypoint1, "Turning Point", 250, 3000, "RADIO") waypoints[#waypoints+1] = mist.fixedWing.buildWP(landingpoint1, "LAND", 250, 3000, "RADIO") --string type, number speed, number altitude, string altitudeType end end return waypoints end flightplan = generateWaypoints(_spawnairplane, _entrypoint1, _landingpoint1, route) --local genericairtraffic = Group.getByName(string.format(groupcounter)) mist.goRoute(genericairtraffic, flightplan) end goRoute()
  23. I could use some help with the mist.goRoute function. So far I have 2 functions, the first to generate a random airplane and spawn it randomly in a given zone. This function works fine and looks as following: groupcounter = 0 function generateAirplane() randomnr1 = math.random(1,2) -- random for spawnpoints; 1=arrival, 2=depature randomnr2 = math.random(1,2) -- random for aircrafttype groupcounter = groupcounter + 1 if randomnr2 == 1 then _aircrafttype = "C-17A" --or whatever type else if randomnr2 == 2 then _aircrafttype = "Yak-40" --or whatever type end end if randomnr1 == 1 then _spawnairplane = trigger.misc.getZone('airspawnzone1') _spawnairplanepos = {} _spawnairplanepos.x = _spawnairplane.point.x + math.random(_spawnairplane.radius * -1, _spawnairplane.radius) _spawnairplanepos.z = _spawnairplane.point.z + math.random(_spawnairplane.radius * -1, _spawnairplane.radius) _alt = 6000 _speed = 250 _waypointtype = "Turning Point" _waypointaction = "Turning Point" _airdromeId = nil route = 'arrival' else if randomnr1 == 2 then _spawnairplane = trigger.misc.getZone('landingpoint') _spawnairplanepos = {} _spawnairplanepos.x = _spawnairplane.point.x + math.random(_spawnairplane.radius * -1, _spawnairplane.radius) _spawnairplanepos.z = _spawnairplane.point.z + math.random(_spawnairplane.radius * -1, _spawnairplane.radius) _alt = 88 _speed = 0 _waypointtype = "TakeOffParking" _waypointaction = "From Parking Area" _airdromeId = 24 route = 'departure' end end _airplanedata = { ["modulation"] = 0, ["tasks"] = { }, -- end of ["tasks"] ["task"] = "CAS", ["uncontrolled"] = false, ["route"] = { ["points"] = { [1] = { ["alt"] = _alt, ["type"] = _waypointtype, ["action"] = _waypointaction, ["alt_type"] = "BARO", ["formation_template"] = "", ["ETA"] = 0, ["airdromeId"] = _airdromeId, ["y"] = _spawnairplanepos.z, ["x"] = _spawnairplanepos.x, ["speed"] = _speed, ["ETA_locked"] = true, ["task"] = { ["id"] = "ComboTask", ["params"] = { ["tasks"] = { }, -- end of ["tasks"] }, -- end of ["params"] }, -- end of ["task"] ["speed_locked"] = true, }, -- end of [1] }, -- end of ["points"] }, -- end of ["route"] ["groupId"] = 1, ["hidden"] = false, ["units"] = { [1] = { ["alt"] = _alt, ["heading"] = 0, ["type"] = _aircrafttype, ["psi"] = 0, ["onboard_num"] = "10", ["parking"] = 19, ["y"] = _spawnairplanepos.z, ["x"] = _spawnairplanepos.x, ["name"] = string.format(groupcounter), ["payload"] = { }, -- end of ["payload"] ["speed"] = _speed, ["unitId"] = string.format(groupcounter), ["alt_type"] = "BARO", ["skill"] = "High", }, -- end of [1] }, -- end of ["units"] ["y"] = _spawnairplanepos.z, ["x"] = _spawnairplanepos.x, ["name"] = string.format(groupcounter), ["communication"] = true, ["start_time"] = 0, ["frequency"] = 124, } trigger.action.outText("airplane data generated", 3) coalition.addGroup(country.id.USA, Group.Category.AIRPLANE, _airplanedata) trigger.action.outText("airplane spawned", 3) end generateAirplane() Then I have a second function, which creates waypoints in defined triggerzones and let an airplane follow these waypoints with the mist.goRoute function. This function works on its own, too, and looks like the following: groupcounter = 1 --airplanename = 1 route = 'departure' --waypoints set for departure, alternative 'arrival' function generateWaypoints(_spawnairplane, _entrypoint1, _landingpoint1, waypointType) local waypoints = {} _spawnairplane = trigger.misc.getZone('airspawnzone1') _spawnairplanepos = {} _spawnairplanepos.x = _spawnairplane.point.x + math.random(_spawnairplane.radius * -1, _spawnairplane.radius) _spawnairplanepos.z = _spawnairplane.point.z + math.random(_spawnairplane.radius * -1, _spawnairplane.radius) _entrypoint1 = trigger.misc.getZone('entrypoint1') _entrypoint1pos = {} _entrypoint1pos.x = _entrypoint1.point.x + math.random(_entrypoint1.radius * -1, _entrypoint1.radius) _entrypoint1pos.z = _entrypoint1.point.z + math.random(_entrypoint1.radius * -1, _entrypoint1.radius) _landingpoint1 = trigger.misc.getZone('landingpoint') _landingpoint1pos = {} _landingpoint1pos.x = _landingpoint1.point.x + math.random(_landingpoint1.radius * -1, _landingpoint1.radius) _landingpoint1pos.z = _landingpoint1.point.z + math.random(_landingpoint1.radius * -1, _landingpoint1.radius) local startpoint1 = { ["alt"] = 6000, ["type"] = "Turning Point", ["action"] = "Turning Point", ["alt_type"] = "RADIO", ["formation_template"] = "", ["ETA"] = 0, ["y"] = _spawnairplanepos.z, ["x"] = _spawnairplanepos.x, ["speed"] = 250, ["ETA_locked"] = false, ["task"] = { ["id"] = "ComboTask", ["params"] = { ["tasks"] = { }, -- end of ["tasks"] }, -- end of ["params"] }, -- end of ["task"] ["speed_locked"] = true, } -- end of [1] local entrypoint1 = { ["alt"] = 3000, ["type"] = "Turning Point", ["action"] = "Turning Point", ["alt_type"] = "RADIO", ["formation_template"] = "", ["ETA"] = 0, ["y"] = _entrypoint1pos.z, ["x"] = _entrypoint1pos.x, ["speed"] = 250, ["ETA_locked"] = false, ["task"] = { ["id"] = "ComboTask", ["params"] = { ["tasks"] = { }, -- end of ["tasks"] }, -- end of ["params"] }, -- end of ["task"] ["speed_locked"] = true, } local landingpoint1 = { ["alt"] = 3000, ["type"] = "LAND", ["action"] = "Landing", ["alt_type"] = "RADIO", ["formation_template"] = "", ["ETA"] = 0, ["y"] = _landingpoint1pos.z, ["x"] = _landingpoint1pos.x, ["speed"] = 200, ["ETA_locked"] = false, ["task"] = { ["id"] = "ComboTask", ["params"] = { ["tasks"] = { }, -- end of ["tasks"] }, -- end of ["params"] }, -- end of ["task"] ["speed_locked"] = true, } local takeoffpoint = { ["alt"] = _alt, ["type"] = "TakeOffParking", ["action"] = "From Parking Area", ["alt_type"] = "RADIO", ["formation_template"] = "", ["ETA"] = 0, ["y"] = _landingpoint1pos.z, ["x"] = _landingpoint1pos.x, ["speed"] = 0, ["ETA_locked"] = false, ["task"] = { ["id"] = "ComboTask", ["params"] = { ["tasks"] = { }, -- end of ["tasks"] }, -- end of ["params"] }, -- end of ["task"] ["speed_locked"] = true, } if waypointType == 'arrival' then waypoints[#waypoints+1] = mist.fixedWing.buildWP(startpoint1, "Turning Point", 250, 3000, "RADIO") waypoints[#waypoints+1] = mist.fixedWing.buildWP(entrypoint1, "Turning Point", 250, 3000, "RADIO") waypoints[#waypoints+1] = mist.fixedWing.buildWP(landingpoint1, "LAND", 250, 3000, "RADIO") --string type, number speed, number altitude, string altitudeType else if waypointType == 'departure' then waypoints[#waypoints+1] = mist.fixedWing.buildWP(takeoffpoint, "TakeOffParking", 250, 3000, "RADIO") waypoints[#waypoints+1] = mist.fixedWing.buildWP(entrypoint1, "Turning Point", 250, 3000, "RADIO") waypoints[#waypoints+1] = mist.fixedWing.buildWP(startpoint1, "Turning Point", 250, 3000, "RADIO") waypoints[#waypoints+1] = mist.fixedWing.buildWP(entrypoint1, "Turning Point", 250, 3000, "RADIO") waypoints[#waypoints+1] = mist.fixedWing.buildWP(landingpoint1, "LAND", 250, 3000, "RADIO") --string type, number speed, number altitude, string altitudeType end end return waypoints end flightplan = generateWaypoints(_spawnairplane, _entrypoint1, _landingpoint1, route) local airtraffic1grp = Group.getByName(string.format(groupcounter)) mist.goRoute(airtraffic1grp, flightplan) Each function function generateAirplane() and generateWaypoints(..) work on their own, but together they don`t. :helpsmilie:
  24. I guess you have already noted, but in case not, your group name is 991, not 911. Jsut stumbled over this topic, while looking for addGroup work arounds, so nevermind if this is obsolete.
  25. Huh, GA, would you mind giving us this in wallpaper size? ;)
×
×
  • Create New...