I'm ignoring you, what? Sorry, you never asked me anything?
Anyway, if you want to change them on-the-fly... here's how I did it, probably not how you would like it, but you press a button and it changes to next environment definition in the array:
edit: the fuck is going on with the code formatting, looked way better when I previewed the post...
whatever
pastebin link
of course you need to instantiate this script in another script, like playerWitcher.ws using OnSpawn() or something... because, CDPR decided we have to use existing scripts in order to load custom code, which sucks.
or just add another exec function LoadKNGScript() { instantiate class here, call function Init() } to load the script through console.
also, this could probably be done way better, maybe even through custom menu entries, but whatever I'm done with Witcher 3's ghetto modding kit.
Anyway, if you want to change them on-the-fly... here's how I did it, probably not how you would like it, but you press a button and it changes to next environment definition in the array:
Code:
class ChangeEnvironmentDefinition {
private var environmentDefinitionIndex : Int32;
private var envID : Int32;
private var environmentDefinitions : array<String>;
private var isActive : bool;
public function Init() {
isActive = false;
environmentDefinitionIndex = 0;
GetKeyBinding();
fillTheArray();
}
public function GetKeyBinding() {
theInput.RegisterListener( this, 'OnPressButton', 'ChangeEnvironmentButton' );
}
public function fillTheArray() {
environmentDefinitions.PushBack("environment\definitions\cutscenes_definition\cutscen_definition_global.env");
environmentDefinitions.PushBack("environment\definitions\env_skellige\env_pbr_skellige_v7_tm_fog_sky_b_tm_exp.env");
}
event OnPressButton (action : SInputAction) {
if(IsPressed (action)) {
OnChangeEnvironmentDefinition();
}
}
event OnChangeEnvironmentDefinition () {
if (!isActive) {
OnNextEnvironmentDefinition();
} else if (isActive) {
OnDeactivateEnvironmentDefinition();
}
}
event OnNextEnvironmentDefinition() {
environmentDefinitionIndex += 1;
environmentDefinitionIndex = environmentDefinitionIndex % environmentDefinitions.Size();
UpdateEnvironment();
isActive = true;
}
event OnDeactivateEnvironmentDefinition() {
DeactivateEnvironment(envID, environmentDefinitionIndex);
isActive = false;
}
public function UpdateEnvironment() : Int32 {
var environment : CEnvironmentDefinition;
environment = ( CEnvironmentDefinition )LoadResource( environmentDefinitions[ environmentDefinitionIndex ], true );
if ( environment )
{
envID = ActivateEnvironmentDefinition(environment, 1000, 1.0, 1.000000);
theGame.SetEnvironmentID(envID);
}
return envID;
}
}
whatever
pastebin link
of course you need to instantiate this script in another script, like playerWitcher.ws using OnSpawn() or something... because, CDPR decided we have to use existing scripts in order to load custom code, which sucks.
or just add another exec function LoadKNGScript() { instantiate class here, call function Init() } to load the script through console.
also, this could probably be done way better, maybe even through custom menu entries, but whatever I'm done with Witcher 3's ghetto modding kit.
Last edited:


