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

Members Online

»
0 Active | 8 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 Scripting
Scripting and coding with Call of Duty 4.
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: Explosions at defined points, need some help
SWS2000
General Member
Since: May 12, 2006
Posts: 193
Last: Jun 14, 2008
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Thursday, Feb. 21, 2008 08:13 pm
I want to have some explosions after my MIG29's flyby my map.

I get some clusterbombs working with the help of the COD totorial about the mortars. But, they only explode random at the differnt places.

I have 4 script_origins in my map with the targetnames mortar1 to mortar4.

The script I am using compiles without error, even the game loads the map and starts it, but no explosions[ohwell].

Here is the script I am using
Code:
main(){ 

    // Specify two different explosion effects to randomly play

    level._effect["mortar_explosion"][0] = loadfx("clusterbomb_exp");

    level._effect["mortar_explosion"][1] = loadfx("clusterbomb_exp");

 

    // send down the mortars

    level thread mortars();

}    


mortars()

	{

    // Get an array of all the mortars in the level

    mortar1 = getent ("mortar1","targetname");
	mortar2 = getent ("mortar2","targetname");
	mortar3 = getent ("mortar3","targetname");
	mortar4 = getent ("mortar4","targetname");

    // Loop over and over while the level is loaded

    while (1)
	

    

    // Wait XX seconds  before doing a mortar explosion
    wait (0.1);
	
	
	
    // Play the incomming mortar sound effect

    mortar1 playsound("mortar_incoming");

    // Wait  while the imcomming sound plays

    wait 2;
	
	
	
	
    // Do the explosion effect
	playfx (level._effect["mortar_explosion"], mortar1.origin);

	
	
	
	
    // Play the explosion sound
    mortar1 playsound("clusterbomb_explode_default");


    // Make the explosion cause damage
    radiusDamage(mortar1.origin, 500, 2000, 50);
	wait (0.1);	

	
	
    playfx (level._effect["mortar_explosion"], mortar2.origin);

		
    // Play the explosion sound
	mortar2 playsound("clusterbomb_explode_default");
	
	

	
    // Make the explosion cause damage
    radiusDamage(mortar2.origin, 500, 2000, 50);
	wait (0.1);
	
	
	
	playfx (level._effect["mortar_explosion"], mortar3.origin);
	

	
    // Play the explosion sound
    mortar3 playsound("clusterbomb_explode_default");

 
	
    // Make the explosion cause damage
    radiusDamage(mortar3.origin, 500, 2000, 50);	
	wait (0.1);
	
	

    playfx (level._effect["mortar_explosion"], mortar4.origin);
	
	
	
    // Play the explosion sound
    mortar4 playsound("clusterbomb_explode_default");

	

	
    // Make the explosion cause damage
    radiusDamage(mortar4.origin, 500, 2000, 50);
	wait (0.1);
	}


The file is called mortar.gsc and it is called in my mapname.gsv and in missing assets.

If you have an idea, every help is welcome.
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 Scripting
Posted: Thursday, Feb. 21, 2008 08:33 pm
I can't see where you have defined the origin of each script_origin in the script.. Something like origin = mortar1 GetOrigin();

So if you set each origin for the script you should have no problem using an effect command like: playfx (level._effect["mortar_explosion"], origin);

Also i may be wrong but didnt the original mortar script use an array for the entities instead of defining them individually?
Share |
SWS2000
General Member
Since: May 12, 2006
Posts: 193
Last: Jun 14, 2008
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Thursday, Feb. 21, 2008 08:35 pm
Yes it did, but doesn't it has to do something with the random ?

I will change it as you assume and see what happens.

Thx
Share |
SparkyMcSparks
General Member
Since: Feb 28, 2004
Posts: 1713
Last: Dec 29, 2016
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Thursday, Feb. 21, 2008 08:49 pm
Here's what I'm using in my new Backlot SP map for explosions, works well.

