How to load custom Scene/Location level via script?

Users who are viewing this thread


Hello, I try to figure out how to load or set level visibility to a scene.
My goal is to change dynamically the level of the scene when player is in location "center" of the settlement and go to another location, like tavern for example.

First I have prepare my custom scene to display prefabs on certain level, then I have override OnBeforeMissionBehaviourInitialize and OnMissionBehaviourInitialize on my SubModule to try to modify mission.Scene.
Scene class have methods like SetUpgradeLevelVisibility or SetActiveVisibilityLevels but don't seem to really modify it when MissionBehaviourInitialize is call.
My code test:
uint mask = mission.Scene.GetUpgradeLevelMaskOfLevelName("level_3");
mission.Scene.SetActiveVisibilityLevels(new List<string> { "level_3" });

When I debug after those lines:
mask = 8 -> the right uint for level_3;
mission.SceneLevels = "civilian level_1"

Methods are maybe call too late cause scene is already initialize?
Do you think is possible to change these level via another way?

Thanks in advance for your replies.
Top Bottom