Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 5 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 MP Mapping
CoD 4 mapping and level design for multiplayer.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Rain or Snow
pa1n
General Member
Since: Feb 5, 2008
Posts: 25
Last: Sep 5, 2010
[view latest posts]
Level 1
Category: CoD4 MP Mapping
Posted: Tuesday, Feb. 5, 2008 07:06 pm
Hi All

am new to forum and i need some help with weather effects

I have read throught the ones i can find in the forum but i cant grasp the code.

All i was wanting was heavy rain in my map with the rain sound. I guess lightning would be cool but i think thats for another day.

I dont understand about the gsc files or the fx files. Is it possible for some-one to make me a script to do what i need ?

[drink]

edited on Feb. 5, 2008 02:07 pm by pa1n
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD4 MP Mapping
Posted: Tuesday, Feb. 5, 2008 08:36 pm
Did you try the tutorial for rain?

If so, what do you not understand about the script? It should work as it is.. though you might need another fx file because the tutorial is for CoD2.

Those effects can be found in the CoD4/raw/fx/weather folder.
Share |
pa1n
General Member
Since: Feb 5, 2008
Posts: 25
Last: Sep 5, 2010
[view latest posts]
Level 1
Category: CoD4 MP Mapping
Posted: Wednesday, Feb. 6, 2008 08:29 pm
Hi there

Yes thats the one i looked at. I worked out that the link for the fx was wrong but im unsure how to use it.

Can i make the gsc file and the _fx file from txt files renamed extensions to a gsc or fx file.

If so i made them and i had a error to do with a } i dont understand script like this so its hard to work out where the script fails. Its been while since i have made any maps. The last was for Quake 2 .

I guess i need help with the error and a bit of guidance.

I appriciate the help
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Wednesday, Feb. 6, 2008 08:47 pm
cod4 has a small weather engine, try to figure out how to let it rain. you shoudn't use the old cod2-script unless the cod4 stock rain doesn't work or isn't what you want
Share |
Mystic
General Member
Since: Apr 10, 2004
Posts: 6147
Last: Apr 15, 2018
[view latest posts]
Level 10
Forum Moderator
Im a fan of MODSonair
Category: CoD4 MP Mapping
Posted: Wednesday, Feb. 6, 2008 08:58 pm
I tried the rain script with cod4 and it appear to work fine.. Make sure you use small effect though, there are weather efx called some like rain_mp_cargoship and rain_mp_farm (something similar to that) but those efx are extremely large and due to the script repeating it every x amount of second the game will lagg to a stop very quickly.
Share |
pa1n
General Member
Since: Feb 5, 2008
Posts: 25
Last: Sep 5, 2010
[view latest posts]
Level 1
Category: CoD4 MP Mapping
Posted: Wednesday, Feb. 6, 2008 09:54 pm
Could i see some working script for rain.

I get a compile error of } when i try using the cod2 script.

And is it correct to make a gsc from a txt file re-badged as map name with gsc on the end?

Also on the MP map downpour on the edge of certain buldings it looks like larger amounts of water falling from the building is that a decal?


edited on Feb. 6, 2008 04:56 pm by pa1n
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Wednesday, Feb. 6, 2008 10:07 pm
gsc-files are plaintext files. simply rename file extention from .txt to .gsc

make sure your Windows shows the file extension!
Quote:
How do I make file extensions appear in Windows?

Sometimes files may appear without showing their file extensions e.g. the Word file letter.doc may appear simply as letter. It is good practice to work with file extensions showing to avoid mistaking one file for another (e.g. index.html.txt appears the same as index.html if editing in Notepad) - note that files with double extensions often pose a high virus risk.

To make file extensions always appear in Vista:

1. Open Computer (or any folder window)
2. Choose Organize from the menu
3. Choose Folder and Search Options
4. Click on the View tab
5. Under Advanced settings untick the box beside Hide file extensions for known file types
6. Click on OK

To make file extensions always appear in Windows 2000/XP:

