Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_TutorialConflictCapture17.c
Go to the documentation of this file.
1 [EntityEditorProps(insertable: false)]
3 {
4 };
5 
6 //------------------------------------------------------------------------------------------------
8 {
9  protected float m_fSavedTime;
10  protected AudioHandle m_PlayedRadio = AudioHandle.Invalid;
11 
12  //------------------------------------------------------------------------------------------------
13  override protected void Setup()
14  {
15  m_fConditionCheckPeriod = 0.1;
16 
17  SCR_HintManagerComponent.HideHint();
18  SCR_HintManagerComponent.ClearLatestHint();
19  PlaySoundSystem("Conflict_Transmission", true);
20  HintOnVoiceOver();
21 
22  InputManager inputMan = GetGame().GetInputManager();
23  inputMan.AddActionListener("VONChannel", EActionTrigger.DOWN, OnVOIPPress);
24  inputMan.AddActionListener("VONChannel", EActionTrigger.UP, OnVOIPRelease);
25  inputMan.AddActionListener("VONGamepad", EActionTrigger.DOWN, OnVOIPPress);
26  inputMan.AddActionListener("VONGamepad", EActionTrigger.UP, OnVOIPRelease);
27  }
28 
29  //------------------------------------------------------------------------------------------------
30  override protected bool GetIsFinished()
31  {
32  BaseRadioComponent radio = m_TutorialComponent.GetPlayerRadio();
33 
34  if (!radio)
35  return false;
36 
37  BaseTransceiver tsv = radio.GetTransceiver(0);
38  if (!tsv)
39  return false;
40 
41  if (tsv.GetFrequency() != DESIRED_FREQUENCY)
42  m_fSavedTime = 0;
43 
44  bool done = tsv.GetFrequency() == DESIRED_FREQUENCY && m_fSavedTime != 0 && m_fSavedTime + 6000 <= GetGame().GetWorld().GetWorldTime();
45 
46  if (done)
47  {
48  InputManager inputMan = GetGame().GetInputManager();
49  inputMan.RemoveActionListener("VONChannel", EActionTrigger.DOWN, OnVOIPPress);
50  inputMan.RemoveActionListener("VONChannel", EActionTrigger.UP, OnVOIPRelease);
51  inputMan.RemoveActionListener("VONGamepad", EActionTrigger.DOWN, OnVOIPPress);
52  inputMan.RemoveActionListener("VONGamepad", EActionTrigger.UP, OnVOIPRelease);
53  return true;
54  }
55  else
56  {
57  return false;
58  }
59  }
60 
61  //------------------------------------------------------------------------------------------------
62  void OnVOIPPress()
63  {
64  BaseRadioComponent radio = m_TutorialComponent.GetPlayerRadio();
65 
66  if (!radio)
67  return;
68 
69  BaseTransceiver tsv = radio.GetTransceiver(0);
70  if (!tsv)
71  return;
72 
73  IEntity unit = radio.GetOwner().GetParent();
74 
75  if (unit == m_Player && tsv.GetFrequency() == DESIRED_FREQUENCY && radio.IsPowered())
76  {
77  m_fSavedTime = GetGame().GetWorld().GetWorldTime();
78  PlayRadioMsg();
79  }
80  }
81 
82  //------------------------------------------------------------------------------------------------
83  void OnVOIPRelease()
84  {
85  PlayRadioMsg(true);
86  m_fSavedTime = 0;
87  }
88 
89  //------------------------------------------------------------------------------------------------
90  void PlayRadioMsg(bool stop = false)
91  {
92  AudioSystem.TerminateSound(m_PlayedRadio);
93 
94  if (stop)
95  return;
96 
97  SCR_CommunicationSoundComponent soundComp = SCR_CommunicationSoundComponent.Cast(m_Player.FindComponent(SCR_CommunicationSoundComponent));
98 
99  if (!soundComp)
100  return;
101 
102  SignalsManagerComponent signalComp = SignalsManagerComponent.Cast(m_Player.FindComponent(SignalsManagerComponent));
103 
104  if (!signalComp)
105  return;
106 
107  SCR_GameModeCampaign campaign = SCR_GameModeCampaign.GetInstance();
108 
109  int baseCallsign = SCR_CampaignMilitaryBaseComponent.Cast(GetGame().GetWorld().FindEntityByName("MainBaseMossHill").FindComponent(SCR_CampaignMilitaryBaseComponent)).GetCallsign();
110 
111  int signalBase = signalComp.AddOrFindSignal("Base");
112 
113  signalComp.SetSignalValue(signalBase, baseCallsign);
114 
115  m_PlayedRadio = soundComp.SoundEvent(SCR_SoundEvent.SOUND_SL_SRT + "_US");
116  }
117 };
SCR_BaseCampaignTutorialArlandStage
Definition: SCR_BaseCampaignTutorialArlandStage.c:7
SCR_TutorialConflictCapture17
Definition: SCR_TutorialConflictCapture17.c:7
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_SoundEvent
Definition: SCR_SoundEvent.c:1
FindEntityByName
IEntity FindEntityByName(string name)
Definition: SCR_ScenarioFrameworkActionsGetters.c:40
SCR_GameModeCampaign
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
Definition: SCR_GameModeCampaign.c:1927
m_Player
protected ChimeraCharacter m_Player
Definition: SCR_CampaignTutorialComponentArland.c:40
BaseTransceiver
Definition: BaseTransceiver.c:12
SCR_BaseCampaignTutorialArlandStageClass
Definition: SCR_BaseCampaignTutorialArlandStage.c:2
SCR_TutorialConflictCapture17Class
Definition: SCR_TutorialConflictCapture17.c:2
SCR_CampaignMilitaryBaseComponent
Definition: SCR_CampaignMilitaryBaseComponent.c:38