Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Need help?

    Create a topic in the appropriate section
    Don't write everything in the chat!
  • Take a look at the marketplace

    There you can buy
    everything related to game servers
  • Don't want a ban?

    Please read our rules
    Don't disturb the order!
  • Sell or buy?

    Use services of the guarantor
    We will make your deal safe
  • 0
Sign in to follow this  
Juze

Звук

Доброго времени суток,

Есть SoundSet, я его запускаю следящим способом.

PlayerBase player;
		SEffectManager.PlaySoundOnObject("GasMask_SoundSet", player, 0, 0, false);

Проблема в том, что звук после того как запустился остается на месте, где находился игрок в момент запуска скрипта.

Есть ли возможность привязать звук, чтобы он двигался вместе с объектом?

И не знает ли кто-то здесь, как прикрутить звук не к игроку, а к объекту, например к дозиметру.

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 1
class BuildingWithSound : Building
{
	private EffectSound 	m_Sound		= NULL;
	private string		m_SoundSetType	= "BuildingWithSoundSoundSet";


	void BuildingWithSound()
	{
		if ( GetGame().IsClient() || !GetGame().IsMultiplayer() )
		{
			
			m_Sound = SEffectManager.PlaySoundOnObject( m_SoundSetType, this, 1, 1, true );
			m_Sound.SetSoundAutodestroy( true );
		}
	}
}

Как-то так

тут в момент создания (появления обьекта в радиусе видимости игрока) начнет проигрываться звук на обьекте

 

Share this post


Link to post
Share on other sites



  • 0

как то так если не ошибаюсь 🙂 
 

protected void SoundTurnOn()
	{
		PlaySoundSet(m_SoundTurnOn, SOUND_TURN_ON, 0.0, 0.0);
	}

	protected void SoundTurnOff()
	{
		PlaySoundSet(m_SoundTurnOff, SOUND_TURN_OFF, 0.0, 0.0);
	}

но это опять же включение выключение 🙂 знаю коненчо какой мод надо ковырнуть дабы узнать что то новое но пока увы нет возможности

Edited by SHUN (see edit history)

Share this post


Link to post
Share on other sites
  • 0
44 минуты назад, BorizzK сказал:

class BuildingWithSound : Building { private EffectSound m_Sound = NULL; private string m_SoundSetType = "BuildingWithSoundSoundSet"; void BuildingWithSound() { if ( GetGame().IsClient() || !GetGame().IsMultiplayer() ) { m_Sound = SEffectManager.PlaySoundOnObject( m_SoundSetType, this, 1, 1, true ); m_Sound.SetSoundAutodestroy( true ); } } }


class BuildingWithSound : Building
{
	private EffectSound 	m_Sound		= NULL;
	private string		m_SoundSetType	= "BuildingWithSoundSoundSet";


	void BuildingWithSound()
	{
		if ( GetGame().IsClient() || !GetGame().IsMultiplayer() )
		{
			
			m_Sound = SEffectManager.PlaySoundOnObject( m_SoundSetType, this, 1, 1, true );
			m_Sound.SetSoundAutodestroy( true );
		}
	}
}

Как-то так

тут в момент создания (появления обьекта в радиусе видимости игрока) начнет проигрываться звук на обьекте

 

забираю 🙂 полезно как всегда

Share this post


Link to post
Share on other sites
  • 0
1 час назад, SHUN сказал:

забираю 🙂 полезно как всегда

С тз оптимизации

Вообще это наверное нифига не нагружает конвейеро процессора

но все же

 

Я давно перешел на #ifndef для клиента

 

Это в мод который клиент-серверный

Это будет компилиться на клиенте, сервер же этот код проигнорит

#ifndef SERVER
class BuildingWithSound : Building
{
	private EffectSound 	m_Sound		= NULL;
	private string		m_SoundSetType	= "BuildingWithSoundSoundSet";


	void BuildingWithSound()
	{
			m_Sound = SEffectManager.PlaySoundOnObject( m_SoundSetType, this, 1, 1, true );
			m_Sound.SetSoundAutodestroy( true );
	}
}
#endif

Это в серверный

Тут можно завернуть серверных заморочек

#ifdef SERVER
class BuildingWithSound : Building
{
	void BuildingWithSound()
	{
	}
}
#endif

И не надо никаких моддед и прочей фигни

 

Просто две части мода

 

в итоге - клиентского кода на сервере нет, что положительно сказывается на производительности

тут сэкономили такт, там

в сумме (если модов много) экономия может быть существенной
 

ИМХО

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you automaticly agree to our Guidelines and Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.