User:PROXiCiDE/IsActorDetectedBy
< User:PROXiCiDE
Revision as of 22:43, 24 January 2013 by imported>PROXiCiDE (→Script)
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
Syntax
Bool Function IsActorDetectedBy(Actor akActor, Actor akTarget,Float fDistanceCheck = 600.0)
Parameters
- 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 Value
Whether this actor is currently detected by the other one or not.
Examples
; Is the player being detected by Bob?
bool bResults = IsActorDetectedBy(Game.GetPlayer(), pBob)
Script
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 player keeps a safe distance from the Actor
If (akActor.GetDistance(akTarget) <= fDistanceCheck)
Return True
EndIf
If akActor.IsDetectedBy(akTarget)
Return True
EndIf
EndIf
Return False
EndFunction