1. Open My Computer (or any folder window)
2. Choose Folder Options from the Tools menu
3. Click on the View tab
4. In Advanced settings untick the box beside Hide file extensions for known file types
5. Click on Apply to all folders or Like current folder and OK to the message that appears
6. Click on OK to close the Folder Options window
Share |
pa1n
General Member
Since: Feb 5, 2008
Posts: 25
Last: Sep 5, 2010
[view latest posts]
Level 1
Category: CoD4 MP Mapping
Posted: Wednesday, Feb. 6, 2008 10:27 pm
Thanks sevenz i thought that was the case.

Just not sure how to get rid of the errors i get.
[banghead]

It must be easy to get level wide rain. How do i work the cod4 weather engine???
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Wednesday, Feb. 6, 2008 11:21 pm
multiplayer script: maps\mp\mp_farm_fx.gsc
Code:

main()
{
	level._effect[ "wood" ]					 = loadfx( "explosions/grenadeExp_wood" );
	level._effect[ "dust" ]					 = loadfx( "explosions/grenadeExp_dirt_1" );
	level._effect[ "brick" ]				 = loadfx( "explosions/grenadeExp_concrete_1" );
	level._effect[ "coolaidmanbrick" ]		 = loadfx( "explosions/grenadeExp_concrete_1" );
	level._effect[ "rain_heavy_mist" ]		 = loadfx( "weather/rain_mp_farm" );
	level._effect[ "lightning" ]			 = loadfx( "weather/lightning_mp_farm" );
	level._effect[ "cgoshp_drips_a" ]		 = loadfx( "misc/cgoshp_drips_a" );

	//ambient runners
	level._effect[ "rain_splash_mp_farm" ]	 = loadfx( "ambient_runners/mp_farm_rain_splash01" );
	level._effect[ "water_noise_ud" ]		 = loadfx( "ambient_runners/mp_farm_water_noise_ud01" );
	level._effect[ "water_noise" ]			 = loadfx( "ambient_runners/mp_farm_water_noise01" );

	
/#

	if ( getdvar( "clientSideEffects" ) != "1" )
		maps\createfx\mp_farm_fx::main();
#/		

}

don't know if this is all what you have to do - adding loadfx() commands to your map fx gsc. probably not, i think you have to do something within radiant...


singleplayer(?) script: maps\_weather.gsc
Code:
// Utility rain functions:
#include maps\_utility;


rainHard(transition)
{
	println ("Rain becomes Hard over " + transition + " seconds");
	level notify ("rain_change", "hard", transition);
	level thread rainEffectChange(10, transition);
	wait (transition*0.5);
	level.ambient_modifier["rain"] = "";
	//	This is commented out until ambient weather sounds are added to the tree
	//maps\_ambient::activateAmbient( level.ambient );
	wait (transition*0.5);
}

rainLight(transition)
{
	println ("Rain becomes Light over " + transition + " seconds");
	level notify ("rain_change", "light", transition);
	level thread rainEffectChange(5, transition);
	wait (transition*0.5);
	level.ambient_modifier["rain"] = "light";
	//	This is commented out until ambient weather sounds are added to the tree
	//maps\_ambient::activateAmbient( level.ambient );
	wait (transition*0.5);
}

rainNone(transition)
{
	println ("Rain fades out over " + transition + " seconds");
	level notify ("rain_change", "none", transition);
	level thread rainEffectChange(0, transition);
	wait (transition*0.5);
	level.ambient_modifier["rain"] = "norain";
	//	This is commented out until ambient weather sounds are added to the tree
	//maps\_ambient::activateAmbient( level.ambient );
	wait (transition*0.5);
}

rainInit(lvl)
{
	if (lvl == "none")
	{
		level.rainLevel = 0; // starting rain level
		level._effect["rain_drops"] = level._effect["rain_" + level.rainLevel];
		rainNone(0.1);
	}
	else
	if (lvl == "light")
	{
		level.rainLevel = 5; // starting rain level
		level._effect["rain_drops"] = level._effect["rain_" + level.rainLevel];
		rainLight(0.1);
	}
	else
	{
		level.rainLevel = 10; // starting rain level
		level._effect["rain_drops"] = level._effect["rain_" + level.rainLevel];
		rainHard(0.1);
	}
}


