7 [
Attribute(
"{3EE26F4747B6E99D}Configs/Hints/Conflict/ConflictHints.conf",
params:
"conf class=SCR_CampaignHintStorage")]
8 protected ResourceName m_sHintsConfig;
16 protected AudioHandle m_PlayedRadio = AudioHandle.Invalid;
18 protected vector m_vFirstSpawnPosition;
22 protected ref TimeContainer m_SpawnTime;
26 protected ref array<int> m_aShownHints = {};
39 static const float ICON_FLASH_DURATION = 20;
40 static const float ICON_FLASH_PERIOD = 0.5;
42 protected static const int AFTER_RESPAWN_HINT_DELAY_MS = 16500;
43 protected static const int DELAY_BETWEEN_HINTS_MS = 1000;
44 protected static const int FEATURE_HINT_DELAY = 120000;
50 PlayerController pc =
GetGame().GetPlayerController();
55 return SCR_CampaignFeedbackComponent.Cast(pc.FindComponent(SCR_CampaignFeedbackComponent));
65 if (!player && enable)
72 m_vFirstSpawnPosition = player.GetOrigin();
77 m_vFirstSpawnPosition = vector.Zero;
81 m_MapCampaignUI.RemoveSpawnPositionHint();
91 m_MapCampaignUI = mapUi;
98 TimeAndWeatherManagerEntity manager = world.GetTimeAndWeatherManager();
101 m_SpawnTime = manager.GetTime();
103 Print(
"Time And Weather manager not found", LogLevel.WARNING);
125 return m_vFirstSpawnPosition;
147 return m_BaseWithPlayer;
153 SCR_CampaignFactionManager fManager = SCR_CampaignFactionManager.Cast(
GetGame().GetFactionManager());
168 bool isInRangeNow = m_Campaign.GetBaseManager().IsEntityInFactionRadioSignal(player, faction);
214 IEntity leader =
GetGame().GetPlayerManager().GetPlayerControlledEntity(group.GetLeaderID());
231 if (!player.IsInVehicle())
239 SCR_EditableVehicleComponent comp = SCR_EditableVehicleComponent.Cast(vehicle.FindComponent(SCR_EditableVehicleComponent));
244 array<CompartmentAccessComponent> compartments = {};
246 if (comp.GetCrew(compartments,
false) > 1)
257 if (m_BaseWithPlayer)
260 SCR_ChimeraCharacter player = SCR_ChimeraCharacter.Cast(
m_PlayerController.GetControlledEntity());
262 if (!player || player.IsInVehicle())
270 array<SCR_MilitaryBaseComponent> bases = {};
271 baseManager.GetBases(bases);
272 int minDistanceSq = 500 * 500;
273 vector playerPos = player.GetOrigin();
277 foreach (SCR_MilitaryBaseComponent base : bases)
284 if (vector.DistanceSqXZ(playerPos, campaignBase.GetOwner().GetOrigin()) < minDistanceSq)
288 minDistanceSq = 300 * 300;
289 array<int> playerIds = {};
291 GetGame().GetPlayerManager().GetPlayers(playerIds);
294 foreach (
int playerId : playerIds)
296 if (playerId == localPlayerId)
299 SCR_ChimeraCharacter otherPlayer = SCR_ChimeraCharacter.Cast(
GetGame().GetPlayerManager().GetPlayerControlledEntity(playerId));
304 CharacterControllerComponent charControl = otherPlayer.GetCharacterController();
306 if (!charControl || charControl.IsDead())
309 if (vector.DistanceSqXZ(playerPos, otherPlayer.GetOrigin()) < minDistanceSq)
314 ShowHint(
EHint.CONFLICT_TRANSPORT_REQUEST, showMultipleTimes:
true);
324 if (!playerFaction || base.GetFaction() != playerFaction)
327 if (base.GetHQRadioCoverage(playerFaction) != SCR_ECampaignHQRadioComms.RECEIVE)
337 if (
GetGame().GetWorld().GetWorldTime() < FEATURE_HINT_DELAY)
351 if (!m_BaseWithPlayer)
353 if (currentMsg && (currentMsg.m_iPriority == SCR_ECampaignSeizingMessagePrio.SEIZING_YOU || currentMsg.m_iPriority == SCR_ECampaignSeizingMessagePrio.SEIZING_ENEMY))
354 popup.HideCurrentMsg();
360 if (!baseWithPlayerCapturingFaction)
363 if (currentMsg && (currentMsg.m_iPriority == SCR_ECampaignSeizingMessagePrio.SEIZING_YOU || currentMsg.m_iPriority == SCR_ECampaignSeizingMessagePrio.SEIZING_ENEMY))
364 popup.HideCurrentMsg();
375 popup.HideCurrentMsg();
382 if (currentMsg && currentMsg.m_iPriority == SCR_ECampaignSeizingMessagePrio.SEIZING_ENEMY)
383 popup.HideCurrentMsg();
387 if (!currentMsg || currentMsg.m_iPriority != SCR_ECampaignSeizingMessagePrio.SEIZING_YOU)
394 if (currentMsg && currentMsg.m_iPriority == SCR_ECampaignSeizingMessagePrio.SEIZING_YOU)
395 popup.HideCurrentMsg();
397 if (!currentMsg || currentMsg.m_iPriority != SCR_ECampaignSeizingMessagePrio.SEIZING_ENEMY)
412 if (!m_aShownHints.Contains(
EHint.CONFLICT_TRANSPORT_REQUEST))
413 GetGame().GetCallqueue().CallLater(
ShowHint, AFTER_RESPAWN_HINT_DELAY_MS,
false,
EHint.CONFLICT_TRANSPORT_REQUEST,
false,
false);
415 if (!m_aShownHints.Contains(
EHint.CONFLICT_SERVICE_DEPOTS))
416 GetGame().GetCallqueue().CallLater(
ShowHint, AFTER_RESPAWN_HINT_DELAY_MS,
false,
EHint.CONFLICT_SERVICE_DEPOTS,
false,
false);
417 else if (!m_aShownHints.Contains(
EHint.CONFLICT_RESPAWN))
418 GetGame().GetCallqueue().CallLater(
ShowHint, AFTER_RESPAWN_HINT_DELAY_MS,
false,
EHint.CONFLICT_RESPAWN,
false,
false);
419 else if (!m_aShownHints.Contains(
EHint.CONFLICT_VETERANCY))
420 GetGame().GetCallqueue().CallLater(
ShowHint, AFTER_RESPAWN_HINT_DELAY_MS,
false,
EHint.CONFLICT_VETERANCY,
false,
false);
421 else if (!m_aShownHints.Contains(
EHint.GAMEPLAY_WEAPON_INSPECTION))
422 GetGame().GetCallqueue().CallLater(
ShowHint, AFTER_RESPAWN_HINT_DELAY_MS,
false,
EHint.GAMEPLAY_WEAPON_INSPECTION,
false,
false);
423 else if (!m_aShownHints.Contains(
EHint.GAMEPLAY_VEHICLE_INVENTORY))
424 GetGame().GetCallqueue().CallLater(
ShowHint, AFTER_RESPAWN_HINT_DELAY_MS,
false,
EHint.GAMEPLAY_VEHICLE_INVENTORY,
false,
false);
432 void ShowHint(
EHint hintID,
bool showImmediately =
false,
bool showMultipleTimes =
false)
434 if (m_Campaign.IsTutorial())
437 if (RplSession.Mode() == RplMode.Dedicated)
446 bool showAlways =
true;
452 if (!showMultipleTimes && (m_aShownHints.Contains(hintID) ||
m_aHintQueue.Contains(hintID)))
455 float currentTime =
GetGame().GetWorld().GetWorldTime();
463 m_aShownHints.Insert(hintID);
464 SCR_HintManagerComponent.ShowHint(info, ignoreShown: showAlways);
467 float durationMs = 1000 * info.GetDuration();
483 ShowHint(hintId, showMultipleTimes:
true);
518 if (m_BaseWithPlayer)
538 array<SCR_MilitaryBaseComponent> bases = {};
539 baseManager.GetBases(bases);
542 foreach (SCR_MilitaryBaseComponent currentBase : bases)
544 if (currentBase.GetOwner() != faction)
549 if (friendlyBases == 3)
562 if (m_BaseWithPlayer)
565 m_BaseWithPlayer = base;
567 SCR_CampaignSeizingComponent seizingComponent = SCR_CampaignSeizingComponent.Cast(m_BaseWithPlayer.GetOwner().FindComponent(SCR_CampaignSeizingComponent));
569 if (seizingComponent)
571 OnSeizingTimerChange(seizingComponent.GetSeizingStartTimestamp(), seizingComponent.GetSeizingEndTimestamp());
582 if (m_BaseWithPlayer.GetFaction() != playerFaction)
585 if (m_BaseWithPlayer.IsHQRadioTrafficPossible(playerFaction))
595 taskBase = task.GetTargetBase();
597 if (taskBase != m_BaseWithPlayer)
614 ChimeraCharacter player = ChimeraCharacter.Cast(
SCR_PlayerController.GetLocalControlledEntity());
616 if (player && player.IsInVehicle())
634 covered = base.IsHQRadioTrafficPossible(m_Campaign.GetFactionByEnum(
SCR_ECampaignFaction.OPFOR));
636 covered = base.IsHQRadioTrafficPossible(m_Campaign.GetFactionByEnum(
SCR_ECampaignFaction.BLUFOR));
647 SCR_CampaignSeizingComponent seizingComponent = SCR_CampaignSeizingComponent.Cast(base.GetOwner().FindComponent(SCR_CampaignSeizingComponent));
649 if (seizingComponent)
652 if (m_BaseWithPlayer == base)
653 m_BaseWithPlayer =
null;
659 Faction winner =
GetGame().GetFactionManager().GetFactionByIndex(m_Campaign.GetWinningFactionId());
685 SCR_CampaignFactionManager fManager = SCR_CampaignFactionManager.Cast(
GetGame().GetFactionManager());
692 if (fManager.GetFactionIndex(localPlayerFaction) != factionID)
698 string playerName =
GetGame().GetPlayerManager().GetPlayerName(playerID);
702 if (mapEntity && mapEntity.IsOpen())
709 text =
"#AR-Campaign_MobileAssemblyDeployed-UC";
710 text2 =
"#AR-Campaign_MobileAssemblyPlayerName";
716 text =
"#AR-Campaign_MobileAssemblyDismantled-UC";
717 text2 =
"#AR-Campaign_MobileAssemblyPlayerName";
720 if (reconfigurerFaction && localPlayerFaction != reconfigurerFaction)
721 playerName = reconfigurerFaction.GetFactionName();
728 text =
"#AR-Campaign_MobileAssemblyDestroyed-UC";
733 if (text !=
string.Empty)
735 if (text2 !=
string.Empty && playerName !=
string.Empty)
756 void PlayRadioMsg(
SCR_ERadioMsg msg,
int factionId,
int baseCallsign,
int callerCallsignCompany,
int callerCallsignPlatoon,
int callerCallsignSquad,
int calledCallsignCompany,
int calledCallsignPlatoon,
int calledCallsignSquad,
int param,
float seed,
float quality)
758 if (m_Campaign.IsTutorial())
766 IEntity player = pc.GetMainEntity();
771 SCR_CommunicationSoundComponent soundComp = SCR_CommunicationSoundComponent.Cast(player.FindComponent(SCR_CommunicationSoundComponent));
776 SignalsManagerComponent signalComp = SignalsManagerComponent.Cast(player.FindComponent(SignalsManagerComponent));
781 int signalBase = signalComp.AddOrFindSignal(
"Base");
782 int signalCompanyCaller = signalComp.AddOrFindSignal(
"CompanyCaller");
783 int signalCompanyCalled = signalComp.AddOrFindSignal(
"CompanyCalled");
784 int signalPlatoonCaller = signalComp.AddOrFindSignal(
"PlatoonCaller");
785 int signalPlatoonCalled = signalComp.AddOrFindSignal(
"PlatoonCalled");
786 int signalSquadCaller = signalComp.AddOrFindSignal(
"SquadCaller");
787 int signalSquadCalled = signalComp.AddOrFindSignal(
"SquadCalled");
788 int signalSeed = signalComp.AddOrFindSignal(
"Seed");
789 int signalQuality = signalComp.AddOrFindSignal(
"TransmissionQuality");
791 SCR_CampaignFactionManager fManager = SCR_CampaignFactionManager.Cast(
GetGame().GetFactionManager());
797 SCR_MilitaryBaseCallsign callsignInfo;
800 callsignInfo = faction.GetBaseCallsignByIndex(base.GetCallsign());
802 callsignInfo = faction.GetBaseCallsignByIndex(base.GetCallsign(), m_Campaign.GetCallsignOffset());
805 signalComp.SetSignalValue(signalBase, callsignInfo.GetSignalIndex());
810 signalComp.SetSignalValue(signalCompanyCaller, callerCallsignCompany);
811 signalComp.SetSignalValue(signalPlatoonCaller, callerCallsignPlatoon);
812 signalComp.SetSignalValue(signalSquadCaller, callerCallsignSquad);
817 signalComp.SetSignalValue(signalCompanyCalled, calledCallsignCompany);
818 signalComp.SetSignalValue(signalPlatoonCalled, calledCallsignPlatoon);
819 signalComp.SetSignalValue(signalSquadCalled, calledCallsignSquad);
822 signalComp.SetSignalValue(signalSeed, seed);
823 signalComp.SetSignalValue(signalQuality, quality);
858 text =
"#AR-Campaign_Demotion-UC";
859 text2 =
"#AR-Rank_Renegade";
866 text =
"#AR-Campaign_Demotion-UC";
870 text2 = f.GetRankNameUpperCase(param);
878 text =
"#AR-Campaign_Promotion-UC";
879 text2 =
"#AR-Rank_WestPrivate";
886 text =
"#AR-Campaign_Promotion-UC";
887 text2 =
"#AR-Rank_WestCorporal";
894 text =
"#AR-Campaign_Promotion-UC";
895 text2 =
"#AR-Rank_WestSergeant";
902 text =
"#AR-Campaign_Promotion-UC";
903 text2 =
"#AR-Rank_WestLieutenant";
910 text =
"#AR-Campaign_Promotion-UC";
911 text2 =
"#AR-Rank_WestCaptain";
918 text =
"#AR-Campaign_Promotion-UC";
919 text2 =
"#AR-Rank_WestMajor";
1055 text =
"#AR-Campaign_BaseUnderAttack-UC";
1062 text2param1 = base.GetBaseName();
1063 text2param2 = base.GetCallsignDisplayName();
1065 if (m_BaseWithPlayer == base)
1139 text =
"#AR-Campaign_Building_Destroyed-UC";
1140 text2 = base.GetBaseName();
1141 param1 =
"#AR-Campaign_Building_Armory-UC";
1152 text =
"#AR-Campaign_Building_Destroyed-UC";
1153 text2 = base.GetBaseName();
1154 param1 =
"#AR-Campaign_Building_FuelDepot-UC";
1165 text =
"#AR-Campaign_Building_Destroyed-UC";
1166 text2 = base.GetBaseName();
1167 param1 =
"#AR-Campaign_Building_RepairDepot-UC";
1178 text =
"#AR-Campaign_Building_Available-UC";
1179 text2 = base.GetBaseName();
1180 param1 =
"#AR-Campaign_Building_Armory-UC";
1191 text =
"#AR-Campaign_Building_Available-UC";
1192 text2 = base.GetBaseName();
1193 param1 =
"#AR-Campaign_Building_FuelDepot-UC";
1204 text =
"#AR-Campaign_Building_Available-UC";
1205 text2 = base.GetBaseName();
1206 param1 =
"#AR-Campaign_Building_RepairDepot-UC";
1212 bool isFriendly = faction == fManager.GetPlayerFaction(pc.GetPlayerId());
1214 if (!msgName.IsEmpty())
1216 AudioSystem.TerminateSound(m_PlayedRadio);
1217 msgName = msgName +
"_" + faction.GetFactionKey();
1218 m_PlayedRadio = soundComp.SoundEvent(msgName);
1221 if (isFriendly && (!text.IsEmpty() || !text2.IsEmpty()))
1222 SCR_PopUpNotification.GetInstance().PopupMsg(text, duration, text2: text2, prio: prio, param1: param1, sound: sound, text2param1: text2param1, text2param2: text2param2);
1230 GetGame().GetCallqueue().CallLater(
ShowHint, 30000 + Math.RandomIntInclusive(0, 30000),
false,
EHint.CONFLICT_ELIMINATING_ENEMIES,
false,
false);
1246 if (RplSession.Mode() == RplMode.Dedicated)
1271 m_Campaign.GetBaseManager().GetOnLocalPlayerEnteredBase().Insert(
OnBaseEntered);
1272 m_Campaign.GetBaseManager().GetOnLocalPlayerLeftBase().Insert(
OnBaseLeft);
1277 SCR_PlayerXPHandlerComponent comp = SCR_PlayerXPHandlerComponent.Cast(
m_PlayerController.FindComponent(SCR_PlayerXPHandlerComponent));
1306 if (campaignBaseManager)
1308 campaignBaseManager.GetOnLocalPlayerEnteredBase().Remove(
OnBaseEntered);
1309 campaignBaseManager.GetOnLocalPlayerLeftBase().Remove(
OnBaseLeft);
1316 SCR_PlayerXPHandlerComponent comp = SCR_PlayerXPHandlerComponent.Cast(
m_PlayerController.FindComponent(SCR_PlayerXPHandlerComponent));
1345 if (
GetGame().GetWorld().GetWorldTime() < FEATURE_HINT_DELAY)
1384 RplComponent rpl = RplComponent.Cast(
m_PlayerController.FindComponent(RplComponent));
1386 if (rpl && rpl.IsOwner())
1393 super.OnPostInit(owner);
1398 SetEventMask(owner, EntityEvent.INIT);
1402 if (RplSession.Mode() == RplMode.Dedicated)
1406 Resource container = BaseContainerTools.LoadContainer(m_sHintsConfig);
1407 m_HintsConfig =
SCR_CampaignHintStorage.Cast(BaseContainerTools.CreateInstanceFromContainer(container.GetResource().ToBaseContainer()));
1434 enum SCR_ECampaignSeizingMessagePrio