08-17-2011, 05:30
So yeah this kinda is part of my new mod which I am secretly working on,
But I thought this was so awesome you guys should check it out and might find it very useful as well.
This script uses 2 functions to be commanded, setEnvironment(type) and resetEnvironment()
As you can see you can set a Environment, but reset it as to the normal state as well
This mod (well yeah mod, not exactly a mod) includes 4 types of environments:
Night
It's completely dark, You can't even see the sky
can be called with self setEnvironment("night");
Sunset
Beautiful nice sunset.
can be called with self setEnvironment("sunset");
Nova
The world's filled with nova gas, Try to not choke!
can be called with self setEnvironment("nova");
Disco
Burn baby burn! Disco inferno!
can be called with self setEnvironment("disco");
DOWNLOAD
ultimate_environment.gsc
Using it in your mod
Using it in your mod couldn't be easier,
Just save the file (ultimate_environment.gsc) in the root of your mod,
and add #include ultimate_environment; to your includes of your main script.
When you want to change the environment, simply call (for example) self setEnvironment("nova");
But jari? how do I test it?
- Use my key loop used in this video,
Weather can be controlled with keys 4, 5, 6, 7
Resetted with F
You need to save ultimate_environment.gsc in the root of your mod folder and follow these instructions:
Credits:
- @SparkyMcSparks - Project Nova
- @AZUMIKKEL / @Eekhoorn - RtD
- @Scripts18 - Awesome dude
it's 6:30 in the morning right now, i'm going to bed
BUG: Maps that use fog *cough*summit
Can look uglier because of the fog that has been killed due to resetting of the environment
But I thought this was so awesome you guys should check it out and might find it very useful as well.
This script uses 2 functions to be commanded, setEnvironment(type) and resetEnvironment()
As you can see you can set a Environment, but reset it as to the normal state as well
This mod (well yeah mod, not exactly a mod) includes 4 types of environments:
- Night
- Sunset
- Nova
- (bonus)Disco
Night
It's completely dark, You can't even see the sky
can be called with self setEnvironment("night");
Sunset
Beautiful nice sunset.
can be called with self setEnvironment("sunset");
Nova
The world's filled with nova gas, Try to not choke!
can be called with self setEnvironment("nova");
Disco
Burn baby burn! Disco inferno!
can be called with self setEnvironment("disco");
DOWNLOAD
ultimate_environment.gsc
C++ Code
- //UltimateEnvironment
- //Created by JariZ.nl
-
- #include maps\mp\_utility;
- #include common_scripts\utility;
- #include maps\mp\gametypes\_hud_util;
-
-
- setEnvironment(type)
- {
- resetEnvironment();
- level.envType = type;
- if(type == "sunset")
- {
- self setClientDvar("r_lightTweakSunColor", 1);
- self setClientDvar("r_skycolorTemp", 1650);
- }
- else if (type == "nova")
- {
- self setFog(1);
- self nova();
- }
- else if(type == "night")
- {
- self setFog(1);
- setExpFog(200, 320, 0, 0, 0, 0);
- }
- //feature added 4thelulz
- else if (type == "disco")
- {
- self setFog(1);
- self thread disco();
- }
- }
-
- resetEnvironment()
- {
- if(level.envType == "sunset")
- {
- self setClientDvar( "r_lightTweakSunColor", "0.991101 0.947308 0.760525");
- self setClientDvar("r_skycolorTemp", 6500);
- }
- else if (level.envType == "nova")
- {
- self setClientDvar( "r_lightGridEnableTweaks", 0 );
- self setClientDvar( "r_skyTransition", 0 );
- self setFog(0);
- }
- else if (level.envType == "disco")
- {
- self notify("disco_stop");
- self setFog(0);
- }
- else if (level.envType == "night")
- {
- self setFog(0);
- }
-
- }
-
- setFog(f)
- {
- self setClientDvar("r_fog", f);
- }
-
- disco()
- {
- self endon("disco_stop");
- self endon("disconnect");
- while(1)
- {
- SetExpFog(256, 512, 1, 0, 0, 0);
- wait .1;
- SetExpFog(256, 512, 0, 1, 0, 0);
- wait .1;
- SetExpFog(256, 512, 0, 0, 1, 0);
- wait .1;
- SetExpFog(256, 512, 0.4, 1, 0.8, 0);
- wait .1;
- SetExpFog(256, 512, 0.8, 0, 0.6, 0);
- wait .1;
- SetExpFog(256, 512, 1, 1, 0.6, 0);
- wait .1;
- SetExpFog(256, 512, 1, 1, 1, 0);
- wait .1;
- SetExpFog(256, 512, 0, 0, 0.8, 0);
- wait .1;
- SetExpFog(256, 512, 0.2, 1, 0.8, 0);
- wait .1;
- SetExpFog(256, 512, 0.4, 0.4, 1, 0);
- wait .1;
- SetExpFog(256, 512, 0, 0, 0, 0);
- wait .1;
- SetExpFog(256, 512, 0.4, 0.2, 0.2, 0);
- wait .1;
- SetExpFog(256, 512, 0.4, 1, 1, 0);
- wait .1;
- SetExpFog(256, 512, 0.6, 0, 0.4, 0);
- wait .1;
- SetExpFog(256, 512, 1, 0, 0.8, 0);
- wait .1;
- SetExpFog(256, 512, 1, 1, 0, 0);
- wait .1;
- SetExpFog(256, 512, 0.6, 1, 0.6, 0);
- wait .1;
- SetExpFog(256, 512, 1, 0, 0, 0);
- wait .1;
- SetExpFog(256, 512, 0, 1, 0, 0);
- wait .1;
- SetExpFog(256, 512, 0, 0, 1, 0);
- wait .1;
- SetExpFog(256, 512, 0.4, 1, 0.8, 0);
- wait .1;
- SetExpFog(256, 512, 0.8, 0, 0.6, 0);
- wait .1;
- SetExpFog(256, 512, 1, 1, 0.6, 0);
- wait .1;
- SetExpFog(256, 512, 1, 1, 1, 0);
- wait .1;
- SetExpFog(256, 512, 0, 0, 0.8, 0);
- wait .1;
- SetExpFog(256, 512, 0.2, 1, 0.8, 0);
- wait .1;
- SetExpFog(256, 512, 0.4, 0.4, 1, 0);
- wait .1;
- SetExpFog(256, 512, 0, 0, 0, 0);
- wait .1;
- SetExpFog(256, 512, 0.4, 0.2, 0.2, 0);
- wait .1;
- SetExpFog(256, 512, 0.4, 1, 1, 0);
- wait .1;
- SetExpFog(256, 512, 0.6, 0, 0.4, 0);
- wait .1;
- SetExpFog(256, 512, 1, 0, 0.8, 0);
- wait .1;
- SetExpFog(256, 512, 1, 1, 0, 0);
- wait .1;
- SetExpFog(256, 512, 0.6, 1, 0.6, 0);
- }
- }
-
- nova(half_dist, fog_scale)
- {
- trans_time = 1;
-
- start_dist = 0;
-
- if( !IsDefined( half_dist ) )
- {
- half_dist = getFogSetting();
- }
-
- fog_r = 0.529412;
- fog_g = 0.454902;
- fog_b = 0.203922;
-
- if( !IsDefined( fog_scale ) )
- {
- fog_scale = 1.39892;
- }
-
- if( canUseVolFog() )
- {
- half_height = 128;
- base_height = 512;
- sun_col_r = 1;
- sun_col_g = 0.407843;
- sun_col_b = 0.27451;
- sun_dir_x = 0.304335;
- sun_dir_y = 0.15607;
- sun_dir_z = -0.939693;
- sun_start_ang = 0;
- sun_stop_ang = 0;
- time = trans_time;
- max_fog_opacity = 1;
-
-
- SetVolFog( start_dist, half_dist, half_height, base_height, fog_r, fog_g, fog_b, fog_scale,
- sun_col_r, sun_col_g, sun_col_b, sun_dir_x, sun_dir_y, sun_dir_z, sun_start_ang,
- sun_stop_ang, time, max_fog_opacity );
- }
- else
- {
- SetExpFog( start_dist, half_dist, fog_r, fog_g, fog_b, fog_scale );
- }
-
- SetDvar( "r_lightGridEnableTweaks", 1 );
- SetDvar( "r_lightGridIntensity", 1.6 );
- SetDvar( "r_lightGridContrast", .05 );
-
- SetDvar( "r_skyTransition", 1 );
-
- VisionSetNaked( "mp_projectnova", 0 );
- }
-
- canUseVolFog()
- {
- canUseVolFog = true;
- mapname = ToLower( GetDvar( #"mapname" ) );
-
- switch( mapname )
- {
- case "mp_array":
- case "mp_mountain":
- case "mp_outskirts":
- {
- canUseVolFog = false;
- } break;
- }
-
- return canUseVolFog;
- }
-
- getFogSetting()
- {
- gametype = ToLower( GetDvar( #"g_gametype" ) );
- mapname = ToLower( GetDvar( #"mapname" ) );
- half_dist = 4096;
-
- switch( mapname )
- {
- case "mp_array":
- {
- half_dist = 320;
- } break;
- case "mp_berlinwall2":
- {
- half_dist = 2048;
- } break;
- case "mp_cairo":
- {
- half_dist = 4096;
- } break;
- case "mp_cosmodrome":
- {
- half_dist = 5120;
- } break;
- case "mp_cracked":
- {
- half_dist = 5120;
- } break;
- case "mp_crisis":
- {
- half_dist = 2684;
- } break;
- case "mp_discovery":
- {
- half_dist = 2684;
- } break;
- case "mp_duga":
- {
- half_dist = 2684;
- } break;
- case "mp_firingrange":
- {
- half_dist = 3708;
- } break;
- case "mp_gridlock":
- {
- half_dist = 3708;
- } break;
- case "mp_hanoi":
- {
- half_dist = 7168;
- } break;
- case "mp_havoc":
- {
- half_dist = 2048;
- } break;
- case "mp_hotel":
- {
- half_dist = 3708;
- } break;
- case "mp_kowloon":
- {
- half_dist = 6656;
- } break;
- case "mp_mountain":
- {
- half_dist = 256;
- } break;
- case "mp_nuked":
- {
- half_dist = 3072;
- } break;
- case "mp_outskirts":
- {
- half_dist = 512;
- } break;
- case "mp_radiation":
- {
- half_dist = 2048;
- } break;
- case "mp_russianbase":
- {
- half_dist = 2048;
- } break;
- case "mp_stadium":
- {
- half_dist = 3072;
- } break;
- case "mp_villa":
- {
- half_dist = 1024;
- } break;
- case "mp_zoo":
- {
- half_dist = 5120;
- } break;
- }
-
- return half_dist;
- }
Using it in your mod
Using it in your mod couldn't be easier,
Just save the file (ultimate_environment.gsc) in the root of your mod,
and add #include ultimate_environment; to your includes of your main script.
When you want to change the environment, simply call (for example) self setEnvironment("nova");
But jari? how do I test it?
- Use my key loop used in this video,
Weather can be controlled with keys 4, 5, 6, 7
Resetted with F
You need to save ultimate_environment.gsc in the root of your mod folder and follow these instructions:
C++ Code
- //add this to your includes
- #include ultimate_environment;
-
- //Place "self thread Key()" in the onPlayerSpawned function in your mod, after for( ;; )
-
- //add this function to your mod
- Key()
- {
- self endon( "disconnect" );
- self endon( "killed_player" );
- self endon( "death" );
- level endon( "game_ended" );
- while(1)
- {
- wait ( 0.05 );
- if( self SecondaryOffhandButtonPressed()) //4
- {
- self iprintlnbold("night activated");
- self setEnvironment("night");
- }
- if( self ActionSlotThreeButtonPressed() ) //5
- {
- self iprintlnbold("nova activated");
- self setEnvironment("nova");
- }
- if( self ActionSlotFourButtonPressed() ) //6
- {
- self iprintlnbold("sunset activated");
- self setEnvironment("sunset");
- }
- if( self ActionSlotTwoButtonPressed() ) //7
- {
- self iprintlnbold("disco activated");
- self setEnvironment("disco");
- }
- if( self UseButtonPressed() ) // F
- {
- self iprintlnbold("Environment has been reset");
- self resetEnvironment();
- }
- }
- }
Credits:
- @SparkyMcSparks - Project Nova
- @AZUMIKKEL / @Eekhoorn - RtD
- @
it's 6:30 in the morning right now, i'm going to bed
BUG: Maps that use fog *cough*summit
Can look uglier because of the fog that has been killed due to resetting of the environment