Jump to content

SNAFU

Members
  • Posts

    772
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by SNAFU

  1. Sounds good, so I can add the Huey WPs to my AFAC script.

     

    What I ve got so far you can see below, but note this is WIP, with the F/A-18C it works, still have to finish the text messages and work around the flow, but basically the main functions, which track the WPs and replace them by trigger smokes and let the AI drop on the marks work fine. Maybe you find some piece useful.

     

    PS: I will post the script again, when I finished it... some day...

    A10AFAC_v6.lua

  2. Nice!

     

    I also worked on an AFAC script combined with the F-10 menu, but for the A-10C. The A-10C AFA C can call in AI striker, give them an IP and after putting a mark with the WilliePete Rockets the AI flight will bomb the area where the smoke marker hit the ground. Combined with the 9 line text messages. Due to the fact that the smoke frome the WPs is not as visible as the trigger smoke, I destroy the WP before it explodes and put a trigger smoke on the position, where the WP hit the ground.

     

    I started the script some time ago, but could not finish it, yet due to lack of spare time, but maybe we can combine these 2 variants. Can the Huey also use some sort of WilliePetes or MarkerdRockets? So then I can integrate your variant in the A-10C AFAC script or ortherwise.

  3. I see you fellows are applying the script, due to real life I have little time available for scripting at the moment, but I guess you get along... ;)

     

    For an output in feet, you can simplifiy this by using:

     

    trigger.action.outText("Distance off: "..string.format(BombOffsetInt) .. "ft / Off left "..string.format(xOffsetRelAbs) .. "ft / Too short by "..string.format(zOffsetRelAbs).."ft", 10)
    
    

     

    and

     

    local xOffset = (BombDummyPos.x - Aimpointposx)*3.28084
    local zOffset = (BombDummyPos.z - Aimpointposz)*3.28084
    

     

    But I think there is also a MIST Function which converts feet to meter or otherwise.

     

    Don´t know what the "1.8" mentioned above is supposed to do though?

  4. Simplest approach could be just to load the script several times, with the different names of each client-units.

     

    So you change

     

    "player1" to "player2"... and assigne it the name of the client-unit name.

     

    Sure there are better ways, like f.e.:

     

    player1 = 'test1' -- playerunitname
    player2 = 'test2'
    player3 = 'test3'
    player4 = 'test4'
    player5 = 'test5'
    player6 = 'test6'
    player7 = 'test7'
    player8 = 'test8'
    player9 = 'test9'
    player10 = 'tes10'
    
    function SpawnSmokegreen(PlayerUnit)
       local _player = Unit.getByName(PlayerUnit)
       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
    function SpawnSmokered(PlayerUnit)
       local _player = Unit.getByName(PlayerUnit)
       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.Red)
    end
    function SpawnSmokeblue(PlayerUnit)
       local _player = Unit.getByName(PlayerUnit)
       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.Blue)
    end
    
    F10RadioAddTable = {}
    function SmokeDropper(PlayerUnit)
       if F10RadioAddTable[PlayerUnit] == nil then
           local _player = Unit.getByName(PlayerUnit)
           if _player == nil then
               return
           end
           
           local _playergroup = _player:getGroup()
           if _playergroup == nil then
               return
           end
     missionCommands.addCommandForGroup(_playerid, "Drop green smoke", nil, SpawnSmokegreen, PlayerUnit)
     missionCommands.addCommandForGroup(_playerid, "Drop red smoke", nil, SpawnSmokered, PlayerUnit)
     missionCommands.addCommandForGroup(_playerid, "Drop blue smoke", nil, SpawnSmokeblue, PlayerUnit)
     
           F10RadioAddTable[PlayerUnit] = true
       end
    end
    
    function AddSmokeDropCommands(arg, time)
       SmokeDropper(player1)
       SmokeDropper(player2)
       SmokeDropper(player3)
       SmokeDropper(player4)
       SmokeDropper(player5)
       SmokeDropper(player6)
       SmokeDropper(player7)
       SmokeDropper(player8) 
       SmokeDropper(player9)
    SmokeDropper(player10)  
       return time + 5
    end
    timer.scheduleFunction(AddSmokeDropCommands, nil, timer.getTime() + 5)
    

     

    But I don´t know if it works.

  5. 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

  6. 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

  7. 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
    

    • Like 1
  8. If you want to randomize the delay each time, you could go the timer.scheduleFunction way.

     

    The function has to have the signature "function(args, time)", and it also has to return as "return time + delay", where "delay" is the time in seconds until next execution. Is this not what you want to randomize ?

     

    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.

    mist.scheduleFunction is practically the same as timer.scheduleFunction, however it runs a bit differently. Basically we call timer.scheduleFunction to repeatedly run the function that monitors and runs all of the mist.scheduleFunctions. Because it uses our own code we can add a little more capability to it, for instance the repeating interval and stop time variables. Both work and can be used together without issue.

     

    If you wanted to do a randomized time delay for the function, you will need to reschedule it randomly each time.

    Yes, I have to call the functions on a different way, but as this is just scenery enhancement...

    can you post a mission?

    Will do, but not today, as I am not home.

    how do I use this script? Can you post a tutorial? I am completely new to this.

    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.

  9.  

    EDIT: ok, I think I got it, looks like mist.scheduleFunction and timer.scheduleFunction are not quite exactly the same ... doh.gif

     

    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.

  10. @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

  11. 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. ;)

  12. 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))

    • Like 1
  13. 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

  14. 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

  15. 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

  16. 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()
    

  17. 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)

  18. 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.

  19. 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.

×
×
  • Create New...