Difference between revisions of "User:PROXiCiDE/IsActorDetectedBy"
Jump to navigation
Jump to search
imported>PROXiCiDE (→Script) |
imported>Mardoxx m |
||
Line 1: | Line 1: | ||
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. | 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. | ||
Latest revision as of 18:15, 7 February 2013
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[edit | edit source]
Bool Function IsActorDetectedBy(Actor akActor, Actor akTarget,Float fDistanceCheck = 600.0)
Parameters[edit | edit source]
- 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[edit | edit source]
Whether this actor is currently detected by the other one or not.
Examples[edit | edit source]
; Is the player being detected by Bob?
bool bResults = IsActorDetectedBy(Game.GetPlayer(), pBob)
Script[edit | edit source]
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