Hello, I'm creating a new mission for multiplayer but some units don't want to spawn. I'm using the currenthill mods for the ground troops, and, for the same code, some troops will spawn and others wont. I don't know why, someone can explain me ? Also, the red units who spawn spawns in the blue airbases, wich are not in the list RED_AIRPORT or RED_FARP ... I give you the part of the code for one of the units that don't spawn and the all code. Please help me.
local function spawnRedArtilleryLoop()
local function spawnNow()
--Randomly choose a truck template from the list
local template = RED_ARTILLERY_TEMPLATE[math.random(#RED_ARTILLERY_TEMPLATE)]
-- Combine airport and FARP list
local possibleBases = {}
for _, base in ipairs(RED_AIRPORT) do table.insert(possibleBases, base) end
for _, farp in ipairs(RED_FARP) do table.insert(possibleBases, farp) end
--Choose a random base position
local spawnPos = getRandomBasePosition(possibleBases)
if spawnPos then
local coord = COORDINATE:NewFromVec3(spawnPos):GetRandomCoordinateInRadius(300, 150)
:InitPositionCoordinate(coord)
SPAWN:New(template)
:Spawn()
end
--Schedule next spawn
mist.scheduleFunction(spawnNow, {}, timer.getTime()+ RED_ARTILLERY_TEMPLATE_RESPAWN_TIME)
end
spawnNow()
end
ScriptDCSTestNewVersion.lua