Jump to content

Atari800XL

Members
  • Posts

    45
  • Joined

  • Last visited

Community Answers

  1. Atari800XL's post in Problems with coalition.addStaticObject() was marked as the answer   
    And finally ... it works!
    My solution to get the ID of (MOOSE-)spawned carrier:
    local carrierSpawn = "CARRIER" .. math.random(1, 999) local BRC = math.random(1, 359) local allZones = shuffleList(inListLike('CSZ', getAllTriggerZones())) -- shuffleList(), inListLike(), getAllTriggerZones() are self coded functions local spawnZone = ZONE:New(allZones[1]) local SP = SPAWN:NewWithAlias('CARRIER', carrierSpawn):InitCountry(country.id.USA):InitHeading(BRC):SpawnInZone(spawnZone, true) -- -- code,code,code... -- local CGI = Group.getByName(carrierSpawn.."#001"):getUnits() local CGI2 = CGI[1]:getID() -- ID of the carrier The attachment shows un-randomized parking hornets.

  2. Atari800XL's post in logical question about iterrated spawns of units over a lua-table in MOOSE was marked as the answer   
    Solved, the following code makes it: (maybe useful for other MOOSE beginners)
    -- ###LUA!### <-- Token to search for in dcs.log in case of crashing script -- Defined random spawns of ground-units for weapontraining: -- MOOSE: https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Spawn.html -- env.info( 'maybe some special token to set a tail on in dcs.log' ) knownSpawnZones = { ZONE:New("TANK_SPAWN_1") , ZONE:New("TANK_SPAWN_2") , ZONE:New("TANK_SPAWN_3") } spawnPlan = {     -- { quantity, templateName, target zone }      { 1 , "TGT_Tank1" , "TANK_SPAWN_1"},      { 2 , "TGT_Tank1" , "TANK_SPAWN_2"},      { 3 , "TGT_Tank2" , "TANK_SPAWN_3"} }    totalSpawns = 0 for i,plan in ipairs(spawnPlan) do      q = plan[1]      templateName = plan[2]      targetZone = plan[3]      tmpTargetSpawnZone = ZONE:New( targetZone)      dbgMess = MESSAGE:New( i .. ": " .. tostring(q) .. "x " .. templateName .. " randomly in " .. targetZone):ToAll()      master = GROUP:FindByName( templateName ):GetTemplate()     for ii = 1,q do         local newAlias = "Tank-" .. i .. "-" .. ii         local tempTank = SPAWN:NewWithAlias( templateName , newAlias)                               :SpawnInZone( tmpTargetSpawnZone , true)                          totalSpawns = totalSpawns + q     end     end dbgMess = MESSAGE:New( tostring(totalSpawns) .. " tanks spawned"):ToAll()  
×
×
  • Create New...