Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_TutorialLogic_FreeRoam.c
Go to the documentation of this file.
3{
4 protected const int FAST_TRAVEL_SIGN_DISTANCE = 25;
5 //------------------------------------------------------------------------------------------------
7 {
8 IEntity ambulance = GetGame().GetWorld().FindEntityByName("RespawnAmbulance");
9 if (!ambulance)
10 return;
11
12 SCR_VehicleSpawnProtectionComponent protectionComp = SCR_VehicleSpawnProtectionComponent.Cast(ambulance.FindComponent(SCR_VehicleSpawnProtectionComponent));
13 if (protectionComp)
14 {
15 protectionComp.SetProtectOnlyDriverSeat(true);
16 protectionComp.SetVehicleOwner(-2);
17 }
18
19 IEntity soldier = GetGame().GetWorld().FindEntityByName("Ambulance_Doctor");
20 if (!soldier)
21 return;
22
23 BaseCompartmentSlot doctorCompartment;
24 SCR_BaseCompartmentManagerComponent compartmentMan = SCR_BaseCompartmentManagerComponent.Cast(ambulance.FindComponent(SCR_BaseCompartmentManagerComponent));
25 if (compartmentMan)
26 {
27 array <BaseCompartmentSlot> compartments = {};
28 compartmentMan.GetCompartments(compartments);
29 foreach (BaseCompartmentSlot compartment : compartments)
30 {
31 if (compartment.Type() == SCR_DoctorCompartmentSlot)
32 doctorCompartment = compartment;
33 }
34 }
35
37 if (!compartmentAccess)
38 return;
39
40 //compartmentAccess.OpenDoor(ambulance, ECharacterDoorAnimType.INVALID, 4);
41 compartmentAccess.GetInVehicle(ambulance, doctorCompartment, true, 4, ECloseDoorAfterActions.LEAVE_OPEN, true);
42 GetGame().GetCallqueue().CallLater(compartmentAccess.OpenDoor, 1000, false, ambulance, ECharacterDoorAnimType.INVALID, 4);
43
44 SCR_NarrativeComponent narrativeComponent = SCR_NarrativeComponent.Cast(soldier.FindComponent(SCR_NarrativeComponent));
45
46 if (!SCR_NarrativeComponent)
47 return;
48
49 narrativeComponent.Initialize(soldier);
50 }
51
52 //------------------------------------------------------------------------------------------------
54 {
55 SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
56 if (!tutorial)
57 return;
58
59 SCR_BaseTutorialStage stage = tutorial.GetCurrentStage();
60 if (!stage)
61 return;
62
63 IEntity ent = GetGame().GetWorld().FindEntityByName("FastTravel_Signs");
64 if (!ent)
65 return;
66
67 SCR_Waypoint wp;
68 ent = ent.GetChildren();
69 while (ent)
70 {
71 wp = stage.RegisterWaypoint(ent, "", "SERPENTINE");
72 if (wp)
73 {
74 wp.EnableFading(true);
76 wp.SetOffsetVector("0 2.5 0");
77 }
78
79 ent = ent.GetSibling();
80 }
81 }
82
83 //------------------------------------------------------------------------------------------------
85 {
86 SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
87 if (!tutorial)
88 return;
89
90 IEntity spawnPos = GetGame().GetWorld().FindEntityByName("SpawnPos_UH1COURSE");
91 if (!spawnPos)
92 return;
93
95
96 IEntity helicopter = GetGame().GetWorld().FindEntityByName("UH1COURSE");
97 if (!helicopter)
98 {
99 tutorial.SpawnAsset("UH1COURSE", "{70BAEEFC2D3FEE64}Prefabs/Vehicles/Helicopters/UH1H/UH1H.et", spawnPos);
100 return;
101 }
102
103
104 if (vector.Distance(helicopter.GetOrigin(), spawnPos.GetOrigin()) > 11 || IsHelicopterDamaged())
105 tutorial.SpawnAsset("UH1COURSE", "{70BAEEFC2D3FEE64}Prefabs/Vehicles/Helicopters/UH1H/UH1H.et", spawnPos);
106 }
107
108 //------------------------------------------------------------------------------------------------
109 protected bool IsHelicopterDamaged()
110 {
111 Vehicle helicopter = Vehicle.Cast(GetGame().GetWorld().FindEntityByName("UH1COURSE"));
112 if (!helicopter)
113 return true;
114
115 SCR_DamageManagerComponent damageManager = helicopter.GetDamageManager();
116 if (damageManager && damageManager.GetState() != EDamageState.UNDAMAGED)
117 return true;
118
119 SlotManagerComponent slotManager = SlotManagerComponent.Cast(helicopter.FindComponent(SlotManagerComponent));
120 if (!slotManager)
121 return false;
122
123 IEntity rotor;
124 SCR_RotorDamageManagerComponent rotorDmgComp;
125 EntitySlotInfo slot = slotManager.GetSlotByName("RotorMain");
126 if (slot)
127 {
128 rotor = slot.GetAttachedEntity();
129 rotorDmgComp = SCR_RotorDamageManagerComponent.Cast(rotor.FindComponent(SCR_RotorDamageManagerComponent));
130 if (rotorDmgComp && rotorDmgComp.GetState() != EDamageState.UNDAMAGED)
131 return true;
132 }
133
134 slot = slotManager.GetSlotByName("RotorTail");
135 if (slot)
136 {
137 rotor = slot.GetAttachedEntity();
138 rotorDmgComp = SCR_RotorDamageManagerComponent.Cast(rotor.FindComponent(SCR_RotorDamageManagerComponent));
139 if (rotorDmgComp && rotorDmgComp.GetState() != EDamageState.UNDAMAGED)
140 return true;
141 }
142
143 return false;
144 }
145
146 //------------------------------------------------------------------------------------------------
148 {
149 SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
150 if (!tutorial)
151 return;
152
153 IEntity spawnPos = GetGame().GetWorld().FindEntityByName("SpawnPos_SmallJeep");
154
155 IEntity car = tutorial.SpawnAsset("SmallJeep", "{94DE32169691AC34}Prefabs/Vehicles/Wheeled/M151A2/M151A2_transport_MERDC.et", spawnPos);
156
157 IEntity instructor = tutorial.SpawnAsset("DRIVING_Copilot", "{F9C424E7C6598A7E}Prefabs/Characters/Tutorial/Instructors/Driving_Instructor_Copilot.et", spawnPos);
158
159 if (!instructor || !car)
160 return;
161
162 /*tutorial.ChangeVehicleLockState(car, true);
163
164 SCR_VehicleSpawnProtectionComponent comp = SCR_VehicleSpawnProtectionComponent.Cast(car.FindComponent(SCR_VehicleSpawnProtectionComponent));
165
166 if (comp)
167 comp.SetReasonText("#AR-Tutorial_Action_Instructor");*/
168
170 if (compAccess)
171 compAccess.MoveInVehicle(car, ECompartmentType.CARGO);
172 }
173}
ECompartmentType
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
void SCR_VehicleDamageManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Adds ability to attach an object to a slot.
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
proto external IEntity GetChildren()
proto external BaseWorld GetWorld()
proto external IEntity GetSibling()
SCR_Waypoint RegisterWaypoint(string entityName, string title=string.Empty, string icon="MISC")
bool MoveInVehicle(IEntity vehicle, ECompartmentType compartmentType, bool performWhenPaused=false, BaseCompartmentSlot customSlot=null)
int m_iMaximumDrawDistance
void EnableFading(bool enable)
void SetOffsetVector(vector offset)
enum EPhysicsLayerPresets Vehicle
Definition gameLib.c:24
EDamageState
ECharacterDoorAnimType
ECloseDoorAfterActions