How Do I add Custom Units to a released map?
Posted: Mon May 26, 2014 11:49 am
How do I put in custom Units (Ex 212 Battalion) into a custom map that only uses stock sides?
Get more from your games!
http://www.gametoast.com/
That's a tricky one. You might be able to do it with THIS, but I don't know if it works with other mod missions. Another option is, while a bit tedeous, you mentioned other clone units, if you have BFX installed, you can load in the legion skins via the fake console's code console:KeepAmazinn wrote:How do I put in custom Units (Ex 212 Battalion) into a custom map that only uses stock sides?
Code: Select all
ReadDataFile("..\\..\\addon\\DAN\\data\\_LVL_PC\\mission.lvl", "dan1c_con")
ScriptCB_DoFile("dan1c_con")Code: Select all
function SetupTeams(sides)
-- HACKish: load the turret .odf here (this is the easiest place to put it where it will
-- be executed in every level
--ReadDataFile("SIDE\\tur.lvl", --disabled for now until we settle on where exactly the .odf will end up
-- "tur_bldg_defensegridturret")
-- Load my map's level file, managed by the mapCode variable in the mission script
if mapCode == 1 then
ReadDataFile("..\\..\\addon\\DAN\\data\\_LVL_PC\\DAN\\DAN.lvl", "DAN_conquest")
end
-- list of types
local typeList = { "soldier", "pilot", "assault", "sniper", "marine", "engineer", "officer", "special" }
-- items for each team code
local teamItems = nil
if ScriptCB_IsMissionSetupSaved() then
local missionSetup = ScriptCB_LoadMissionSetup()
teamItems = missionSetup.units
end
-- for each specified side...
for name, side in pairs(sides) do
local team = side.team
-- set team properties
local name = string.lower(name)
SetTeamName(team, name)
SetTeamIcon(team, name .. "_icon", "hud_reinforcement_icon", "flag_icon")
SetUnitCount(team, side.units)
SetReinforcementCount(team, side.reinforcements)
-- add unit classes in type order
for _, type in ipairs(typeList) do
if side[type] and (not teamItems or not teamItems[name] or teamItems[name][type]) then
AddUnitClass(team, side[type][1], side[type][2], side[type][3])
end
end
-- add hero class if available
if side[hero] then
AddHeroClass(side[hero])
end
end
-- Inject Custom Units into mission
-- Variable "unitCode" found in mission lua
if unitCode == 212 then
ReadDataFile("dc:SIDE\\212th.lvl", "212th_inf_clone")
AddUnitClass(REP, 212th_inf_clone, 1, 25)
end
end
Code: Select all
-- Variables that make the if statements in the setup_teams LUA true
mapCode = 1
unitCode = 212
-- Execute my map's script
ReadDataFile("..\\..\\addon\\DAN\\data\\_LVL_PC\\mission.lvl", "dan1c_con")
ScriptCB_DoFile("dan1c_con")Code: Select all
ReadDataFile("..\\..\\addon\\mapID\\data\\_LVL_PC\\core.lvl")Code: Select all
if useStockUnits == 1 then
if side[type] and (not teamItems or not teamItems[name] or teamItems[name][type]) then
AddUnitClass(team, side[type][1], side[type][2], side[type][3])
end
end
Tried what you said above and it didn't work.commanderawesome wrote:That's a tricky one. You might be able to do it with THIS, but I don't know if it works with other mod missions. Another option is, while a bit tedeous, you mentioned other clone units, if you have BFX installed, you can load in the legion skins via the fake console's code console:KeepAmazinn wrote:How do I put in custom Units (Ex 212 Battalion) into a custom map that only uses stock sides?Hidden/Spoiler:
Off topic:Maybe the admins should merge the two threads...Nedarb7 wrote: (!Notice, this workaround has not confirmed to work with mod maps. To keep up with the progress of the workaround check out commanderawesome's post!)