Jump to content

Scripting/Engine: Change to how groups are handled?


Mauritz

Recommended Posts

Hello community contributors,

I have run in to some issues with some scripts I have been using not functioning as they used to. My concern is with AI air-groups & the respawning thereof.

 

Now when I respawn downed groups, using MIST, the group only contain a single aircraft (likely the last member to go down). This has changed in some resent patch. I'm wondering then if ED has changed how Groups are handled, are they now purging dead entities from the Group IDs?

 

Code for reference (I also have a script to handle Crash events)

 

--Credit to shnicklefritz
--https://forums.eagle.ru/showpost.php?p=3406607&postcount=3

function onShutdownAI(event)

if world.event.S_EVENT_ENGINE_SHUTDOWN == event.id and event.initiator:getPlayerName() == nil then
local shutdownGroup = event.initiator:getGroup()
local shutdownType = event.initiator:getTypeName()
local shutdownCall = event.initiator:getCallsign()
local shutdownID = event.initiator:getID()
local shutdownName = shutdownGroup:getName()
local shutdownSide = shutdownGroup:getCoalition()
local shutdownMess1 = " has returned to base. We are getting another one in air ASAP."

	if shutdownGroup:getSize() >= 1 and event.initiator:inAir() == false then
	local shutdownAir = 0

		for i, ship in pairs (shutdownGroup:getUnits()) do
			if ship:inAir() == true then
			
			local shutdownAir = shutdownAir + 1
			end
		end
		
		if shutdownAir == 0 then
			trigger.action.deactivateGroup(shutdownGroup)
			trigger.action.outTextForCoalition(shutdownSide, "A friendly " .. shutdownType .. ", callsign " .. shutdownCall .. shutdownMess1, 15)


			if shutdownType == "E-2C" then mist.respawnGroup(shutdownName, true)
			elseif shutdownType == "KC130" then mist.respawnGroup(shutdownName, true)
			elseif shutdownType == "MiG-21Bis" then mist.respawnGroup(shutdownName, true)
			elseif shutdownType == "MiG-29A" then mist.respawnGroup(shutdownName, true)
			elseif shutdownType == "MiG-23MLD" then mist.respawnGroup(shutdownName, true)
			elseif shutdownType == "MiG-25PD" then mist.respawnGroup(shutdownName, true)
			elseif shutdownType == "KC-135" then mist.respawnGroup(shutdownName, true)
			elseif shutdownType == "Su-24M" then mist.respawnGroup(shutdownName, true)
			elseif shutdownType == "F-15E" then mist.respawnGroup(shutdownName, true)
			elseif shutdownType == "F-5E-3" then mist.respawnGroup(shutdownName, true)
			elseif shutdownType == "A-10C" then mist.respawnGroup(shutdownName, true)
			elseif shutdownType == "A-10C" then mist.respawnGroup(shutdownName, true)
			end
		end
	end
end
end

mist.addEventHandler(onShutdownAI)

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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