Tien voila , je croit sa ,sa fonctionnerais pour tuer les uniter sur la lave , mais reste a savoir , est-ce que la Lave est un layers ? Si oui , tu change
TALAVE par le layer de la lave et sa devrais fonctionner. Et sinon , je suis entrain de réinstaller le jeux , je me download l'éditeur et j'irai vérifier
Code : Tout sélectionner
local ScenarioUtils = import('/lua/sim/ScenarioUtilities.lua')
local ScenarioFramework = import('/lua/ScenarioFramework.lua')
--units to be restricted
local NAVALbuildRestriction = categories.NAVAL + categories.ANTINAVY
function OnPopulate()
ScenarioUtils.InitializeArmies()
local tblArmy = ListArmies()
for index,army in tblArmy do
ScenarioFramework.AddRestriction(army, NAVALbuildRestriction)
end
end
function OnStart(self)
--delete all units on the water layers except air units every 2 seconds
ForkThread(function()
while true do
WaitSeconds(2)
killUnitsOnLayer({'TALAVE','Seabed','Sub'},{'AIR'})
end
end)
end
--get all units on the map
allUnits = function()
local xmapsize = ScenarioInfo.size[1]
local ymapsize = ScenarioInfo.size[2]
local mapRect = {x0 = 0, x1 = xmapsize, y0 = 0, y1 = ymapsize}
units = GetUnitsInRect(mapRect)
return units
end
--delete all units on a layer exept those containing the exception categories
killUnitsOnLayer = function(layers,exceptions)
--get all units on the map
local units = allUnits()
--if there are units on the map
if units and table.getn(units) > 0 then
for index,unit in units do
local delete = false
--is the unit on one of the specified layers?
for index,layer in layers do
if unit:GetCurrentLayer() == layer then
delete = true
end
end
--is the unit in an exception category?
for index,category in exceptions do
if EntityCategoryContains(categories[category], unit) then
delete = false
end
end
--if the unit is in one of the layers and in no exception category then kill it
if delete == true then
if unit and not unit:IsDead() then
unit:Kill()
end
end
end
end
end