lightning(normal, flash)
{
	[[normal]]();
	waittillframeend; // so exploders get setup
	for (;;)
		lightningThink(normal, flash);
}

////// 
/*
	BELOW THIS LINE IS INTERNAL RAIN FUNCTIONS
*/
////// 

rainEffectChange(change, transition)
{
	level notify ("rain_level_change");
	level endon ("rain_level_change");
	if (level.rainLevel > change)
	{
		dif = level.rainLevel - change;
		transition /= dif;
		for (i=0;i<dif;i++)
		{
			wait (transition);
			level.rainLevel--;
			level._effect["rain_drops"] = level._effect["rain_" + level.rainLevel];
		}
		assert (level.rainLevel == change);
	}
	if (level.rainLevel < change)
	{
		dif = change - level.rainLevel;
		transition /= dif;
		for (i=0;i<dif;i++)
		{
			wait (transition);
			level.rainLevel++;
			level._effect["rain_drops"] = level._effect["rain_" + level.rainLevel];
		}
		assert (level.rainLevel == change);
	}
}


addLightningExploder(num)
{
	if (!isdefined(level.lightningExploder))
	{
		level.lightningExploder = [];
		level.lightningExploderIndex = 0;
	}
		
	level.lightningExploder[level.lightningExploder.size] = num;
}

playerWeather()
{
	player = getent("player","classname");
	for (;;)
	{
//		playfx ( level._effect["rain_heavy"], player.origin + (0,0,650), player.origin + (0,0,680) );
//		playfx ( level._effect["rain_heavy_cloudtype"], player.origin + (0,0,650));
		playfx ( level._effect["rain_drops"], player.origin + (0,0,650), player.origin + (0,0,680) );
		if (level.rainLevel >= 8)
			playfx ( level._effect["rain_heavy_cloudtype"], player.origin + (0,0,650));
		wait (0.3);
	}
}




rainlevelRandomwait()
{
	if (level.rainLevel == 0)
		return (randomfloat (30));
	else
	if (level.rainLevel == 1)
		return (randomfloat (24));
	else
	if (level.rainLevel == 2)
		return (randomfloat (20));
	else
	if (level.rainLevel == 3)
		return (randomfloat (15));
	else
	if (level.rainLevel == 4)
		return (randomfloat (12));
	else
	if (level.rainLevel == 5)
		return (randomfloat (9));
	else
	if (level.rainLevel == 6)
		return (randomfloat (8));
	else
	if (level.rainLevel == 7)
		return (randomfloat (8));
	else
	if (level.rainLevel == 8)
		return (randomfloat (7));
	else
	if (level.rainLevel == 9)
		return (randomfloat (6));
	else
	if (level.rainLevel == 10)
		return (randomfloat (5));
}

rainlevelwait()
{
	if (level.rainLevel == 0)
		return (20);
	else
	if (level.rainLevel == 1)
		return (18);
	else
	if (level.rainLevel == 2)
		return (16);
	else
	if (level.rainLevel == 3)
		return (14);
	else
	if (level.rainLevel == 4)
		return (12);
	else
	if (level.rainLevel == 5)
		return (10);
	else
	if (level.rainLevel == 6)
		return (9);
	else
	if (level.rainLevel == 7)
		return (8);
	else
	if (level.rainLevel == 8)
		return (7);
	else
	if (level.rainLevel == 9)
		return (6);
	else
	if (level.rainLevel == 10)
		return (5);
}

lightningThink(normal, flash)
{
	level endon ("rain_change");

	// in case we get broken out, we may have lightning sooner than planned if we're getting rainier
	nextStrike = gettime() + ((rainlevelwait() + rainlevelRandomwait())*1000);
	if (nextStrike < level.nextLightning)
		level.nextLightning = nextStrike;

	for (;;)
	{
		timer = (level.nextLightning - gettime()) * 0.001;
		if (timer > 0)
			wait (timer);
			
		lightningFlash(normal, flash);
		level.nextLightning = gettime() + ((rainlevelwait() + rainlevelRandomwait())*1000);
	}
}

