Playing Sounds after hiting a Target?


(T1G3R) #1

Hi,

is it posible to play sounds at the Time the bullet is hiting a Traget(Brush)?

I try to build a Trainingyard for Snipers.
Every hit on the “DartBoard” should play a Sound and gives some XPs.

The search dosen´t match so i ask U! :smiley:

THX and CU
T


(kamikazee) #2

Playing a sound when it gets hit has been done many times. Make a script_mover, give it a insane high health key/value and put playsound in the pain event trigger.

Giving XP’s is somewhat harder to do… I thought about grabbing a func_constructible and rebuilding it from the script. The only problem is that such things are team specific, so you would need two.


(T1G3R) #3

Hi,

Playing a sound when it gets hit has been done many times.

mmmh thought it was a new idear :bored:

What do u mean with:

…put playsound in the pain event trigger.

to the XPs:

isn´t it posible to give xps via the script or the Entitys?

cu
T


(kamikazee) #4

Have you seen the spawn {} triggers in a script? There exists a pain {} trigger as well, but I call it an event trigger since a normal trigger is of the form “trigger mytrig {}”.

And as far I know it’s not possible to give XP to a player from the script.


(T1G3R) #5

Hi,

got it now :smiley:

Ok, i will try it with the Sounds.

THX so far…

EDIT:

How should the Script look like for this?
I got no idear :bored:
Every try i made failed!

T


(Roeltje) #6

well lets say u give the script mover scriptname ‘shooter’ then the script should look like this

shooter
{
pain
{
playsound ursound.wav
wm_announce “omg u hit! :D”
}
}

make sure it is not ‘trigger pain’ but just ‘pain’.
the pain block is runned when the script_mover is hit :slight_smile:

Greetz,
RoeltjE


(T1G3R) #7

Hi,

well i´m very noobish in scripting but i tried it.

here´s my script but dosen´t work!


game_manager 
{ 
	spawn 
{ 


// Game rules 
	wm_axis_respawntime 1        
	wm_allied_respawntime 1     
	wm_number_of_objectives 1    
	wm_set_round_timelimit 30 

}
shooter
{ 
	pain 
{ 
	playsound pro_sounds/hitteammate.wav 
	wm_announce "omg u hit!" 
} 
}
}

Whats wrong with it?

EDIT:
I see, i forgot the trigger!
But where is it located in the script :???:

thx&cu
T


(kamikazee) #8

Your code is just wrong… You’ve put the shooter script block inside your game_manager script block… You might want to add extra tabs to make it more clear.

BTW: If the pain event won’t get called, check if you’ve set a health key/value in the script_mover as I said before.


(T1G3R) #9

Hi,

@kamikazee
I gave that script_mover the health key/value. 40000 should be enough 4 that i guess.

The problem is in the script.
I tried it now like this:


game_manager 
{ 
	spawn 
{ 


// Game rules 
	wm_axis_respawntime 1        
	wm_allied_respawntime 1     
	wm_number_of_objectives 1    
	wm_set_round_timelimit 30 

}
}

shooter
{ 
	pain 
{ 
	playsound pro_sounds/hitteammate.wav 
	wm_announce "omg u hit!" 
} 
}

Now the map starts without any error message but i don´t hear the sound by hiting… :huh:

that cannot be so difficult to make it running…

cu
T


(kamikazee) #10

What are the script_mover’s spawnflags? This thing might work when it’s set as solid.

Now I think of it, Ifurita did it with func_static’s IIRC. I did it with script_movers, so both should work. Try the func_static if this one won’t work at all.


(T1G3R) #11

Hi,

ok i tested it and it seems to work…
I got the “omg u Hit!” message by hiting the Target but don´t hear the sound!

Ill try to set the volume value higher, maybe it work´s

Anyway, THX2U for ur help so far :clap:

EDIT:
Dawm still no sound just text message :disgust:
I set a volume 521 hehind the Playsound but didn´t work yet.

cu
T


(T1G3R) #12

Hi,

i got it :smiley:
The problem was that i fogot to write the right Path to the soundfile!

I wrote it that way:

playsound pro_sounds/hit.wav volume 500

right is:

playsound sound/pro_sounds/hit.wav volume 500

well thanks a lot dudes…
cu
T