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] |
|
|
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();
#/
}
|
|
|
|
Mystic |
|
General Member Since: Apr 10, 2004 Posts: 6147 Last: Apr 15, 2018 [view latest posts] |
|
|
|
|
|
Jsyhitman |
General Member Since: Jun 24, 2005 Posts: 38 Last: Aug 3, 2008 [view latest posts] |
|
|
|
Jsyhitman |
General Member Since: Jun 24, 2005 Posts: 38 Last: Aug 3, 2008 [view latest posts] |
|
|
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? |
|
|
|
ahoji |
|
General Member Since: May 16, 2006 Posts: 74 Last: Jun 27, 2008 [view latest posts] |
|
|
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;
} |
|
|
|
lazygit |
|
General Member Since: Dec 13, 2003 Posts: 296 Last: Nov 3, 2022 [view latest posts] |
|
|
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 |
|
|
|
lazygit |
|
General Member Since: Dec 13, 2003 Posts: 296 Last: Nov 3, 2022 [view latest posts] |
|
|
|
Jsyhitman |
General Member Since: Jun 24, 2005 Posts: 38 Last: Aug 3, 2008 [view latest posts] |
|
|
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 |
|
|
|
lazygit |
|
General Member Since: Dec 13, 2003 Posts: 296 Last: Nov 3, 2022 [view latest posts] |
|
|
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
|
|
|
|
Jsyhitman |
General Member Since: Jun 24, 2005 Posts: 38 Last: Aug 3, 2008 [view latest posts] |
|
|
|