Jump to content

Coalition.addgroup need help for spawning a plane


Recommended Posts

Posted (edited)

So I really don't get it. Tried with my own plane, then directly used another from a script which works. 

So here is the deal : put a map marker with "CAS" in the name, a plane appears and goes for some CAS in the area. For now I strictly don't manage to get the plane to appear. I use this way of working without any issue for vehicles. I must miss something in the way to declare a plane.  

 

Here is the code with a random test plane 

 

local Spawn_CAS = {}

function Spawn_CAS:onEvent(_Event)

	if _Event.id == world.event.S_EVENT_MARK_CHANGE then

		if _Event.text == "CAS" then 
			local MarkPosX = _Event.pos
			
			
			
			
			
		local CAS = {
		       [1] = 
                            {
                                ["lateActivation"] = false,
                                ["task"] = "Nothing",
                                ["uncontrolled"] = false,
                                ["route"] = 
                                {
                                    ["routeRelativeTOT"] = true,
                                                                       ["points"] = 
                                    {
                                        [1] = 
                                        {
                                            ["alt"] = 2000,
                                            ["action"] = "Turning Point",
                                            ["alt_type"] = "BARO",
                                            ["properties"] = 
                                            {
                                                ["addopt"] = 
                                                {
                                                }, -- end of ["addopt"]
                                            }, -- end of ["properties"]
                                            ["speed"] = 123.33333333333,
                                            ["task"] = 
                                            {
                                                ["id"] = "ComboTask",
                                                ["params"] = 
                                                {
                                                    ["tasks"] = 
                                                    {
                                                    }, -- end of ["tasks"]
                                                }, -- end of ["params"]
                                            }, -- end of ["task"]
                                            ["type"] = "Turning Point",
                                            ["ETA"] = 0,
                                            ["ETA_locked"] = true,
                                            ["y"] = 0,
                                            ["x"] = 0,
                                            ["name"] = "RAT_FIGHTER_2_KOREAN_WAR",
                                            ["formation_template"] = "",
                                            ["speed_locked"] = true,
                                        }, -- end of [1]
                                    }, -- end of ["points"]
                                }, -- end of ["route"]
                                ["groupId"] = 413,
                                ["hidden"] = false,
                                ["units"] = 
                                {
                                    [1] = 
                                    {
                                        ["alt"] = 2000,
                                       -- ["livery_id"] = "US Air Force ex-USAF F-86A Sabre",
                                        ["alt_type"] = "BARO",
                                        ["skill"] = "High",
                                        ["speed"] = 123.33333333333,
                                        ["type"] = "F-86F Sabre",
                                        ["unitId"] = 506,
                                        ["psi"] = 0,
                                        ["y"] = 0,
                                        ["x"] = 0,
                                        ["name"] = "RAT_FIGHTER_2_KOREAN_WAR",
                                        ["payload"] = 
                                        {
                                            ["pylons"] = 
                                            {
                                            }, -- end of ["pylons"]
                                            ["fuel"] = 3249,
                                            ["flare"] = 60,
                                            ["ammo_type"] = 5,
                                            ["chaff"] = 60,
                                            ["gun"] = 100 },
                                        ["heading"] = 0,
                                        ["callsign"] = 
                                        {
                                            [1] = 1,
                                            [2] = 1,
                                            [3] = 1,
                                            ["name"] = "Enfield11",
                                        }, -- end of ["callsign"]
                                        ["onboard_num"] = "010",
                                    }, -- end of [1]
                                }, -- end of ["units"]
                                ["y"] = 0,
                                ["x"] = 0,
                                ["name"] = "RAT_FIGHTER_2_KOREAN_WAR",
                                ["communication"] = true,
                                ["start_time"] = 0,
                                ["modulation"] = 0,
                                ["frequency"] = 124,
                            }, -- end of [1]

 -- end of [67]


}

coalition.addgroup(80, Group.Category.AIRPLANE, CAS)
			
			
			
			
end
end
end	
	world.addEventHandler(Spawn_CAS)

 

Would some nice guy have an idea ? I really don't manage to get it to work. 

 

Nicolas

Edited by dimitriov
Posted

You are ever so close. 

coalition.addGroup not coalition.addgroup

 

Remove the nested table

        local CAS = {
               [1] =  {
                 groupTable

It should just be: 

local CAS = {
   groupTable
  }

                 

 

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

  • Recently Browsing   0 members

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