User:PROXiCiDE/IsActorDetectedBy
Checks to see if a Actor is being detected by another Actor. If the Actor comes with in-range of the minimum distance of the target actor then they will be flagged as detected regardless.
If the actor doesn't have Line of Sight of the target or Target actor does not have Line of Sight with the Actor and as long as they are above the minimum distance then the Actor is not flagged for detection
SyntaxEdit
Bool Function IsActorDetectedBy(Actor akActor, Actor akTarget,Float fDistanceCheck = 600.0)
ParametersEdit
- akActor: The main actor.
- akTarget: The target actor who may have detected the main actor.
- fDistanceCheck : Minimum distance of the main actor before being detected by the target actor.
- Default: 600.0
Return ValueEdit
Whether this actor is currently detected by the other one or not.
ExamplesEdit
; Is the player being detected by Bob?
bool bResults = IsActorDetectedBy(Game.GetPlayer(), pBob)
ScriptEdit
Bool Function IsActorDetectedBy(Actor akActor, Actor akTarget,Float fDistanceCheck = 600.0)
If akActor && akTarget
;Actor does not have Line of Sight with target and only check if we are greater than the minimum required distance
If (!akActor.HasLOS(akTarget) || (!akTarget.HasLOS(akActor) && (akActor.GetDistance(akTarget) >= fDistanceCheck)))
Return False
EndIf
;Make a minimum requirement for Distance checking, if actor is in that threshold then detect us regardless
;This insures that the actor keeps a safe distance from the target
If (akActor.GetDistance(akTarget) <= fDistanceCheck)
Return True
EndIf
If akActor.IsDetectedBy(akTarget)
Return True
EndIf
EndIf
Return False
EndFunction