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

Members Online

»
0 Active | 55 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

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 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: adding rain
TheArmy
General Member
Since: Jun 24, 2006
Posts: 599
Last: Dec 25, 2009
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Tuesday, Mar. 18, 2008 06:15 am
I have followed the tutorials, but I keep getting a script compile error and when I look in the console I can't seem to find the error. So I am going to post my code and if someone could please take a look I would really appreciate it. Or if someone else can show me another way to have rain. Thanks.

mp_mymapname.gsc
Code:
main()
{
maps\mp\mp_spikeshockzombie_fx::main();
maps\mp\_load::main();
maps\mp\mp_rain::main();

// setExpFog(0.0001, 0.55, 0.6, 0.55, 0);
// setCullFog(0, 16500, 0.55, 0.6, 0.55, 0);
ambientPlay("ambient_mp_spikeshockzombie");

game["allies"] = "american";
game["axis"] = "german";
game["attackers"] = "allies";
game["defenders"] = "axis";
game["american_soldiertype"] = "africa";
game["german_soldiertype"] = "africa";

// Set some cvars
setcvar("r_glowbloomintensity0","1");
setcvar("r_glowbloomintensity1","1");
setcvar("r_glowskybleedintensity0",".5");

sound = getentarray("current", "targetname");

for (i=0; i < sound.size; i++)
{
        sound[i] playloopsound("current"); 
}

thread shock_sound();
}

shock_sound()
{
        trigger = getentarray ("shock_trigger", "targetname");
        for (i=0; i<trigger.size; i++)
        {
               trigger[i] thread shockWatch();
	}
}

shockWatch()
{
    while(1)
    {
        self waittill("trigger", player);
   
        player playsound("shock");
     }
}


mp_mymapname_fx.gsc
Code:
main()
{
precacheFX();
ambientFX();
level.scr_sound["flak88_explode"] = "flak88_explode";
}

precacheFX()
{

level._effect["flak_explosion"] = loadfx("fx/explosions/flak88_explosion.efx");
level._effect["ground_fire_med"] = loadfx("fx/fire/ground_fire_med.efx");

}


ambientFX()
{

level._effect["thin_light_smoke_L"] = loadfx ("fx/smoke/thin_light_smoke_L.efx");

level._effect["fogbank_small_duhoc"] = loadfx ("fx/misc/fogbank_small_duhoc.efx");

level._effect["insects_carcass_flies"] = loadfx ("fx/misc/insects_carcass_flies.efx");

level._effect["building_fire_distant"] = loadfx ("fx/fire/building_fire_distant.efx");

level.rasta_cod2_rain = loadfx ("fx/misc/rain_light.efx");

}


mp_rain.gsc
Code:
//Script by rasta, please credit if used
main()
{
level thread rasta_cod2_rain();
}

rasta_cod2_rain()

{
zufall = RandomInt(100);

while(1) {


players = getentarray("player", "classname");

if(players.size > 0) {

max_nodes = 20;
max_nodes_per_player = max_nodes/players.size;


for(ii=0;ii

for(i = 0; i < players.size; i++) {

player = players[i];

if(isAlive(player)) {

x= 350-randomfloat(700);
y= 350-randomfloat(700);

pos = player.origin +(x,y,200) ;
trace = bulletTrace(pos,pos +(0,0,-250), true, undefined);

if(trace["fraction"] != 1) playfx(level.rasta_cod2_rain,trace["position"]);
wait 0.05;

}
}
}
}

wait 0.05;
}
}
Share |
TheArmy
General Member
Since: Jun 24, 2006
Posts: 599
Last: Dec 25, 2009
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Tuesday, Mar. 18, 2008 01:54 pm
bump please
Share |
TheArmy
General Member
Since: Jun 24, 2006
Posts: 599
Last: Dec 25, 2009
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Tuesday, Mar. 18, 2008 10:02 pm
bump please
Share |
TheArmy
General Member
Since: Jun 24, 2006
Posts: 599
Last: Dec 25, 2009
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Wednesday, Mar. 19, 2008 03:49 pm
bump please
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Wednesday, Mar. 19, 2008 03:56 pm
mp_rain.gsc:
Code:
//Script by rasta, please credit if used
main()
{
level thread rasta_cod2_rain();
}

rasta_cod2_rain()
{
	zufall = RandomInt(100);

	while(1)
	{
		players = getentarray("player", "classname");

		if(players.size > 0)
		{
			max_nodes = 20;
			max_nodes_per_player = max_nodes/players.size;

			for(j=0;j<max_nodes_per_player;j++)
			{
				for(i = 0; i < players.size; i++)
				{
					player = players[i];

					if(isAlive(player))
					{
						x= 350-randomfloat(700);
						y= 350-randomfloat(700);

						pos = player.origin +(x,y,200);

						// increase value if rain goes through buildings (default: -250)
						trace = bulletTrace(pos,pos +(0,0,-250), true, undefined);

						if(trace["fraction"] != 1) playfx(level.rasta_cod2_rain,trace["position"]);
						wait 0.05;
					}
				}
			}
		}

		wait 0.05;
	}
}
Share |
TheArmy
General Member
Since: Jun 24, 2006
Posts: 599
Last: Dec 25, 2009
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Wednesday, Mar. 19, 2008 05:07 pm
thanks that seemed to work. couple more things.

1) It rains inside buildings. Help with that please.

2) How do I add lightning?

Thanks...
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Wednesday, Mar. 19, 2008 06:18 pm
// increase value if rain goes through buildings (default: -250)
trace = bulletTrace(pos,pos +(0,0,-250), true, undefined);



(TUTORIAL).. How to add Rain/Thunder & Lightning to your Maps. (CoD4)

really old tutorial: Adding Thunder and Lightning (CoD1)
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Wednesday, Mar. 19, 2008 06:31 pm
sorry, link was to page 4 of the thread:

http://www.modsonline.com/Forums-top-75472-0.html
Share |
COLMAC
General Member
Since: Sep 15, 2006
Posts: 914
Last: Jan 27, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Wednesday, Mar. 19, 2008 06:58 pm
i just full clip the roofs and it wont rain in side "easy way for me"
as for lightning in weather for us dummys there is a gsc copy it from mine add were you want it to go in the lines
maps\mp\_fx::loopfx('lightning",(000, 000, 000), 3)
first 3 are where ,the last number is how often
Share |
TheArmy
General Member
Since: Jun 24, 2006
Posts: 599
Last: Dec 25, 2009
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Thursday, Mar. 20, 2008 07:09 am
i tried the full clip it did not work??? and none of those tutorials are for cod2, will they still work???

edited on Mar. 20, 2008 03:20 am by TheArmy
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

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

»