20 protected ref array<ref SCR_VoiceoverLine>
m_aQueue = {};
129 m_fTimer += GetWorld().GetFixedTimeSlice();
176 IEntity entity = instigatorContextData.GetVictimEntity();
215 if (actorCharController && actorCharController.IsUnconscious())
311 SCR_VoiceoverSequence sequence =
m_Data.GetSequenceByName(sequenceName);
318 m_aActors = {actor1, actor2, actor3, actor4, actor5};
336 SCR_VoiceoverSequence sequence =
m_Data.GetSequenceByName(sequenceName);
350 void PlaySequenceGlobal(
string sequenceName, notnull array<IEntity> actors,
bool playImmediately =
true)
352 array<RplId> actorIds = {};
354 foreach (
IEntity actor : actors)
368 void PlaySequenceFor(
string sequenceName, notnull array<IEntity> actors, notnull array<int> targetPlayerIds,
bool playImmediately =
true)
370 if (targetPlayerIds.IsEmpty())
373 array<RplId> actorIds = {};
375 foreach (
IEntity actor : actors)
388 protected void RpcDo_PlaySequence(
string dataName,
string sequenceName, array<RplId> actorIds,
bool playImmediately)
390 array<IEntity> actors = {};
392 foreach (
RplId actorId : actorIds)
405 protected void RpcDo_PlaySequenceFor(
string dataName,
string sequenceName, array<RplId> actorIds, array<int> targetPlayerIds,
bool playImmediately)
410 array<IEntity> actors = {};
412 foreach (
RplId actorId : actorIds)
439 SCR_VoiceoverLineStandalone line =
m_Data.GetLineByName(lineName);
447 int customThreshold = line.GetCustomSubtitleDistanceThreshold();
449 if (customThreshold > 0)
450 distanceThreshold = customThreshold * customThreshold;
452 CameraBase playerCamera =
GetGame().GetCameraManager().CurrentCamera();
454 if (!actor || (playerCamera &&
vector.DistanceSq(actor.GetOrigin(), playerCamera.GetOrigin()) <= distanceThreshold))
455 PlayLineActual(line.GetSoundEventName(), line.GetSubtitleText(), actor, line.GetActorName(), line.GetStartAnimCommandParameter(), line.InterruptCurrentLine(), line.GetFinishAnimCommandParameter());
457 PlayLineActual(line.GetSoundEventName(),
string.Empty, actor, animCommandParam: line.GetStartAnimCommandParameter(), line.InterruptCurrentLine(), line.GetFinishAnimCommandParameter());
473 void PlayLineFor(
string lineName, notnull
IEntity actor, notnull array<int> targetPlayerIds,
bool playImmediately =
true)
475 if (targetPlayerIds.IsEmpty())
496 protected void RpcDo_PlayLineFor(
string dataName,
string lineName,
RplId actorId, array<int> targetPlayerIds,
bool playImmediately)
512 void PlayCustomLine(
string soundEventName,
string subtitle,
IEntity actor = null,
string actorName =
string.Empty,
bool playImmediately =
true)
549 comp.CallCommand4I(commandId, 0, 0, commandParam, 0, 0);
591 if (actorName.IsEmpty())
602 protected void PlayLineActual(
string eventName,
string subtitle,
IEntity actor = null,
string actorName =
string.Empty,
int animCommandParam = 0,
bool interruptCurrentLine = 1,
int finishAnimCommandParam = -1)
621 if (!comp || !comp.IsUnconscious())
642 if (animCommandParam > 0)
669 CameraBase playerCamera =
GetGame().GetCameraManager().CurrentCamera();
674 if (customThreshold > 0)
675 distanceThreshold = customThreshold * customThreshold;
677 if (playerCamera &&
vector.DistanceSq(component.GetOwner().GetOrigin(), playerCamera.GetOrigin()) <= distanceThreshold)
695 protected void ShowSubtitle(
string subtitle,
string actorName,
string eventName)
712 if (actorName.IsEmpty())
735 PlayerController pc =
GetGame().GetPlayerController();
740 return pc.GetControlledEntity();
744 protected void OnFinished(
string eventName =
string.Empty,
bool hideSubtitles =
true)
764 [
Friend(SCR_VoiceoverSystemSerializer)]
767 SCR_VoiceoverSystemSnapshot snapshot =
new SCR_VoiceoverSystemSnapshot();
772 snapshot.m_aQueue.Insert(line);
786 [
Friend(SCR_VoiceoverSystemSerializer)]
791 PlayCustomLine(snapshot.m_sCurrentSoundEvent, snapshot.m_sCurrentSubtitle, snapshot.m_CurrentActor, snapshot.m_sCurrentActorName,
true);
817class SCR_VoiceoverSystemSnapshot
ArmaReforgerScripted GetGame()
RplMode
Mode of replication.
SCR_BaseGameMode GetGameMode()
ScriptInvokerBase< ScriptInvokerVoidMethod > ScriptInvokerVoid
ScriptInvokerBase< ScriptInvokerStringMethod > ScriptInvokerString
SCR_VoiceoverSystem m_sData
string m_sCurrentSoundEvent
string m_sCurrentActorName
ref array< IEntity > m_aActors
string m_sCurrentSequence
string m_sCurrentSubtitle
ref map< SCR_EVoiceoverActor, string > m_mActorNames
ref array< ref SCR_VoiceoverLine > m_aQueue
proto external Managed FindComponent(typename typeName)
Object holding reference to resource. In destructor release the resource.
Replication item identifier.
ScriptInvoker GetOnControllableDeleted()
ScriptInvokerBase< SCR_BaseGameMode_OnControllableDestroyed > GetOnControllableDestroyed()
ref OnLifeStateChangedInvoker m_OnLifeStateChanged
OnSoundEventFinishedInvoker GetOnSoundEventFinished()
OnSoundEventStartedInvoker GetOnSoundEventStarted()
SCR_InfoDisplay FindInfoDisplay(typename type)
Return hud component of given type.
static SCR_HUDManagerComponent GetHUDManager()
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
string GetSoundEventName()
int GetStartAnimCommandParameter()
int GetFinishAnimCommandParameter()
int GetCustomSubtitleDistanceThreshold()
bool InterruptCurrentLine()
SCR_EVoiceoverActor GetActor()
static float GetLingerDuration()
ScriptInvokerVoid GetOnFinished()
Triggered when a line or sequence finishes playing.
static const string DEFAULT_ANIM_COMMAND
void OnSoundEventStarted(SCR_CommunicationSoundComponent component, string eventName, AudioHandle handle, int priority)
void RemoveActorUnconsciousCheck(notnull IEntity actor)
void ShowSubtitle(string subtitle, string actorName, string eventName)
void PlayCustomLine(string soundEventName, string subtitle, IEntity actor=null, string actorName=string.Empty, bool playImmediately=true)
Plays a custom voiceover line.
void FailsafeSubtitleToggle(string eventName)
void ApplySnapshot(notnull SCR_VoiceoverSystemSnapshot snapshot)
void ~SCR_VoiceoverSystem()
void OnControllableDeleted(IEntity entity)
Stop the voiceover when the speaker is deleted.
string m_sCurrentSequence
void PlaySequenceGlobal(string sequenceName, notnull array< IEntity > actors, bool playImmediately=true)
Same as PlaySequence but plays the VO for all clients. Has to be executed on server.
void OnControllableDestroyed(notnull SCR_InstigatorContextData instigatorContextData)
Stop the voiceover when the speaker dies.
ResourceName m_sDataResourceName
void OnActorLifeStateChanged()
Stop the voiceover when the speaker becomes unconscious.
ref ScriptInvokerVoid m_OnFinished
void AddActorUnconsciousCheck(notnull IEntity actor)
SCR_CommunicationSoundComponent m_PlayingSoundComponent
AudioHandle m_iAudioHandle
ref array< IEntity > m_aActors
void RegisterActor(notnull IEntity entity)
static const int SUBTITLE_FAILSAFE_TOGGLE_DELAY_MS
static SCR_VoiceoverSystem GetInstance()
void PlaySequence(string sequenceName, IEntity actor1=null, IEntity actor2=null, IEntity actor3=null, IEntity actor4=null, IEntity actor5=null, bool playImmediately=true)
Plays a sequence of voiceover lines defined in loaded config (see SetData).
void OnFinished(string eventName=string.Empty, bool hideSubtitles=true)
ref map< SCR_EVoiceoverActor, string > m_mActorNames
string m_sCurrentActorName
void PlaySequenceActorsArray(string sequenceName, notnull array< IEntity > actors, bool playImmediately=true)
Same as PlaySequence but accepts an array of actors.
string m_sCurrentSubtitle
string m_sCurrentSubtitleEvent
void RpcDo_PlaySequence(string dataName, string sequenceName, array< RplId > actorIds, bool playImmediately)
void RpcDo_PlaySequenceFor(string dataName, string sequenceName, array< RplId > actorIds, array< int > targetPlayerIds, bool playImmediately)
SCR_VoiceoverSystemSnapshot CreateSnapshot()
ref SCR_VoiceoverData m_Data
void OnUpdatePoint(WorldUpdatePointArgs args)
void RpcDo_PlayLineFor(string dataName, string lineName, RplId actorId, array< int > targetPlayerIds, bool playImmediately)
void PlayLineGlobal(string lineName, notnull IEntity actor, bool playImmediately=true)
Same as PlayLine but plays the VO for all clients. Has to be executed on server.
void PlayLine(string lineName, IEntity actor=null, bool playImmediately=true)
Plays a voiceover line defined in loaded config (see SetData).
ref array< SCR_CommunicationSoundComponent > m_aHandledComponents
void PlaySequenceFor(string sequenceName, notnull array< IEntity > actors, notnull array< int > targetPlayerIds, bool playImmediately=true)
Same as PlaySequenceGlobal but plays the VO for clients defined by player IDs.
ref array< ref SCR_VoiceoverLine > m_aQueue
void SetActorName(SCR_EVoiceoverActor actor, string name)
Actor name associated with the given enum will be shown in the subtitle.
static const string DEFAULT_ANIM_VARIABLE
void PlayLineFor(string lineName, notnull IEntity actor, notnull array< int > targetPlayerIds, bool playImmediately=true)
Same as PlayLineGlobal but plays the VO for clients defined by player IDs.
ref ScriptInvokerString m_OnFinishedEvent
void PlayLineActual(string eventName, string subtitle, IEntity actor=null, string actorName=string.Empty, int animCommandParam=0, bool interruptCurrentLine=1, int finishAnimCommandParam=-1)
void CallAnimCommand(IEntity actor, int commandParam)
void SetData(ResourceName config)
static const int SUBTITLE_VISIBILITY_DISTANCE_SQ
ScriptInvokerString GetOnFinishedEvent()
Triggered when an event finishes playing.
void PlayFromQueue(bool start=false)
override event bool ShouldBePaused()
void RpcDo_PlayLine(string dataName, string lineName, RplId actorId, bool playImmediately)
ref SCR_VoiceoverSubtitles m_SubtitlesDisplay
IEntity GetDefaultActor()
void OnSoundEventFinished(SCR_CommunicationSoundComponent component, string eventName, AudioHandle handle, int priority, bool terminated)
static const float PAUSE_BETWEEN_LINES
string m_sCurrentSoundEvent
void Rpc(func method, void p0=NULL, void p1=NULL, void p2=NULL, void p3=NULL, void p4=NULL, void p5=NULL, void p6=NULL, void p7=NULL)
Structure holding world system meta-information required by the engine.
Structure holding extra data of WorldSystem update point.
WorldSystemPoint ESystemPoint
int IsEnabled()
Returns true if the light is enabled.
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.