Author Topic: Set the environment with a scriptObject?  (Read 429 times)

This is the current weather.cs code:
Code: [Select]
// Rain
if(!isObject(CityRPG_Rain))
{
datablock PrecipitationData(CityRPG_Rain)
{
   //soundProfile = "RainSound";
   dropTexture = "Add-Ons/GameMode_CityRPG/shapes/Skies/Rain/droplet";
   splashTexture = "Add-Ons/GameMode_CityRPG/shapes/Skies/Rain/splash";
   dropSize = 0.50;
   splashSize = 0.2;
   useTrueBillboards = false;
   splashMS = 250;
};
}

if(!isObject(CityRPG_Rain_Texture))
{
datablock decalData(CityRPG_Rain_Texture)
{
textureName = "Add-Ons/GameMode_CityRPG/shapes/Skies/Rain/droplet";
preload = true;
};
}

if(!isObject(CityRPG_Splash_Texture))
{
datablock decalData(CityRPG_Splash_Texture)
{
textureName = "Add-Ons/GameMode_CityRPG/shapes/Skies/Rain/splash";
preload = true;
};
}

return;

// WeatherBoxes
if(!isObject(WeatherBox_Clear))
{
new InteriorInstance(WeatherBox_Clear)
{
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
interiorFile = "Add-Ons/GameMode_CityRPG/shapes/Skies/Clear/Sky_ClearSky.dif";
useGLLighting = "0";
showTerrainInside = "0";
};
}

So how can I make this work with v21?
I'm looked in some add-ons which change the environment via events and they all seem to use something along the lines of serverCmdEnvGui_SetVar(%client,type,stuff);

I used the environment favourites mod to capture what the environments should be. I have no idea how to implement them.
Code: [Select]
//Sunny variant
SimpleMode 0
SkyIdx 17
WaterIdx 0
GroundIdx 7
SunFlareTopIdx 3
SunFlareBottomIdx 1
DayOffset 0.138776
DayLength 300
DayCycleEnabled 0
DayCycleIdx 0
Sunational socialistmuth 250
SunElevation 35
DirectLightColor 0.700000 0.700000 0.700000 1.000000
AmbientLightColor 0.400000 0.400000 0.300000 1.000000
ShadowColor 0.415888 0.415888 0.504673 1.000000
SunFlareColor 0.000000 0.000000 0.000000 1.000000
SunFlareSize 2
VisibleDistance 600
FogDistance 400
FogHeight 0
FogColor 0.950000 0.950000 1.000000 1.000000
WaterColor 1.000000 1.000000 1.000000 0.501961
WaterHeight 5
UnderWaterColor 0.000000 0.000000 0.501961 0.501961
SkyColor 0.611765 0.725490 0.956863 1.000000
WaterScrollX 0
WaterScrollY 0
GroundColor 0.350467 0.242991 0.084112 1.000000
GroundScrollX 0
GroundScrollY 0
VignetteMultiply 0

Code: [Select]
//Raining variant
SimpleMode 0
SkyIdx 4
WaterIdx 0
GroundIdx 7
SunFlareTopIdx 3
SunFlareBottomIdx 1
DayOffset 0.138776
DayLength 300
DayCycleEnabled 0
DayCycleIdx 0
Sunational socialistmuth 250
SunElevation 35
DirectLightColor 0.700000 0.700000 0.700000 1.000000
AmbientLightColor 0.400000 0.400000 0.300000 1.000000
ShadowColor 0.415888 0.415888 0.504673 1.000000
SunFlareColor 0.000000 0.000000 0.000000 1.000000
SunFlareSize 2
VisibleDistance 600
FogDistance 400
FogHeight 0
FogColor 0.950000 0.950000 1.000000 1.000000
WaterColor 1.000000 1.000000 1.000000 0.501961
WaterHeight 5
UnderWaterColor 0.000000 0.000000 0.501961 0.501961
SkyColor 0.611765 0.725490 0.956863 1.000000
WaterScrollX 0
WaterScrollY 0
GroundColor 0.350467 0.242991 0.084112 1.000000
GroundScrollX 0
GroundScrollY 0
VignetteMultiply 0
I'm fine with not having custom rain/splash textures (infact i'd rather not, it would just be a hassle)

Create an AIConnection and replace %client with the aiconnection:

Code: [Select]
new AIConnection(CityRPG_AI)
{
isAdmin = 1;
isSuperAdmin = 1;
bl_id = 1337;
};

serverCmdEnvGui_SetVar(CityRPG_AI,%type,%val);

example:

serverCmdEnvGui_SetVar(CityRPG_AI,"SunElevation",35);

the above code will set the sun's elevation to 35.
refer to the save favorites for other env stuff.