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

Members Online

»
0 Active | 122 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 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: How do you assign a sound to a script exploder
Jsyhitman
General Member
Since: Jun 24, 2005
Posts: 38
Last: Aug 3, 2008
[view latest posts]
Level 2
Category: CoD4 Scripting
Posted: Thursday, Jun. 26, 2008 03:42 pm
I have the following script_exploder working in my map, However I would like to add a soundalias to go off at the same time.
Can anyone give me a pointer please?

Quote:
The fx entity has the following:
classname/script_model
model/fx
script_exploder/30
script_fxid/wallexplode

This is my mapname.gsc:
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");
}

This is my mapname_fx.gsc:

main()
{

level._effect["firelp_med_pm"] = loadfx ("fire/firelp_med_pm_nodistort");
level._effect["firelp_small_pm"] = loadfx ("fire/firelp_small_pm");
level._effect["firelp_small_pm_a"] = loadfx ("fire/firelp_small_pm_a");
level._effect["dust_wind_fast"] = loadfx ("dust/dust_wind_fast");
level._effect["dust_wind_slow"] = loadfx ("dust/dust_wind_slow_yel_loop");
level._effect["dust_wind_spiral"] = loadfx ("dust/dust_spiral_runner");
level._effect["hawk"] = loadfx ("weather/hawk");
level._effect["bird_seagull_flock_large"] = loadfx ("misc/bird_seagull_flock_large");
level._effect["wallexplode"] = loadfx ("explosions/wall_explosion_grnd");

//ambient runners
level._effect[ "mp_overgrown_insects01" ] = loadfx( "ambient_runners/mp_overgrown_insects01" );

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


}
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, Jun. 26, 2008 04:37 pm
Best thing to do is grab the trigger for your exploders and use this to also trigger your sounds, you will need to place a script origin to act as the 'speaker' then grab this for your sounds origin, there are tutorials on adding sounds, the only differnce is you will use your existing trigger to make it happen.

Im not sure on your level of knowledge about scripting so ill explain this further if needed
Share |
Jsyhitman
General Member
Since: Jun 24, 2005
Posts: 38
Last: Aug 3, 2008
[view latest posts]
Level 2
Category: CoD4 Scripting
Posted: Thursday, Jun. 26, 2008 06:52 pm
I think i know what you mean, but my understanding of scripting is very basic altho i am starting to understand a little, any pointers would be very much appreciated.
Share |
Jsyhitman
General Member
Since: Jun 24, 2005
Posts: 38
Last: Aug 3, 2008
[view latest posts]
Level 2
Category: CoD4 Scripting
Posted: Thursday, Jun. 26, 2008 07:14 pm
Ok so if in my map i give my trigger_damage a targetname of wallexplode_soundtrig and then put in a script_origin with a tragetname of wallexplode_sound.

Then in my main gsc i put the following code?
Code:
 thread exp_sound1();

} 

exp_sound1() 
{ 
	yellsoundtrig = getent ("wallexplode_soundtrig","targetname");
	yellsoundtrig waittill ("trigger");

	alert = getent ("wallexplode_sound", "targetname");
	alert playsound("building_explosion1");

} 


Would that work or would giving my trigger_damage a targetname upset the script_exploder?
Share |
ahoji
General Member
Since: May 16, 2006
Posts: 74
Last: Jun 27, 2008
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Friday, Jun. 27, 2008 11:05 am
wow, what exactly you want with sounds? like some ambient sound? or to trigger a sound and FX togetner?

my old test script with mortars, maybe helpful
Code:
main()
{
level._effect["mortexplosion"] = loadfx("fx/explosions/artilleryExp_dirt_brown.efx");

thread bradio();
level.bombing = false;

 for(i=0;i<8;i=i+1)
 {
 bhole_a=getent("bhole_a_[i]","targetname");
 bhole_a hide();
 }
}

bradio()
{
bradio=getent("bradio","targetname");

 while(1)
 {
 bradio waittill ("trigger",other);

 if((isplayer (other)) && (other.pers["team"] == "allies") && !level.bombing)
 {
 level.bombing = true;
 bradio playsound("sound1sg");
 wait 5;
 bradio playsound("sound3sg");
 wait 5;
 thread bombing();
 }
 }
}

