Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_Tutorial_Obstace_TIME.c
Go to the documentation of this file.
1[EntityEditorProps(insertable: false)]
5
6//------------------------------------------------------------------------------------------------
8{
9 vector m_vInstructorPos;
10 //------------------------------------------------------------------------------------------------
11 override protected void Setup()
12 {
13 ChimeraWorld world = GetGame().GetWorld();
14 if (world)
15 world.GetMusicManager().Stop("SOUND_OBSTACLE_COURSE");
16
17 float finalTime = m_TutorialComponent.GetTimeElapsed();
18
19 string time;
20
21 int hour;
22 int minute;
23 int second;
24
25 SCR_DateTimeHelper.GetHourMinuteSecondFromSeconds(finalTime, hour, minute, second);
26
27 string buffer;
28
29 if (hour > 0)
30 {
31 buffer = hour.ToString();
32 time += buffer + ":";
33 }
34
35 buffer = minute.ToString();
36
37 if (minute > 0 && minute < 10)
38 time += "0";
39
40 time += buffer + ":";
41
42 buffer = second.ToString();
43
44 if (second < 10)
45 time += "0";
46
47 time += buffer + ":";
48
49 int ms = ((finalTime - Math.Floor(finalTime)) * 1000);
50 buffer = ms.ToString();
51
52 if (ms < 10)
53 time += "00";
54 else if (ms < 100)
55 time += "0";
56
57 time += buffer;
58
59 SCR_HintUIInfo info = m_StageInfo.GetHint();
60
61 if (!info)
62 return;
63
64 LocalizedString stringToEdit = info.GetDescription();
65
66 if (!stringToEdit)
67 return;
68
69 stringToEdit = stringToEdit + " " + time;
70
71 SCR_HintUIInfo hintInfo = SCR_HintUIInfo.CreateInfo(stringToEdit, string.Empty, -1, EHint.UNDEFINED, EFieldManualEntryId.NONE, false);
72 hintInfo.SetPriority(1);
73 SCR_HintManagerComponent.ShowHint(hintInfo);
74
75 if (finalTime < 73)
76 PlayNarrativeCharacterStage("OBSTACLECOURSE_Instructor", 17); // Good
77 else if (finalTime < 77)
78 PlayNarrativeCharacterStage("OBSTACLECOURSE_Instructor", 16); // Average
79 else
80 PlayNarrativeCharacterStage("OBSTACLECOURSE_Instructor", 18); // Bad
81
82 IEntity ent = GetGame().GetWorld().FindEntityByName("SpawnPos_OBSTACLECOURSE_Instructor");
83 if (ent)
84 m_vInstructorPos = ent.GetOrigin();
85 }
86
87 //------------------------------------------------------------------------------------------------
88 override bool GetIsFinished()
89 {
90 if (vector.Distance(m_vInstructorPos, m_Player.GetOrigin()) > 40)
91 return true;
92
93 return m_sLastFinishedEvent == "SOUND_TUTORIAL_EVE_END_COURSE_INSTRUCTOR_A_02" || GetDuration() > 25000;
94 }
95};
EFieldManualEntryId
used to grab the first id-matching Field Manual entry
EHint
Definition EHint.c:11
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
proto external vector GetOrigin()
Definition Math.c:13
SCR_TutorialStageInfo m_StageInfo
SCR_TutorialGamemodeComponent m_TutorialComponent
void PlayNarrativeCharacterStage(string characterName, int stage)
static SCR_HintUIInfo CreateInfo(string description, string name, float duration, EHint type, EFieldManualEntryId fieldManualEntry, bool isTimerVisible)
void SetPriority(int priority)