Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_BaseAudioScriptedUserAction.c
Go to the documentation of this file.
1
3{
4 [Attribute(desc: "Sound effect played when action is exectuted")]
6
7 [Attribute(desc: "File that contains the sound effect. Only used as backup if SFX was not played by the SoundComponent on the entity", params: "acp")]
9
10 //================================================== PERFORM ==================================================\\
11 override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
12 {
13 PlayActionSoundEffect(pOwnerEntity);
14 }
15
16 //================================================== AUDIO ==================================================\\
17 protected void PlayActionSoundEffect(IEntity pOwnerEntity)
18 {
19 if (!pOwnerEntity)
20 return;
21
23 return;
24
25 //~ Get sound component
26 SoundComponent soundComponent = SoundComponent.Cast(pOwnerEntity.FindComponent(SoundComponent));
27
28 //~ Has sound component. Play sound with that offset
30 {
31 //~ Check if sound was played. If true simply play it and return
32 if (soundComponent.GetEventIndex(m_sActionSoundEffectEventName) != -1)
33 {
35 return;
36 }
37 else
38 {
39 Print(string.Format("'SCR_BaseAudioScriptedUserAction': Trying to play sound for '%1' but sound either sound event '%2' or more likely sound file needed is not included on the SoundComponent! SCR_SoundManagerModule is used instead (if any in the world) but that means position of sound is not updated if entity moves while sound is playing.", pOwnerEntity, m_sActionSoundEffectEventName, m_sActionSoundEffectFile), LogLevel.WARNING);
40 }
41 }
42
44 return;
45
46 //~ No sound manager
47 SCR_SoundManagerModule soundManager = SCR_SoundManagerModule.GetInstance(pOwnerEntity.GetWorld());
49 return;
50
51 //~ Create new config
52 SCR_AudioSourceConfiguration audioConfig = new SCR_AudioSourceConfiguration();
55 audioConfig.m_eFlags = SCR_Enum.RemoveFlag(audioConfig.m_eFlags, EAudioSourceConfigurationFlag.Static);
56
57 //~ Play sound
60 return;
61
62 soundManager.PlayAudioSource(audioSource);
63 }
64};
void SCR_AudioSource(SCR_AudioSourceConfiguration audioSourceConfiguration, vector mat[4])
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
A scripted action class having optional logic for playing audio as well as checking if the faction is...
A scripted action class having optional logic to check if vehicle is valid.
Get action local position Used for such things like playing audio at the correct location on action use return action local position *vector GetLocalPositionAction()
static bool IsEmptyOrWhiteSpace(string input)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute