Jump to content

Get a Slot or Unit's current livery/liveryId


Go to solution Solved by Grimes,

Recommended Posts

Posted

I know this is a long shot, and I've seen plenty posts asking how to set liveries on a Unit or group, but I'm looking for a way to get the livery name/id of a Unit or player Slot. I'm 99% sure the answer is going to be "it's not possible", but if the data is available I'd like to know.

Thanks!

Posted (edited)
On 1/8/2024 at 3:29 PM, Camble said:

get the livery name/id of a Unit or player Slot. I'm 99% sure the answer is going to be "it's not possible", but if the data is available I'd like to know.

It's readily available for any unit that has been placed in the mission with mission editor (i.e. the information may not be available for units spawned dynamically), and all player slots are ME placed.

All you need to do is scan the env.mission.coalition table for all units. When you get to the individual units, most of them have an entry "livery_id" that contains the livery name as a string. So, if you want to, you can scan the entire table at mission start and create a lookup table by unit name that holds the livery for any unit that was placed with mission editor. Below is an example for a plane I placed with ME, the livery ID is readily available as you can see (third line in the units[1] table:

                                ["units"] = 
                                {
                                    [1] = 
                                    {
                                        ["alt"] = 2000,
                                        ["alt_type"] = "BARO",
                                        ["livery_id"] = "104th fs maryland ang, baltimore (md)",
                                        ["skill"] = "Client",
                                        ["speed"] = 123.33333333333,
                                        ["type"] = "A-10A",
                                        ["unitId"] = 1,
                                        ["psi"] = -2.4958208303519,
                                        ["onboard_num"] = "010",
                                        ["y"] = 646478.40080877,
                                        ["x"] = -281531.96917755,
                                        ["name"] = "Livery me alone",
                                        ["payload"] = 
                                        {
                                            ["pylons"] = 
                                            {
                                            }, -- end of ["pylons"]
                                            ["fuel"] = 5029,
                                            ["flare"] = 120,
                                            ["ammo_type"] = 1,
                                            ["chaff"] = 240,
                                            ["gun"] = 100,
                                        }, -- end of ["payload"]
                                        ["heading"] = 2.4958208303519,
                                        ["callsign"] = 
                                        {
                                            [1] = 1,
                                            [2] = 1,
                                            ["name"] = "Enfield11",
                                            [3] = 1,
                                        }, -- end of ["callsign"]
                                    }, -- end of [1]
                                }, -- end of ["units"]

Player aircraft are those that have a skill of "client", so above "A-10A" aircraft is a player aircraft that's rocking "104th fs maryland ang, baltimore (md)" liveries.

I don't know if livery IDs are available when you invoke getDesc() for an existing unit, you may have to investigate that.

Edited by cfrag
  • Thanks 1
  • Solution
Posted

There is no function to get the "live" livery_id a unit is currently using. Like cfrag stated you can only access what livery the unit started with. 

  • Thanks 1

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted
On 1/11/2024 at 9:42 PM, Grimes said:

There is no function to get the "live" livery_id a unit is currently using. Like cfrag stated you can only access what livery the unit started with. 

I figured as much. That's most unfortunate.

  • Recently Browsing   0 members

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