baserace alarm sound


(Clutch152) #1

Can somone help me with this one. A friend of mine told me that it would be a neat idea to have an alarm sound when an enemy is under the base (when tactical shack is level 2 though). It currently only displays the text and was wondering how i would be able to add the alarm_01.wav play aswell.

I have tried this:

tactical_axis_symbolblack
{
	spawn
	{
		wait 200
		accum 0 set 0
		setstate tactical_axis_symbolblack invisible
	}

	trigger activate
	{
		accum 0 set 1
	}

	trigger alarm
	{
		accum 0 abort_if_not_equal 1
		wm_announce "^1Alert! ^jAllied Player detected under Axis Base!"
		playsound "sound/world/alarm_01.wav"
	}

	trigger lv1
	{
		wait 200
	}

	trigger lv2
	{
		faceangles 0 270 0 1
	}

	trigger lv3
	{
		faceangles 0 180 0 1
	}

	trigger lv4
	{
		faceangles 0 90 0 1
	}
}

And have gotten no change.

can anyone help me?


(Higgins) #2

Shouldnt this be in level editing?


(KillerWhale) #3

I don’t think playsound works in map scripts.

You probably should use a “wm_teamvoiceannounce” and define the sound in a .sounds script.
I’m not deeply into map scripts but it should look somewhat like this:


   trigger alarm
   {
      accum 0 abort_if_not_equal 1
      wm_announce "^1Alert! ^jAllied Player detected under Axis Base!"
      wm_teamvoiceannounce 1 "baserace_alarm"
   } 

Then make a .sounds file inside a sound/scripts/ folder, containing:


baserace_alarm
{
	sound sound/world/alarm_01.wav
	streaming
}

This should probably work but perhaps someone who knows more of map scripting knows easier/better way.


(Clutch152) #4

hmm, thats a good idea for so only the team hears the sound but heres an example from the baserace_b3a map script with a playsound trigger already in it which could disprove your theory of playsound not being used in map scripts.

rightfence_axis_cappad
{
	spawn
	{
		wait 200
	}

	trigger hide
	{
		setstate rightfence_axis_cappad invisible
	}

	trigger sound
	{
		playsound "sound/baserace/wohoo_axis.wav"
		playsound "sound/world/build.wav"
	}
}

At least somone responded to this lol. usually i dont get a response for a few days. :slight_smile:

But if anyone know for certain how to do this let me know. But for now i will try your example KillerWhale.


(kamikazee) #5

You’ve got to note that sound will come from the direction of the entity and that you can’t control it.


(Clutch152) #6

What about writing in the playsound command as an rcon command for the server? Once the trigger activates it does the rcon command playsound. Would that be possible?