CTF sound?????


(Malicious Mushroom) #1

ok i have a small CTF map that i would like a sound played to notify players if a flag has been captured… so far i have used a playsound command… but i am not sure that it is a global sound command or just one that the player that captures the flag hears… this is my script. I know that there are speakers that you can use… but i am not sure if it is what i should use here… BTW all of the alertentities are a counter that i have made.

game_manager
{
        spawn
        {
		wm_axis_respawntime 7
		wm_allied_respawntime 7
		wm_set_round_timelimit 10
                
		
			



		// Winner on expiration of round timer (0=Axis, 1=Allies, -1=No winner at expiration)

		wm_setwinner	-1

		wait 2000
	
        }



}

axisflag
{
	spawn
	{
	wait 300
	    accum 0 set 0
	}
			trigger allied_capture
			{
				accum 0 abort_if_equal 1
				playsound sound/misc/vote.wav volume 400
				wait 200
				accum 0 set 1
				accum 0 abort_if_equal 0
				alertentity t25
                                wait 1000
				accum 0 abort_if_equal 0
				alertentity t24
                                wait 1000
				accum 0 abort_if_equal 0
				alertentity t23
                                wait 1000
				accum 0 abort_if_equal 0
				alertentity t22
                                wait 1000
				accum 0 abort_if_equal 0
				alertentity t21
                                wait 1000
				accum 0 abort_if_equal 0
				alertentity t3
                                wait 1000
				accum 0 abort_if_equal 0
				alertentity t4
                                wait 1000
				accum 0 abort_if_equal 0
				alertentity t5
                                wait 1000
				accum 0 abort_if_equal 0
				alertentity t6
                               	wait 1000
				accum 0 abort_if_equal 0
				alertentity t7
                                wait 1000
				accum 0 abort_if_equal 0
				alertentity t8
                                wait 1000
				accum 0 abort_if_equal 0
				alertentity t9
                                wait 1000
				accum 0 abort_if_equal 0
				alertentity t10
                                wait 1000
				accum 0 abort_if_equal 0
				alertentity t11
                                wait 1000
				accum 0 abort_if_equal 0
				alertentity t12
                                wait 1000
				accum 0 abort_if_equal 0
				alertentity t13
				wm_setwinner 1
				wait 2000
				wm_endround
				
			}
			trigger axis_capture
			{
				accum 0 abort_if_equal 0
				accum 0 set 0
				alertentity t14
			}
}

alliedflag
{
	spawn
	{
wait 300
	    accum 1 set 1
	}
			trigger axis_capture
			{
				accum 1 abort_if_equal 0
				playsound sound/misc/vote.wav volume 400
				wait 200
				accum 1 set 0
				accum 1 abort_if_equal 1
				alertentity r15
				wait 1000
				accum 1 abort_if_equal 1
				alertentity r14
                                wait 1000
				accum 1 abort_if_equal 1
				alertentity r13
                                wait 1000
				accum 1 abort_if_equal 1
				alertentity r12
                                wait 1000
				accum 1 abort_if_equal 1
				alertentity r11
                                wait 1000
				accum 1 abort_if_equal 1
				alertentity r10
                                wait 1000
				accum 1 abort_if_equal 1
				alertentity r9
                                wait 1000
				accum 1 abort_if_equal 1
				alertentity r8
                                wait 1000
				accum 1 abort_if_equal 1
				alertentity r7
                                wait 1000
				accum 1 abort_if_equal 1
				alertentity r6
                                wait 1000
				accum 1 abort_if_equal 1
				alertentity r5
                                wait 1000
				accum 1 abort_if_equal 1
				alertentity r4
                                wait 1000
				accum 1 abort_if_equal 1
				alertentity r3
                                wait 1000
				accum 1 abort_if_equal 1
				alertentity r2
                                wait 1000
				accum 1 abort_if_equal 1
				alertentity r1
                                wait 1000
				accum 1 abort_if_equal 1
				alertentity r0
				wm_setwinner 0
				wait 2000
				wm_endround
			}
			trigger allied_capture
			{
				accum 1 abort_if_equal 1
				accum 1 set 1
				alertentity r16
			}
}


(Loffy) #2

In the map’s main script:


axis_flag  // The Axis flags (for Allies to take).
{
	spawn
	{
		wait 200
	}

	trigger stolen	// This script is run when the axis 1st flag is stolen.
	{
		wm_announce "^2Axis flag is stolen!" // Print this text on screen for all to see.
		wait 500 // Wait half a second (500 miliseconds)
		wm_teamvoiceannounce 0 "axis_flagstolen" // Heard by all players in team 0
		wm_teamvoiceannounce 1 "axis_flagstolen" // Dito, for team 1
	}

	trigger returned
	{
		wm_announce "^2Axis flag returned!"
	}

	trigger captured  // The flag is captured (and the Allied Forces score)!
	{
		wm_teamvoiceannounce 0 "axis_flagcaptured"
		wm_teamvoiceannounce 1 "axis_flagcaptured"
		wm_announce "^2Allied Forces score!"
	}
}


OK, the above was only for the Axis flag. You need a similar script for the Allied flag, where the sounds are alli_flagstolen and alli_flagcaptured (see also below).

Then you need to write a separate so called sound-script. It is easy.
Just open you favorite text editor, e.g. Notepad and write somehting like:


// --------------Flags---------------

axis_flagstolen
{
	sound sound/world/alarm_01.wav
	voice
	streaming
}

alli_flagstolen
{
	sound sound/world/alarm_02.wav
	voice
	streaming
}

axis_flagcaptured
{
	sound *some other cool sound effect, maybe a "Ka-tjiing!"?*
	voice
	streaming
}

alli_flagcaptured
{
	sound *some other cool sound effect*
	voice
	streaming
}

Save this text as “yourmapname.sounds” and place it here in the pk3:

yourmapname/sound/scripts/yourmapname.sounds


(Malicious Mushroom) #3

yea that is basically what i thought i would have to do. So what excactly is the playsound command for?

Oh and Thank You for the response!!


(Loffy) #4

Your welcome. I have no idea. In the manual, it says:

"playsound <soundname OR scriptname> [LOOPING]

Currently only allows playing on the VOICE channel, unless you use a sound script. Use the optional LOOPING paramater to attach the sound to the entities looping channel."

I found it in the manual:
http://simland.planetquake.gamespy.com/ldr1_1/default.htm

under the heading “Appendix A: Scripting Commands”

//L.