Jump to content

Question about destroy spawn plane withe Moose script


TuTu

Recommended Posts

Hello,

I would like to spawn enemy planes using the F10 menu, and keep the opportunity to destroy them using this same menu.

I created a script with moose, but the planes refuse to disappear when I use the destroy command. I also checked that they didn't have a name (just a number) despite the "InitKeepUnitNames" option.

Could someone who knows Moose please help me?

Thank you in advance.

 

do

-- Add main menu radio
local MenuCoalitionBlue = MENU_COALITION:New( coalition.side.BLUE, "A/A targets manage" )

-- Respawn zones table
local ZoneTable = { ZONE:New( "SpawnZone1" ), ZONE:New( "SpawnZone2" ) , ZONE:New( "SpawnZone3" ) , ZONE:New( "SpawnZone4" )}

-- #SPAWN class
local SpawnClasTargetPlane

local function SpawnTargetPlane()
	SpawnClassTargetPlane = SPAWN
		:New( "TARGET_PLANE" )
		:InitKeepUnitNames(true)
		:InitLimit( 2, 1 )		-- :InitLimit( 2, 20 )
		:InitRandomizeZones( ZoneTable )
		:SpawnScheduled( 10, .5 )
end


local function DestroyTargetPlanes()
	if SpawnClassTargetPlane:IsAlive then
		SpawnClassTargetPlane:Destroy(true)
	end
end


-- Add second menu radio
local MenuSpawnTargetPlane = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "spawn target plane", MenuCoalitionBlue, SpawnTargetPlane )

local MenuDestroy = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Remove all target plane", MenuCoalitionBlue, DestroyTargetPlanes )


end	-- do

 

Spawn_AA_light.lua

Link to comment
Share on other sites

  • Recently Browsing   0 members

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