InclusionExclusionMods doesn't work + suggested solution
Posted: Tue Apr 04, 2017 12:26 am
This is mostly relevant for modders, normal users shouldnt really notice this
LW2 offers the possibilities to add custom enemies to the InclusionExclusionLists array. However after numerous tests I found this function to be broken. The modifications made (even the ones LW2 does itself, like with the Hivequeen) dont show up in any of the log calls I created. The solution is rather simple. This is the relevant function in UIScreenListener_Shell_LWAlienPack:
The problem here is, that in unrealscript ListItem is just a copy of MissionManager.InclusionExclusionLists[ListIdx], not the array entry itself. The following code fixes the issue:
LW2 offers the possibilities to add custom enemies to the InclusionExclusionLists array. However after numerous tests I found this function to be broken. The modifications made (even the ones LW2 does itself, like with the Hivequeen) dont show up in any of the log calls I created. The solution is rather simple. This is the relevant function in UIScreenListener_Shell_LWAlienPack:
Code: Select all
simulated function UpdateInclusionExclusionLists()
{
local XComTacticalMissionManager MissionManager;
local int ListIdx;
local InclusionExclusionList ListItem;
local InclusionExclusionList_Addition Addition;
MissionManager = `TACTICALMISSIONMGR;
foreach InclusionExclusionMods(Addition)
{
ListIdx = MissionManager.InclusionExclusionLists.Find('ListID', Addition.ListID);
ListItem = MissionManager.InclusionExclusionLists[ListIdx];
ListItem = ListItem; // HAX to prevent warning
ListItem.TemplateName.AddItem(Addition.NewName);
}
}
Code: Select all
simulated function UpdateInclusionExclusionLists()
{
local XComTacticalMissionManager MissionManager;
local int ListIdx;
local InclusionExclusionList ListItem;
local InclusionExclusionList_Addition Addition;
MissionManager = `TACTICALMISSIONMGR;
foreach InclusionExclusionMods(Addition)
{
ListIdx = MissionManager.InclusionExclusionLists.Find('ListID', Addition.ListID);
MissionManager.InclusionExclusionLists[ListIdx].TemplateName.AddItem(Addition.NewName);
}
}