bombing()
{

 for(i=0;i<8;i=i+1)
 {
 bhole_orig = getent ("bhole_orig_[i]","targetname");
 bhole_a = getent ("bhole_a_[i]","targetname");
 bhole_b = getent ("bhole_b_[i]","targetname");
 origin = bhole_orig getorigin();
 
 bhole_orig playsound("incoming_mortar");
 wait (1);

 bhole_orig playsound("explosion_ground");
 playfx(level._effect["mortexplosion"], origin);
 radiusDamage(origin, 500, 2000, 1000);

 bhole_a show();
 bhole_b delete();
 wait (1);

 }
level.bombing = false;
}
Share |
lazygit
General Member
Since: Dec 13, 2003
Posts: 296
Last: Nov 3, 2022
[view latest posts]
Level 5
Category: CoD4 Scripting
Posted: Friday, Jun. 27, 2008 02:31 pm
this might help you!!

main()




{

damagetrigg = getent ("dmtrig","targetname"); // this is my trigger still has a key and value script_exploer 1

alerts = getentarray ("bang","targetname"); // this is script_model placed where you need the sound to play it has a targetname thats all NO script_exploder 1

wallgood = getent ("wallgood","targetname"); //this is my wall in good form is a script_exploder 1

wallbad = getent ("wallbad","targetname"); //this is my wall in bad form is a script_exploder 1

wallbad hide(); //hiding my badwall

wallgood show(); //showing my wallgood

damagetrigg waittill ("trigger"); //waiting till the trigger is fired off then!!!!

wallbad show();

origin = wallbad getorigin();

alerts[0] playsound("building_explosion1"); // plays the sound building_explosion1

radiusDamage(origin, 750, 2000, 1000); // in the way of the radius you get hurt

}

edited on Jun. 27, 2008 10:32 am by lazygit
Share |
lazygit
General Member
Since: Dec 13, 2003
Posts: 296
Last: Nov 3, 2022
[view latest posts]
Level 5
Category: CoD4 Scripting
Posted: Friday, Jun. 27, 2008 04:16 pm
}

ammoc()

{
damagetrigg = getent ("dmtrig","targetname");

alerts = getentarray ("bang","targetname");

wallgood = getent ("wallgood","targetname");

wallbad = getent ("wallbad","targetname"); // no need to be script_exploder

wallbad hide();

wallgood show();

damagetrigg waittill ("trigger");

wallgood delete();

wallbad show();

origin = wallbad getorigin();

alerts[0] playsound("car_explode_close");

radiusDamage(origin, 600, 2000, 1000);

}
Share |
Jsyhitman
General Member
Since: Jun 24, 2005
Posts: 38
Last: Aug 3, 2008
[view latest posts]
Level 2
Category: CoD4 Scripting
Posted: Friday, Jun. 27, 2008 05:20 pm
Thanks for all the suggestions, all i really need to do i have a sound play when the script_exploder is triggered by a trigger damge.

Is it possible to do it like the fx using something similar to this line
Quote:
level._effect["wallexplode"] = loadfx ("explosions/wall_explosion_grnd");


except that it plays a sound from one of the stock soundalias's
Share |
lazygit
General Member
Since: Dec 13, 2003
Posts: 296
Last: Nov 3, 2022
[view latest posts]
Level 5
Category: CoD4 Scripting
Posted: Friday, Jun. 27, 2008 06:11 pm
lazygit writes...
Quote:
}

ammoc()

{
damagetrigg = getent ("dmtrig","targetname");

alerts = getentarray ("bang","targetname");

wallgood = getent ("wallgood","targetname");

wallbad = getent ("wallbad","targetname");

wallbad hide();

wallgood show();

damagetrigg waittill ("trigger");

wallgood delete();

wallbad show();

origin = wallbad getorigin();

alerts[0] playsound("car_explode_close");

radiusDamage(origin, 600, 2000, 1000);

}


i have sent you a pm this is how to asign a stock sound to a script_exploder

Share |
Jsyhitman
General Member
Since: Jun 24, 2005
Posts: 38
Last: Aug 3, 2008
[view latest posts]
Level 2
Category: CoD4 Scripting
Posted: Saturday, Jun. 28, 2008 09:09 pm
Thanks for the help, Thanks lazygit..
One last question, should i add the soundalias to my zone file?
I dont get any errors, just don't hear the explosion.
Thanks again
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

»