Jump to content

Help with GROUP:FindByName()


Death Merchant

Recommended Posts

Hey guys,

 

I'm learning scripting and using MOOSE. I've been having limited success with GROUP:FindByName and UNIT:FindByName. From what I can tell the problem usually stems from not knowing the GROUP or UNITS proper and complete name.

 

Is there a way to generate a list of all of the GROUPS and UNITS in a mission so that I can verify the I have the name correct?

 

Thanks,

DM

[PC] ASUS X570E - Ryzen 9  5950X - RX 6900 XT - 32GB 3600Mhz

Hornet, A-4E-C, Huey, Ka-50, Mi-8, F-15E, F-14

Join us on Death Dealers PvE server.

Link to comment
Share on other sites

If you want to access your group after you've spawned it, you can use :OnSpawnGroup(). Here's just a short example:

f16_spawn = SPAWN
	:New("F_16_USA")
	:OnSpawnGroup(
		function(SpawnedGroup)
			F16GroupName = SpawnedGroup.GroupName
		end
	)


Then later on to find it you can use it like this:

GROUP:FindByName(F16GroupName)


Feel free to ask any questions you may have, hope this helps!

Link to comment
Share on other sites

Good luck with your learning! I've just started with Moose too (and lua at the same time) - and am a complete novice - but can share with you what I know. 

 

This will get a list of all groups and/or units you have in the mission and drop it into the DCS log file for you:

 

MyGroups = SET_GROUP:New():_FilterStart()
 BASE:E({MyGroups:GetObjectNames()})

MyUnits = SET_UNIT:New():_FilterStart()
 BASE:E({MyUnits:GetObjectNames()})

You can of course use filters to limit on coalition, etc by adding filter conditions with the SET_GROUP stuff.

 

(I think you should be able to do the same thing on a client set too if you're looking for clients and not AI units/groups)

 

FWIW - I use Copy and paste between the Mission Editor and LDT religiously because I'm a sucker for mistyping the names (or getting the case wrong).


Edited by Dangerzone
Link to comment
Share on other sites

Thanks guys, you were a big help!

 

It took some work, but I got everything working.

 

I've taken the SnowFox Escalation Misison, added the Hercules mod and added persistent functionality for the units dropped from the Herc. This is going to help a lot.

 

DM

  • Like 1

[PC] ASUS X570E - Ryzen 9  5950X - RX 6900 XT - 32GB 3600Mhz

Hornet, A-4E-C, Huey, Ka-50, Mi-8, F-15E, F-14

Join us on Death Dealers PvE server.

Link to comment
Share on other sites

On 7/28/2021 at 11:07 PM, Dangerzone said:

FWIW - I use Copy and paste between the Mission Editor and LDT religiously because I'm a sucker for mistyping the names (or getting the case wrong).

 

I've been having trouble setting up the LDT, I keep getting errors, so I've been using Notepad++ for my LUA editing.

I need to get the LDT setup, I hear it's really helpful.

[PC] ASUS X570E - Ryzen 9  5950X - RX 6900 XT - 32GB 3600Mhz

Hornet, A-4E-C, Huey, Ka-50, Mi-8, F-15E, F-14

Join us on Death Dealers PvE server.

Link to comment
Share on other sites

You can setup your Intelisense through Visual Studio Code or LDT

How to setup Intelisense for Visual Studio Code: https://forums.eagle.ru/topic/227443-moose-visual-studio-code-moose-implementation/

 

How to setup Intelisense with LDT:

Hopefully these two guides help some, personally I use Visual Studio Code as it’s more appealing to look at for long hours 🙂 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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