Jump to content

Scifer

Members
  • Posts

    70
  • Joined

  • Last visited

Posts posted by Scifer

  1. I'm making a MOOSE scripted mission. But as soon as I start shooting them, they end up stuck and inaccessible inside the buildings most of the time.

    The ideal solution for me would be to be able to simply move (not spawn) allied ground troops inside buildings like:

    unit:setPos(x, y, z)

    How can I achieve this?

  2. I found it inside 'mission.miz\l10n\DEFAULT\dictionary':

    dictionary = 
    {
        ["DictKey_descriptionNeutralsTask_4"] = "",
        ["DictKey_sortie_5"] = "",
        ["DictKey_descriptionText_1"] = "Description here!",
        ["DictKey_descriptionBlueTask_3"] = "",
        ["DictKey_descriptionRedTask_2"] = "",
    } -- end of dictionary

    This function can read individual keys from this dictionary.

    But how to write to this dictionary?

  3. I implemented this function without the need to include any additional units with MOOSE Framework.
    1. Generate a Morse code like TKR at https://morsecode.world/international/translator.html
      Pitch: 400
      Character speed: 10
      Farnsworth speed: 10
    2. Edit the audio file to include pause by extending its duration to 10 seconds
    3. In ME create a trigger SOUND TO COUNTRY (Ukraine, morse.wav)
    4. Name the LHA "USS Tarawa" in the ME
    5. Follow the standard procedure for MOOSE to execute the following code:

    carrier_unit = UNIT:FindByName( 'USS Tarawa' )
    
    -- Carrier NDB
    local CarrierBeacon = carrier_unit:GetBeacon()
    local frequency = 0.42  -- in MHz
    local modulation = radio.modulation.AM
    local power = 100 -- Standard for VOR
    local file = 'morse.wav'  -- Dots and Dashes: - -.- .-.
    CarrierBeacon:RadioBeacon( file, frequency, modulation, power )
    • Thanks 3
  4. 16 hours ago, Chump said:

    You will need to edit a LUA file so that you have access to the io library.

    Thank you so much. However a second problem came up.

    Quote

    VFS: VFS_open_write: CreateFile(table.lua): Access is denied.

  5. I'm trying to save a table to a file, just to analyze it.

    Path = 'd:\\'
    Filename = 'table.lua'
    Data = table
    UTILS.SaveToFile(Path, Filename, Data)

    However I get the following log message:

    Quote

    ERROR: io not desanitized. Can't save current file.

    I believe the path has to be de-sanitized. But how?

  6. I am adding custom beacons to Syria and succeeding until the point where ILS  is not working (tested with Huey only).

     

    image.png

     

    Here is what I did in beacons.lua (file attached):

    -- Custom Beacons
    
      {
        display_name = _('Rayak');
        beaconId = 'airfield51_0';
        type = BEACON_TYPE_VOR_DME;
        callsign = 'RAY';
        frequency = 107000000.000000;
        position = { -130181.8125, 909.15051269531, 4097.2592773438 };
        direction = 0.000000;
        positionGeo = { latitude = 33.850690831138, longitude = 35.98781336668 };
        sceneObjects = {'t:99550262'};
      };
      {
        display_name = _('Rayak');
        beaconId = 'airfield51_1';
        type = BEACON_TYPE_AIRPORT_HOMER_WITH_MARKER;
        callsign = 'RAK';
        frequency = 350100.000000;
        position = { -131681.046875, 888.30596923828, 2396.8859863281 };
        direction = 227.000000;
        positionGeo = { latitude = 33.836737715793, longitude = 35.969935539154 };
        sceneObjects = {'t:522781717'};
      };
      {
        display_name = _('Rayak');
        beaconId = 'airfield51_2';
        type = BEACON_TYPE_AIRPORT_HOMER_WITH_MARKER;
        callsign = 'RYK';
        frequency = 350200.000000;
        position = { -134789, 871.50836181641, -936.03497314453 };
        direction = 227.000000;
        positionGeo = { latitude = 33.807856734319, longitude = 35.934964382606 };
        sceneObjects = {'t:522781717'};
      };
      {
        display_name = _('');
        beaconId = 'airfield51_3';
        type = BEACON_TYPE_ILS_LOCALIZER;
        callsign = 'YAK';
        frequency = 107100000.000000;
        position = { -131166.578125, 892.31683349609, 2948.5236816406 };
        direction = 227.000000;
        positionGeo = { latitude = 32.677190, longitude = 35.175056 };
        sceneObjects = {'t:201097390'};
        chartOffsetX = 0;
      };
      {
        display_name = _('');
        beaconId = 'airfield51_4';
        type = BEACON_TYPE_ILS_GLIDESLOPE;
        callsign = 'YAK';
        frequency = 107100000.000000;
        position = { -131166.578125, 892.31683349609, 2948.5236816406 };
        direction = 227.000000;
        positionGeo = { latitude = 32.677190, longitude = 35.175056 };
        sceneObjects = {'t:201097390'};
        chartOffsetX = 0;
      };
    }

     

    Can anyone tell me why ILS is not working?

     

    Also:

    What is the difference between position and positionGeo?

    What sceneObjects stands for?

     

    beacons.lua

  7. I placed a Huey and a zone in ME where a slingload object is spawned via script as follows:

    -- Spawn cargo
    
    local cargo_template = {
    type = 'uh1h_cargo',
    mass = 900,
    }
    
    local cargo_zone = ZONE:New( 'Cargo Zone' )
    
    local cargo_static = SPAWNSTATIC
    :NewFromTemplate( cargo_template, country.id.USA )
    :SpawnFromZone( cargo_zone, 0, 'Slingload' )

    The problem is the F6 menu item doesn't appear. So I cannot activate the slingload native functions like hook, indicator and smoke.

    How can I slingload script spawned static objects?

  8. After updating MOOSE, I came across an even better way – NewFromTemplate() – and finally managed to spawn random cargos:

    local cargo_table = {
     {
       type = 'ammo_cargo',
       mass = 1000,
     },
     {
       type = "barrels_cargo",
       mass = 480,
     },
     {
       type = 'm117_cargo',
       mass = 840,
     },
    }
    
    local cargo_template = cargo_table[math.random(#cargo_table)]
    local cargo_zone = ZONE:New( 'Cargo Zone' )
    
    local cargo_static = SPAWNSTATIC
     :NewFromTemplate( cargo_template, country.id.USA )
     :SpawnFromZone( cargo_zone, 0, 'Cargo' )

    :thumbup: Thanks everyone for your support!

  9. Anyway, if you have a static which you want to "clone", you can spawn it even simpler

     

    local crate_static=SPAWNSTATIC:NewFromStatic("Crate"):SpawnFromZone(ZONE:New('Crate Zone'))
    crate_static:SmokeRed()
    

     

    Thanks for your suggestion but I don't want to manually place each static type in ME.

  10. I'm trying to spawn random slingloadable crates from a table.

     

    The problem is I didn't manage to use NewFromType() properly.

     

    I even tried to obtain type and category with GetTypeName() and GetCategoryName() – from a ME crate – to no avail :(

     

    local crate_zone = ZONE:New( 'Crate Zone' )
    
    -- Just to certify type and category are correct
    local crate = STATIC:FindByName( 'Crate' )
    local type = crate:GetTypeName()
    local category crate:GetCategoryName() -- EDIT: missing '='
    
    local crate_static = SPAWNSTATIC
     :NewFromType( type, category, country.id.USA )
     :SpawnFromZone( crate_zone )

     

    I got the following error:

     

    ERROR   SCRIPTING: Mission script error: [string "C:\Users\Scifer\AppData\Local\Temp\DCS.openbeta\/~mis0000458A.lua"]:11008: attempt to index field '?' (a nil value)
    stack traceback:
    [C]: ?
    [string "C:\Users\Scifer\AppData\Local\Temp\DCS.openbeta\/~mis0000458A.lua"]:11008: in function 'GetStaticGroupTemplate'
    [string "C:\Users\Scifer\AppData\Local\Temp\DCS.openbeta\/~mis0000458A.lua"]:24791: in function 'SpawnFromPointVec2'
    [string "C:\Users\Scifer\AppData\Local\Temp\DCS.openbeta\/~mis0000458A.lua"]:24880: in function 'SpawnFromZone'
    [string "C:\Users\Scifer\AppData\Local\Temp\DCS.openbeta\/~mis00004726.lua"]:10: in main chunk
    

     

    What am I doing wrong?

×
×
  • Create New...