Monday, April 16, 2012

[SC2] Add "Civilian" A.I ?

Hello, Anyone able to help or guide me in this little problem I got.
I am able to add an non-fighting A.I in a map, but in the same time the players are not able to choose what faction they want to play. Or I can have players to choose as normal in the game lobby but then the "civilian" spans a ACU
I been trying to follow the guides for supcom1, as the files and codes look similar but its not working.
The AI is for this project;
viewtopic.php?f=50&t=48876|||I get mad, I believe I am close to something here; Maybe someone who could read codes can help me?
----
--* File: lua/modules/ui/maputil.lua
function GetExtraArmies(scenario)
if scenario.Configurations.standard and scenario.Configurations.standard.teams then
local teams = scenario.Configurations.standard.teams
if teams.ExtraArmies then
local armies = STR_GetTokens(teams.ExtraArmies,' ')
return armies
end
end
-----
--* File: lua/modules/ui/lobby/lobbyOptions.lua
default = 1,
label = "Civilians",
help = "Set how civilian units are used",
key = 'CivilianAlliance',
pref = 'Lobby_Gen_Civilians',
values = {
{
text = "Enemy",
help = "Civilians are enemies of players",
key = 'enemy',
},
{
text = "Neutral",
help = "Civilians are neutral to players",
key = 'neutral',
},
{
text = "None",
help = "No Civilians on the battlefield",
key = 'removed',
},
},

-----
-- File : /data/lua/sim/ScenarioUtilities.lua
local armyIsCiv = ScenarioInfo.ArmySetup[strArmy].Civilian
if (not armyIsCiv and bCreateInitial) or (armyIsCiv and civOpt != 'removed') then
local commander = (not ScenarioInfo.ArmySetup[strArmy].Civilian)
local cdrUnit
tblGroups[strArmy], cdrUnit = CreateInitialArmyGroup( strArmy, commander)
if commander and cdrUnit and ArmyBrains[iArmy].Nickname then
cdrUnit:SetCustomName( ArmyBrains[iArmy].Nickname )
end
end
------------------------------
That was I think the "key" codes for adding civilians in skirmish and MP, during Campaign its easy but then the player lost the ability to choose faction in game.

No comments:

Post a Comment