fogflash(flashfunc)
{
//	level.lightningExploderIndex = 2;
	if (isdefined (level.lightningExploderIndex))
		exploder(level.lightningExploder[level.lightningExploderIndex]);

	[[flashfunc]]();
//	wait (0.1);
}

lightningFlash(normal, flashfunc)
{
	flash[0] = "quick";
	flash[1] = "double";
	flash[2] = "triple";
//	This is commented out until thunder sounds are added to the tree
	thread thunder();			
	flashType = randomint(flash.size);

	lit_num = 0;
	if (isdefined (level.lightningExploderIndex))
	{
		while (lit_num == level.lightningExploderIndex)
			lit_num = randomint(level.lightningExploder.size);
		level.lightningExploderIndex = lit_num;
	}

//	flashtype = 2;
	switch (flash[flashType])
	{
		case "quick":
		{
			fogflash(flashfunc);
			break;
		}
		case "double":
		{
			fogflash(flashfunc);
			wait (0.05);
			fogflash(flashfunc);
			break;
		}
		case "triple":
		{
			fogflash(flashfunc);
			wait (0.05);
			fogflash(flashfunc);
			wait (0.5);
			fogflash(flashfunc);
			break;
		}
	}
}

thunder()
{
	if (level.rainLevel == 0)
		wait (6 + randomfloat(2));
	else
	if (level.rainLevel == 1)
		wait (5 + randomfloat(1.8));
	else
	if (level.rainLevel == 2)
		wait (4.5 + randomfloat(1.6));
	else
	if (level.rainLevel == 3)
		wait (4 + randomfloat(1.6));
	else
	if (level.rainLevel == 4)
		wait (3.5 + randomfloat(1.5));
	else
	if (level.rainLevel == 5)
		wait (3 + randomfloat(1.5));
	else
	if (level.rainLevel == 6)
		wait (2.5 + randomfloat(1.2));
	else
	if (level.rainLevel == 7)
		wait (2 + randomfloat(1));
	else
	if (level.rainLevel == 8)
		wait (1.9 + randomfloat(0.5));
	else
	if (level.rainLevel == 9)
		wait (1.5);
	else
	if (level.rainLevel == 10)
		wait (1);
	
	ent = spawn ("script_origin",(0,0,0));
	ent.origin = level.player.origin + (0,0,60);
	ent linkto (level.player);
	if (level.rainlevel <= 8)
		ent playsound ("elm_thunder_distant", "sounddone");
	else
	{
		ent playsound ("elm_thunder_distant", "sounddone");
		ent thread play_sound_on_entity ("elm_thunder_strike");
	}	
//	iprintlnbold ("thunder!");	
	ent waittill ("sounddone");
	ent delete();	
}


edited on Feb. 6, 2008 06:26 pm by Sevenz
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Wednesday, Feb. 6, 2008 11:36 pm
(more related files):

maps\createart\mp_farm_art.gsc
Code:
// _createart generated.  modify at your own risk. Changing values should be fine.
main()
{

	level.tweakfile = true;
 

	//* Fog section * 

	setdvar( "scr_fog_disable", "0" );

	setExpFog(300, 1400, 0.5, 0.5, 0.5, 0);
	VisionSetNaked( "mp_farm", 0 );

}


maps\mp_farm.gsc
Code:
main()
{
	maps\mp\mp_farm_fx::main();
	maps\createart\mp_farm_art::main();
	maps\mp\_load::main();

	maps\mp\_compass::setupMiniMap("compass_map_mp_farm");

	//setExpFog(300, 1400, 0.5, 0.5, 0.5, 0);
	ambientPlay("ambient_farm");
	//VisionSetNaked( "mp_farm" );
	
	game["allies"] = "sas";
	game["axis"] = "russian";
	game["attackers"] = "allies";
	game["defenders"] = "axis";
	game["allies_soldiertype"] = "woodland";
	game["axis_soldiertype"] = "woodland";

	setdvar( "r_specularcolorscale", "5" );

	setdvar("compassmaxrange","2000");
}


two rain-related functions are located in fx.gsc, but they are commented out!
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 MP Mapping

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»