Need A Sound Fix

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Cobra {sfx}
First Lieutenant
Posts: 193
Joined: Tue Mar 23, 2004 10:25 pm
Contact:

Need A Sound Fix

Post by Cobra {sfx} »

Hi guys, been trying to find a way of getting the sound to play before the explosion goes off - i followed another thread on the subject but it branched off into something else - anyone help here ...


{
local.random = randomint($random_exploder.size)+1
$random_exploder[local.random] playsound (arty_leadinmp5)
waitframe
exec global/model.scr $random_exploder[local.random].origin
radiusdamage $random_exploder[local.random].origin 100 500
wait 16,23
}

at the moment its exploding with the sound of artillery at the same time - needs a 2 sec delay before the explosion.


Cobra
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

waitframe

Post by tltrude »

Change "waitframe" to "wait 2".

Does "wait 16,23" work as a ramdom wiat time? Normally it is like this:

wait (randomfloat 16 + 23)
Tom Trude,

Image
Cobra {sfx}
First Lieutenant
Posts: 193
Joined: Tue Mar 23, 2004 10:25 pm
Contact:

Post by Cobra {sfx} »

I tried changing the waitframe - to wait 2 etc last night - it just delays the artillery longer and sounds worse - need to slow the explosions happening by 2 seconds :(

Yeh the random wait time 16,23 works fine for me.

ive tried all sorts of combinations to get the artillery sound in first but the explosion happens first and sounds real naff :(

Help

Cobra
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Tutorial map

Post by tltrude »

Here is a tutorial map that might help.

http://pages.sbcglobal.net/tltrude/Temp ... l_fire.zip

Image
Tom Trude,

Image
Cobra {sfx}
First Lieutenant
Posts: 193
Joined: Tue Mar 23, 2004 10:25 pm
Contact:

Post by Cobra {sfx} »

Cheers for that m8, ive applied some of it and i get an error in console -
(in my map)..

script error - cannot cast NULL to vector
script error command applied to NULL listener
and a lot of similar messages :(

any way of gettin summat similar to work with this...



level waittill prespawn

$world farplane 4800
$world farplane_color (0.03 0.05 0.09)

//*** Precache Dm Stuff
exec global/DMprecache.scr

exec global/door_locked.scr::lock
level.script = maps/dm/pegasusbridge
exec global/ambient.scr
//thread sound
thread cobratext
thread random_explosions

local.master = spawn scriptmaster
//local.master aliascache sound/amb_pegasusnight.mp3 soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p dm obj"
local.master aliascache arty_leadin2 sound/weapons/explo/Exp_LeadIn_07.wav soundparms 0.5 0.2 0.7 0.5 160 1600 auto loaded maps "p dm obj"
local.master aliascache arty_leadin3 sound/weapons/explo/Exp_LeadIn_08.wav soundparms 0.5 0.2 0.7 0.5 160 1600 auto loaded maps "p dm obj"
local.master aliascache arty_leadin4 sound/weapons/explo/Exp_LeadIn_09.wav soundparms 0.5 0.2 0.7 0.5 160 1600 auto loaded maps "p dm obj"
local.master aliascache arty_leadin5 sound/weapons/explo/Exp_LeadIn_11.wav soundparms 0.5 0.2 0.7 0.5 160 1600 auto loaded maps "p dm obj"
local.master aliascache arty_leadin6 sound/weapons/explo/Exp_LeadIn_12.wav soundparms 0.5 0.2 0.7 0.5 160 1600 auto loaded maps "p dm obj"
local.master aliascache arty_leadin7 sound/weapons/explo/Exp_LeadIn_13.wav soundparms 0.5 0.2 0.7 0.5 160 1600 auto loaded maps "p dm obj"
local.master aliascache arty_leadinmp1 sound/weapons/explo/Exp_LeadIn_06.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p dm obj"
local.master aliascache arty_leadinmp2 sound/weapons/explo/Exp_LeadIn_07.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p dm obj"
local.master aliascache arty_leadinmp3 sound/weapons/explo/Exp_LeadIn_08.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p dm obj"
local.master aliascache arty_leadinmp4 sound/weapons/explo/Exp_LeadIn_09.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p dm obj"
local.master aliascache arty_leadinmp5 sound/weapons/explo/Exp_LeadIn_10.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p dm obj"
local.master aliascache arty_leadinmp6 sound/weapons/explo/Exp_LeadIn_11.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p dm obj"
local.master aliascache arty_leadinmp7 sound/weapons/explo/Exp_LeadIn_12.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p dm obj"
local.master aliascache arty_leadinmp8 sound/weapons/explo/Exp_LeadIn_13.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p dm obj"
local.master aliascache arty_leadin08 sound/weapons/explo/Exp_LeadIn_07.wav soundparms 0.8 0.2 0.7 0.5 900 16000 local loaded maps "p dm obj"
local.master aliascache arty_leadin09 sound/weapons/explo/Exp_LeadIn_08.wav soundparms 0.8 0.2 0.7 0.5 900 16000 local loaded maps "p dm obj"
local.master aliascache arty_leadin10 sound/weapons/explo/Exp_LeadIn_09.wav soundparms 0.8 0.2 0.7 0.5 900 16000 local loaded maps "p dm obj"
local.master aliascache arty_leadin11 sound/weapons/explo/Exp_LeadIn_10.wav soundparms 0.8 0.2 0.7 0.5 900 16000 local loaded maps "p dm obj"


level waittill spawn

spawn script_origin "origin" ( 396 -1031 -36) "targetname" random_exploder
spawn script_origin "origin" ( -1385 -1042 -111) "targetname" random_exploder
spawn script_origin "origin" ( -447 -2150 -45) "targetname" random_exploder
spawn script_origin "origin" ( 1458 -666 -58) "targetname" random_exploder
spawn script_origin "origin" ( 395 2626 -42) "targetname" random_exploder
spawn script_origin "origin" ( -869 2187 -60) "targetname" random_exploder
spawn script_origin "origin" ( 1618 2969 -46) "targetname" random_exploder
spawn script_origin "origin" ( -458 4083 -14) "targetname" random_exploder
spawn script_origin "origin" ( 1486 3601 -51) "targetname" random_exploder
spawn script_origin "origin" ( 888 2165 -111) "targetname" random_exploder
spawn script_origin "origin" ( 2317 2642 -9) "targetname" random_exploder
spawn script_origin "origin" ( -659 -2662 -69) "targetname" random_exploder
spawn script_origin "origin" ( -829 -809 -60) "targetname" random_exploder
spawn script_origin "origin" ( 304 -1513 -54) "targetname" random_exploder
spawn script_origin "origin" ( -239 -1129 8) "targetname" random_exploder




random_explosions:



end

anything you can recommend for the random_explosions bit?

Cobra
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

entitys

Post by tltrude »

If you look closely you'll see there are two entities for every explosion spot. A script_origin to cause damage to players, and an explosion entity below that. The tank has a third entity for smoke. So, if your are copying, be sure to get them all.

For your leadin sounds, you don't need to have all those local.master lines. You can change the alias names to anything you like. If they all have the same name, but end with a number, the game will pick from them randomly--if you use the name without a number.


If you are spawning everything, here is a neat trick.

level waittill spawn

thread random_explosions ( 396 -1031 -36) 16 23 // location and random times
thread random_explosions ( -1385 -1042 -111) 8 14
thread random_explosions ( -447 -2150 -45) 10 18

end

random_explosions local.location local.wait1 local.wait2:

wait (randomfloat local.wait1 + local.wait2)
local.hurt = spawn script_origin
local.hurt.origin = local.location + ( 0 0 64 ) // raise it up 4 feet
local.explosion = spawn script_model
local.explosion model models/animate/fx_mortar_dirt.tik
local.explosion.origin = local.location + ( 0 0 -16 ) // lower it one foot
local.hurt playsound leadinmp
wait 1
local.explosion anim start // has it own sound
radiusdamage local.hurt 256 384
wait 4
local.explosion remove
local.hurt remove
thread random_explosions local.location local.wait1 local.wait2

end

So, all you need do is to add more lines under spawn for more explosions. But, I think you have way to many--might lag the game.

good luck! Hope it works!
Tom Trude,

Image
Cobra {sfx}
First Lieutenant
Posts: 193
Joined: Tue Mar 23, 2004 10:25 pm
Contact:

Post by Cobra {sfx} »

Hey thanks for all that tom, ive tried it but i dont get anything, heres the renewed script - im quite new to scripting but see if you see anything obvious that shouldnt be there...

main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Pegasus Bridge"
setcvar "g_obj_alliedtext2" "Allies"
setcvar "g_obj_alliedtext3" "Kill Germans"
setcvar "g_obj_axistext1" "Axis"
setcvar "g_obj_axistext2" "Kill Allies"
setcvar "g_obj_axistext3" "{6th} Cobra 3rd XF"

setcvar "g_scoreboardpic" "pegasusbridge"
$world farplane 4800
$world farplane_color (0.03 0.05 0.09)
// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread

local.master = spawn ScriptMaster

local.master aliascache leadinmp1 sound/weapons/explo/Exp_LeadIn_06.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p obj dm "
local.master aliascache leadinmp2 sound/weapons/explo/Exp_LeadIn_07.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p obj dm "
local.master aliascache leadinmp3 sound/weapons/explo/Exp_LeadIn_08.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p obj dm "
local.master aliascache leadinmp4 sound/weapons/explo/Exp_LeadIn_09.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p obj dm "
local.master aliascache leadinmp5 sound/weapons/explo/Exp_LeadIn_10.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p obj dm "
local.master aliascache leadinmp6 sound/weapons/explo/Exp_LeadIn_11.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p obj dm "
local.master aliascache leadinmp7 sound/weapons/explo/Exp_LeadIn_12.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p obj dm "
local.master aliascache leadinmp8 sound/weapons/explo/Exp_LeadIn_13.wav soundparms 0.8 0.2 0.7 0.5 160 3000 auto loaded maps "p obj dm "
local.master aliascache higgins_explode sound/weapons/explo/Explo_MetalMed1.wav soundparms 1.5 0.0 1.0 0.0 500 5000 weapon loaded maps "p obj dm "


exec global/exploder.scr

level waitTill prespawn

//*** Precache Dm Stuff
exec global/DMprecache.scr

//level.script = maps/dm/pegasusbridge.scr
exec global/ambient.scr

thread random_explode_start

level waittill spawn


end

// --------------------------------------------
// Random Explosions
// --------------------------------------------

random_explode_start:

thread random_explode1
thread random_explode2
thread random_explode3
thread random_explode4
$random_explode4_smoke anim start
$player playsound warn_player_arty_cover

end

random_explode1:

wait (randomfloat 13 + 16)
$random_explode1_origin playsound leadinmp
wait 1
$random_explode1 anim start // uses animate fx_explosion_dirt
radiusdamage $random_explode1_origin 256 384
goto random_explode1

end

random_explode2:

wait (randomfloat 7 + 14)
$random_explode2_origin playsound leadinmp
wait 1
$random_explode2 anim start // uses animate fx_explosion_water
radiusdamage $random_explode2_origin 256 384
goto random_explode2

end

random_explode3:

wait (randomfloat 5 + 8)
$random_explode3_origin playsound leadinmp
wait 1
$random_explode3_origin playsound higgins_explode
$random_explode3 anim start // uses animate fx_explosion_higgins
radiusdamage $random_explode3_origin 256 512
goto random_explode3

end

random_explode4:

wait (randomfloat 8 + 12)
$random_explode4_origin playsound leadinmp
wait 1
$random_explode4 anim start // uses emitters fx_explosion_tank
radiusdamage $random_explode4_origin 256 480
goto random_explode4

end


roundbasedthread:

// Can specify different scoreboard messages for round based games here.


// set the parameters for this round based match
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = kills // set to axis, allies, kills, or draw

level waittill roundstart

end

ps thanks for taking the time m8
pps with the settings there as is i lose the fog in the game also

Cobra
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

try

Post by tltrude »

Script looks ok, if you are just going with the stuff from the tutorial. What do you mean by "...I dont get anything."? Does not work, or you just don't understand it?

I thought it was quite clever because there is only one thread and as many explosions as you want.
Last edited by tltrude on Tue Mar 30, 2004 8:19 pm, edited 1 time in total.
Tom Trude,

Image
Cobra {sfx}
First Lieutenant
Posts: 193
Joined: Tue Mar 23, 2004 10:25 pm
Contact:

Post by Cobra {sfx} »

Sorry m8 - my typing - i meant i got nothing to work on map - yes it is clever m8, your a lot more advanced than me at it ;)

(Ive only been scripting 3 weeks)

Thanks m8 ill give that try

(u on msn)?
Cobra {sfx}
First Lieutenant
Posts: 193
Joined: Tue Mar 23, 2004 10:25 pm
Contact:

Post by Cobra {sfx} »

Thanks for all your help Tom, much appreciated ;)

Ps your map Gotterdammerung is very nice, textures look amazing, i like the hidden doors can have some fun in there nice job guys.

Cobra
Post Reply