long-war-2 / lwotc

Port of Long War 2 to XCOM 2's War of the Chosen expansion
339 stars 89 forks source link

LWForceRecruitRoll console command not working #1749

Open red2345 opened 1 month ago

red2345 commented 1 month ago

exec function LWForceRecruitRoll does not function correctly in LWOTC. The command is accepted in the console without error but nothing happens, even after waiting several days.

Source code from github:

exec function LWForceRecruitRoll(int Roll, optional name RegionName)
{
    local XComGameStateHistory History;
    local XComGameState NewGameState;
    local XComGameState_WorldRegion RegionState;
    local XComGameState_LWOutpost OutpostState;
    local XComGameState_LWOutpostManager OutpostManager;

    History = `XCOMHISTORY;

    NewGameState = class'XComGameStateContext_ChangeContainer'.static.CreateChangeState("CHEAT: ForceRecruitRoll");
    OutpostManager = class'XComGameState_LWOutpostManager'.static.GetOutpostManager();

    foreach History.IterateByClassType(class'XComGameState_WorldRegion', RegionState)
    {
        if(RegionName == '' || RegionState.GetMyTemplateName() == RegionName)
        {
            OutpostState = OutpostManager.GetOutpostForRegion(RegionState);
            OutpostState = XComGameState_LWOutpost(NewGameState.CreateStateObject(class'XComGameState_LWOutpost', OutpostState.ObjectID));
            NewGameState.AddStateObject(OutpostState);
            OutpostState.ForceRecruitRoll = Roll;
        }
    }

    if (NewGameState.GetNumGameStateObjects() > 0)
        `XCOMGAME.GameRuleset.SubmitGameState(NewGameState);
    else
        History.CleanupPendingGameState(NewGameState);
}
Tedster59 commented 1 month ago

The command appears to override the RNG of the normal recruit job to determine what gets rolled (rebel, soldier, or possibly engineer/scientist in liberated region). You still need to actually recruit. Are you actually running the recruit job in the selected region?