Jump to content

Recommended Posts

Posted

is there a way to despawn and spawn static objects mid-mission to rearrange the carrier deck for T.O. beggining of the mission and landing at the end of the mission?

  • 2 months later...
Posted
is there a way to despawn and spawn static objects mid-mission to rearrange the carrier deck for T.O. beggining of the mission and landing at the end of the mission?

 

Sorry to necro this thread, but I came here wondering this same thing. Anyone?

Posted

I did that to block some parking spots on a Stennis. I put the static objets in the ME, and a trigger on mission start removes them with the following:

 

 

StaticObject.getByName('REMOVE1'):destroy()

8h.miz

  • Thanks 1
Posted (edited)

@ScopeDope

 

I don't know of a way to spawn static objects once the mission has started, but you can use late activated AI units to "replace" the statics you remove.

 

For instance, the attached MOOSE demo mission has 2 static hornets and 1 static sea stallion (on the Stennis' deck) at mission start.

All these statics will be removed 10 seconds after mission start, then, 2x late activated hornets and a late activated sea stallion will spawn at a different location (starting from ramp).

 

Basically, removing any number of statics from the Stennis' deck is easy to do, "replacing" them, however, not so much :cry:

Stennis static spawn_despawn.miz

Static Spawn Carrier.lua

Edited by Hardcard
Posted

Thanks Hardcard. Too bad we're still limited to having 4 parking spots...

 

 

Is there anyway to remove some of the static, or is it an all or nothing switch in the script?

9800X3D,  MSI 5080 , G.SKILL 64GB DDR5-6000, Win 11, MSI X870, 2/4TB nVME, Quest 3, OpenHornet Pit 

Posted

We have 4 spots on the cats and 4 additional. I simulate more by either late-activating groups airborne near the CVN or having them orbit until triggered. Add a triggered message "Wheels up." Once human pilots are launched they can't see the flight deck anyway.

Posted (edited)
Thanks Hardcard. Too bad we're still limited to having 4 parking spots...

 

Yup, that's not ideal

 

 

Is there anyway to remove some of the static, or is it an all or nothing switch in the script?

 

The script I provided uses a set of statics, which includes all statics in that mission. The "removal" function is applied to all the statics within the set.

 

I wrote it that way because it makes things simpler, but, sure, the script can be modified to target specific statics:

 

 

local StaticSet = SET_STATIC:New()

:FilterPrefixes("Static_") -- This is the key. It'll look for all statics that use "Static_" as prefix in their ME name. These will be included in the set

:FilterStart()

 

StaticSet:ForEachStatic( -- This iterator will run the following function for each static in the set

function(StaticUnit)

 

Stuff you want to do with the statics in StaticSet

 

end

)

 

-- Now, imagine I had several static hornets and several static sea stallions on the Stennis' deck. I could create two separate sets instead, one for each type

 

local HornetSet = SET_STATIC:New()

:FilterPrefixes("Hornet_") -- This will look for all statics that use "Hornet_" as prefix in their ME name. Needless to say that you need to modify the name of the static hornets in ME, so they use this prefix

:FilterStart()

 

 

HornetSet:ForEachStatic( -- We can use the same kind of iterator as before, this time it'll apply to the static hornet set only

function(HornetUnit)

 

Stuff you want to do with the statics in HornetSet

 

end

)

 

-- Then we do the same thing with the static sea stallions

 

local StallionSet = SET_STATIC:New()

:FilterPrefixes("Stallion_") -- This will look for all statics that use "Stallion_" as prefix in their ME name. Needless to say that you need to modify the name of the static stallions in ME, so they use this prefix

:FilterStart()

 

StallionSet:ForEachStatic( -- We can use the same kind of iterator as before, this time it'll apply to the static stallion set only

function(StallionUnit)

 

Stuff you want to do with the statics in StallionSet

 

end

)

 

 

-- So far, I've only used sets to target statics, since that's the easiest way to handle several groups at once (each static can be considered a separate group),

-- However, if you want to target individual statics instead, you can use:

 

STATIC:FindByName("Name of the static in ME")

 

-- Let's say I want to target the first static hornet only:

 

local Static_Hornet_1 = STATIC:FindByName("Name of the first static hornet in ME")

 

-- Then, I can remove it from the map whenever I choose, by using

 

Static_Hornet_1:Destroy()

 

 

 

Edited by Hardcard
Posted

Fantastic stuff, thank you so much!

9800X3D,  MSI 5080 , G.SKILL 64GB DDR5-6000, Win 11, MSI X870, 2/4TB nVME, Quest 3, OpenHornet Pit 

Posted

Hardcore,

 

First. Thanks for this script. Very awesome!

 

But I'm having an issue where the "Static Respawn Test" only seems to work if the Trigger "MOOSE Load" exist.

 

But I do not see the Moose.lua. Is it imbedded into the mission file you provided?

 

As a result, using the "Static Respawn Test" doesn't work on my mission despite having the correct naming. I'm I missing something to get this to work on my mission?

 

Also, launching your mission file and removing the "Moose Load" reference breaks the "Static Respawn Test".

Posted (edited)

I do not see the Moose.lua. Is it imbedded into the mission file you provided?

 

Yes, it's in there.

Open the mission file with winzip/winrar/7zip/etc. and navigate to Stennis static spawn_despawn.miz\l10n\DEFAULT , you'll find it there.

 

Alternatively, you can download it here

 

As a result, using the "Static Respawn Test" doesn't work on my mission despite having the correct naming. I'm I missing something to get this to work on my mission?

Also, launching your mission file and removing the "Moose Load" reference breaks the "Static Respawn Test".

 

As you've probably deduced, the script won't work without Moose.lua being loaded first, since it's a MOOSE script.

You need to create that "MOOSE load" trigger at mission start, with a "DO SCRIPT FILE" action that runs Moose.lua

Edited by Hardcard
Posted

Awesome! Thanks again.

 

On a side note, the Moose.lua seems a bit heavy. Is it possible for me to strip what I don't need and keep the functions that allow the "Static Spawn" lua to work, or is the whole script pretty much necessary? Just trying to reduce the number of functions on my mission as possible. But if I need it all, I'll use it!

Posted
Awesome! Thanks again.

 

On a side note, the Moose.lua seems a bit heavy. Is it possible for me to strip what I don't need and keep the functions that allow the "Static Spawn" lua to work, or is the whole script pretty much necessary? Just trying to reduce the number of functions on my mission as possible. But if I need it all, I'll use it!

Not sure which one you have, but looks like there's a smaller file located on the MOOSE thread:

 

https://forums.eagle.ru/showthread.php?t=138043

i9 14900k @5.6GHz NZXT Kraken |Asus ROG Strix Z790 A-Gaming | Samsung NVMe m.2 990 Pro 2TB | 64GB DDR5 6400MHz

EVGA RTX 3090 FTW3 Ultra | PiMAX CRYSTAL LIGHT  | HOTAS Warthog | Saitek Flight Pedals

Posted (edited)

@pimp

 

That's an older MOOSE release

 

@Teriander

 

Modify Moose.lua at your own risk, I don't recommend it, but you are free to try, ofc.

 

As for performance, Moose.lua by itself shouldn't affect it.

Think of it as a "scripting dictionary/translator", it shouldn't do anything by itself. It'll simply "translate" your MOOSE scripts so the DCS scripting engine "understands" them.

 

Anyway, you can always use DCS scripting methods instead, no Moose.lua required for those.

Edited by Hardcard
Posted
@pimp

 

That's an older MOOSE release

 

@Teriander

 

Modify Moose.lua at your own risk, I don't recommend it, but you are free to try, ofc.

 

As for performance, Moose.lua by itself shouldn't affect it.

Think of it as a "scripting dictionary/translator", it shouldn't do anything by itself. It'll simply "translate" your MOOSE scripts so the DCS scripting engine "understands" them.

 

Anyway, you can always use DCS scripting methods instead, no Moose.lua required for those.

 

Where could I get the latest Moose release?

  • 1 year later...
Posted

Hello guys, can i ask you something?.. I'm trying to use your scrypt for spawn statics with 10s delay.

 

Do you see an error? My static name objects is :

FpostB1_Fuel1

FpostB1_Fuel2

FpostB1_Fuel3

FpostB1_Fuel4

 

local StaticSet = SET_STATIC:New()

:FilterPrefixes("FpostB1_")

:FilterStart()

 

local FpostB1Fuel = SPAWN:New("Fuel")

 

 

local SpawnFlag = USERFLAG:New("Spawn Flag")

 

local function StaticDestroy(StaticUnit)

 

StaticUnit:Destroy()

 

if SpawnFlag:Get() ~= 1 then

 

Fuel:Spawn()

 

SpawnFlag:Set(1)

end

end

 

StaticSet:ForEachStatic(

function(StaticUnit)

 

timer.scheduleFunction(StaticDestroy, StaticUnit, timer.getTime() + 10 )

 

end

)

  • 1 month later...
  • 2 months later...
Posted (edited)

Late answer may help future readers of this post.

Moose.lua is to be loaded separately , ahead of the your lua script in the mission .miz file. It's very likely that you need to download it and keep it in your missions directory as is done in this example. Take a look at the triggers.

Edited by Lineaxe
  • 2 weeks later...
  • 1 year later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...