Ulysses

General => Off-Topic => Topic started by: Yanami on February 12, 2016, 02:01:56 PM

Title: Ambient Sounds
Post by: Yanami on February 12, 2016, 02:01:56 PM
Hey there!
I tried to get a code to work in the last days. I want some sounds to play randomly when a player is in a specific building. Any idea how it could work? I tried it with sound.play and stuff like that. Any ideas?

Sorry for being kinda stupid but i just cant get this working. Thanks for answering anyways.
Title: Re: Ambient Sounds
Post by: Megiddo on February 15, 2016, 02:39:53 PM
Without editing the map, you will struggle to detect when they are in a building. If this is your first time doing something in Lua, I'd suggest trying something simpler first.
Title: Re: Ambient Sounds
Post by: JamminR on February 15, 2016, 07:01:02 PM
Find some lua script that has a specified 'admin area', or forcefield. This lua script you find shouldn't be limited to just certain maps, though even those could help.
That would be a good start to look behind the scenes to detect how lua determines if a player is attempting to cross a border or 'box'.
Then you could review the gmod lua wiki to determine how to play sounds that only the player can hear, or a sound entity that can't be heard outside the border.

Just some ideas of where I'd start looking.