Source SDK

Source SDK

Hinnerk Jul 27, 2016 @ 2:50pm
Please help me with SDK :-)
Hi,

i build a simple map with Source SDK. I would like to have a sound ONLY one time when the map starts. I have used a ambient_generic and a logic_auto.

logic_auto outputs:

My Output: OnMapSpawn
TargetEntity: Speaker_01 (thats the ambient_generic)
Target Input: PlaySound

I works, but it plays on every round. i would like to have just in the first round.

I have tried to change the "MyOutput" to OnNewGame, OnBackgroundMap, OnLoadGame, ...

but nothing has helped.

Thank you :-)

< >
Showing 1-10 of 10 comments
Please Jul 27, 2016 @ 3:03pm 
Try and make a delete output in the logic_auto to fire 2 seconds (lenght of sound) after the map is spawned. And then make a trigger or another logic_auto to delete the original logic_auto from the map that triggers the sound. Not sure if it'll work tho
Hinnerk Jul 27, 2016 @ 3:09pm 
ah, thank you. i will try :-)
76561198041347291 Jul 28, 2016 @ 2:19am 
Originally posted by Ancient:
Try and make a delete output in the logic_auto to fire 2 seconds (lenght of sound) after the map is spawned. And then make a trigger or another logic_auto to delete the original logic_auto from the map that triggers the sound. Not sure if it'll work tho

Logic_auto cannot be targeted through names since they cannot be named, so you would have to manually add a targetname or use its classname to remove it after it has fired its outputs. The problem is, many level designer have multiple logic_auto in their maps, so they would have to find a work around.

There is an easier way of doing it and it is by using env_global.

What it does is that, for 1 round and 1 round only, the env_global is going to enable the events in the map that is triggered by a logic_auto.

https://www.youtube.com/watch?v=HjQUUPkfqDA
Last edited by 76561198041347291; Jul 28, 2016 @ 2:22am
Moltard Jul 28, 2016 @ 5:17am 
env_global is not a great entity. You should use a permanent entity instead.

Func_brush, info_target are both permament which mean if they are killed, they never come back the nextround.

Put an output on one of these entity:
OnUser1 Speaker_01,PlaySound,,<delay=0>
OnUser1 !self,Kill,,<delay=1>

And on your logic auto, you FireUser1 on the func_brush/info_target (with the delay you want).

It will play the sound and then the info_target will be killed. So each round, it will FireUser1 on nothing, so the sound is played once.
76561198041347291 Jul 28, 2016 @ 1:13pm 
env_global is more powerful than it looks, so avoid the "env_global is not a great entity."
Hinnerk Jul 28, 2016 @ 10:14pm 
hi,

thanks for the help. But i looks like an env_global is no longer aviable in source sdk.

and thanks moltard, but i think i'm to stupid. it doesnt work. the target !self does not work..
Hinnerk Jul 28, 2016 @ 10:27pm 
ah, i got it randomly^^

logic_auto outputs:

OnMapSpawn -> Speaker_01 -> PlaySound
OnMultiNewRound -> Speaker_01 -> kill
Moltard Jul 29, 2016 @ 5:18am 
@peter brev
It can do interesting things, but on multiplayer game it can get buggy, and also it's not in the default .fgd anymore (in Source SDK it was loading hl2.fgd per default, not in hammer.exe for other games).

@henge
Good that you found a different way to do it.
But !self should work. There are 3 special name you can use:

!activator = it will be the 1st entity that started the output chain
!caller = previous entity in the output chain (not often used)
!self = the current entity

Those are pretty useful when doing Input/Output stuff. Usually you use !activator on trigger_once/multiple to do things on the player who touch the trigger.
76561198041347291 Jul 29, 2016 @ 8:17am 
Originally posted by Moltard:
@peter brev
It can do interesting things, but on multiplayer game it can get buggy, and also it's not in the default .fgd anymore (in Source SDK it was loading hl2.fgd per default, not in hammer.exe for other games).

Which .fgd are we talking about? I just went through them 1 by 1 and all of them had env_global. It just might be an update that I did not have.
Moltard Jul 29, 2016 @ 10:42am 
Originally posted by Peter Brev:
Which .fgd are we talking about? I just went through them 1 by 1 and all of them had env_global. It just might be an update that I did not have.
I checked and it's not in css and csgo fgd.

It might be in all half life2 fgd (normal + episodic )
< >
Showing 1-10 of 10 comments
Per page: 1530 50

Date Posted: Jul 27, 2016 @ 2:50pm
Posts: 10