Code:
ambient_explosions()
{
	expo_locs = [];
	expo_locs = getEntArray( "random_expo", "targetname" );
	
	while (1)
	{
		rand = RandomIntRange( 20, 30 );
		rand_loc = RandomIntRange( 0, expo_locs.size );
		if( (rand == 25) || (rand == 27) )
		{
			expo_locs[ rand_loc ] PlaySound( "explosion" );
			playFx( level._effect[ "explosion" ], expo_locs[ rand_loc ].origin );
			wait 0.2;
			Earthquake( 0.3, 3, level.player.origin, 500 );
		}
		else
			wait 1;
	}
} // ambient_explosions()
Share |
SWS2000
General Member
Since: May 12, 2006
Posts: 193
Last: Jun 14, 2008
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Thursday, Feb. 21, 2008 09:28 pm
Still there are no explosions.

I changed script to:
Code:
main(){ 

    // Specify  explosion effects to play

    level._effect["mortar_explosion"] = loadfx("clusterbomb_exp");

    

 

    // send down the mortars

    level thread mortars();

}    


mortars()

	{

    // Get an array of all the mortars in the level

    mortar1 = getentarray ("mortar1","targetname");
	
	mortar2 = getentarray ("mortar2","targetname");
	
	mortar3 = getentarray ("mortar3","targetname");
	
	mortar4 = getentarray ("mortar4","targetname");
	

    // Loop over and over while the level is loaded

    while (1)
	

    

    // Wait XX seconds  before doing a mortar explosion
    wait (0.1);
	
	
	
    // Play the incomming mortar sound effect

    mortar1 playsound("mortar_incoming");

    // Wait  while the imcomming sound plays

    wait 2;
	
	
	
	
    // Do the explosion effect
	origin = mortar1 GetOrigin();
	playfx (level._effect["mortar_explosion"],origin);

	
	
	
	
    // Play the explosion sound
    mortar1 playsound("clusterbomb_explode_default");


    // Make the explosion cause damage
    radiusDamage(mortar1.origin, 500, 2000, 50);
	wait (0.1);	

	origin = mortar2 GetOrigin();	
    playfx (level._effect["mortar_explosion"],origin);


    // Play the explosion sound
	mortar2 playsound("clusterbomb_explode_default");
	
	

	
    // Make the explosion cause damage
    radiusDamage(mortar2.origin, 500, 2000, 50);
	wait (0.1);
	
	
	origin = mortar3 GetOrigin();
	playfx (level._effect["mortar_explosion"],origin);
	

	
    // Play the explosion sound
    mortar3 playsound("clusterbomb_explode_default");

 
	
    // Make the explosion cause damage
    radiusDamage(mortar3.origin, 500, 2000, 50);	
	wait (0.1);
	
	
	origin = mortar4 GetOrigin();
    playfx (level._effect["mortar_explosion"],origin);
	
	
	
    // Play the explosion sound
    mortar4 playsound("clusterbomb_explode_default");

	

	
    // Make the explosion cause damage
    radiusDamage(mortar4.origin, 500, 2000, 50);
	wait (0.1);
	} 


I do not have any clue?[confused]

@sparks, randomly I got them to work.

edited on Feb. 21, 2008 04:29 pm by {MASS}Sgt
Share |
novemberdobby
General Member
Since: Sep 17, 2006
Posts: 1965
Last: Oct 13, 2013
[view latest posts]
Level 8
Forum Moderator
Category: CoD4 Scripting
Posted: Friday, Feb. 22, 2008 02:55 pm
So no explosions, and it doesn't crash.

Wait, you want explosions after planes fly past? could you just use the stock airstrike thingy, with no damage?

Use an iPrintLnBold to make sure it's running, maybe somewhere near the playfx() lines.
Share |
SWS2000
General Member
Since: May 12, 2006
Posts: 193
Last: Jun 14, 2008
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Friday, Feb. 22, 2008 03:23 pm
Mmh,

I put this in line 54

iprintlnbold("LOL TEST");

there is no LOL TEST coming

I have this in my missing assets:
rawfile,maps/mp/mortar.gsc
rawfile,maps/mp/mp_test_fx.gsc

and this in my mapname.gsc

maps\mp\mp_test_fx::main();
maps\mp\_load::main();
maps\mp\mortar::main();

This is in my mp_test_fx.gsc
main()
{
level._effect["mortar_explosion"] = loadfx("clusterbomb_exp");


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

}

And I do not have any clue why they do not show up.[confused]
Share |
novemberdobby
General Member
Since: Sep 17, 2006
Posts: 1965
Last: Oct 13, 2013
[view latest posts]
Level 8
Forum Moderator
Category: CoD4 Scripting
Posted: Friday, Feb. 22, 2008 05:13 pm
Try putting a lol test at the top of the mortar script?
Share |
SWS2000
General Member
Since: May 12, 2006
Posts: 193
Last: Jun 14, 2008
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Friday, Feb. 22, 2008 06:02 pm
No LOL TEST comming

here is my mp_test.gsc
Code:
main()
{
	maps\mp\mortar::main();
	
	maps\mp\_load::main();
	
	

	
	ambientPlay("ambient_backlot_ext");
	
	game["allies"] = "sas";
	game["axis"] = "opfor";
	game["attackers"] = "axis";
	game["defenders"] = "allies";
	game["allies_soldiertype"] = "woodland";
	game["axis_soldiertype"] = "woodland";
	
	setdvar( "r_specularcolorscale", "1" );
	
	setdvar("r_glowbloomintensity0",".25");
	setdvar("r_glowbloomintensity1",".25");
	setdvar("r_glowskybleedintensity0",".3");
	setdvar("compassmaxrange","1800");
}


here is the mortar.gsc

Code:
main(){ 

	iprintlnbold("LOL TEST");

    // Specify  explosion effects to play

    level._effect["mortar_explosion"] = loadfx("clusterbomb_exp");

    

 

    // send down the mortars

    level thread mortars();

}    


mortars()

	{

    // Get an array of all the mortars in the level

    mortar1 = getentarray ("mortar1","targetname");
	
	mortar2 = getentarray ("mortar2","targetname");
	
	mortar3 = getentarray ("mortar3","targetname");
	
	mortar4 = getentarray ("mortar4","targetname");
	

    // Loop over and over while the level is loaded

    while (1)
	

    

    // Wait XX seconds  before doing a mortar explosion
    wait (2);
	
	
	
    // Play the incomming mortar sound effect

    mortar1 playsound("mortar_incoming");

    // Wait  while the imcomming sound plays

    wait 2;
	
	

	
    // Do the explosion effect
	origin = mortar1 GetOrigin();
	playfx (level._effect["mortar_explosion"],origin);

	
	
	
	
    // Play the explosion sound
    mortar1 playsound("clusterbomb_explode_default");


    // Make the explosion cause damage
    radiusDamage(mortar1.origin, 500, 2000, 50);
	wait (0.1);	

	origin = mortar2 GetOrigin();	
    playfx (level._effect["mortar_explosion"],origin);


    // Play the explosion sound
	mortar2 playsound("clusterbomb_explode_default");
	
	

	
    // Make the explosion cause damage
    radiusDamage(mortar2.origin, 500, 2000, 50);
	wait (0.1);
	
	
	origin = mortar3 GetOrigin();
	playfx (level._effect["mortar_explosion"],origin);
	

	
    // Play the explosion sound
    mortar3 playsound("clusterbomb_explode_default");

 
	
    // Make the explosion cause damage
    radiusDamage(mortar3.origin, 500, 2000, 50);	
	wait (0.1);
	
	
	origin = mortar4 GetOrigin();
    playfx (level._effect["mortar_explosion"],origin);
	
	
	
    // Play the explosion sound
    mortar4 playsound("clusterbomb_explode_default");

	

	
    // Make the explosion cause damage
    radiusDamage(mortar4.origin, 500, 2000, 50);
	wait (0.1);
	}


I am nearby to give up[ohwell]
Share |
novemberdobby
General Member
Since: Sep 17, 2006
Posts: 1965
Last: Oct 13, 2013
[view latest posts]
Level 8
Forum Moderator
Category: CoD4 Scripting
Posted: Friday, Feb. 22, 2008 06:28 pm
Can't think of much [sad]

Maybe add a wait 10; before LOL TEST, you might be missing it atm.
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 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

»