Difference between revisions of "User:PROXiCiDE/IsActorDetectedBy"
Jump to navigation
Jump to search
imported>PROXiCiDE (→Script) |
imported>PROXiCiDE (→Script) |
||
Line 36: | Line 36: | ||
;Make a minimum requirement for Distance checking, if actor is in that threshold then detect us regardless | ;Make a minimum requirement for Distance checking, if actor is in that threshold then detect us regardless | ||
;This insures that the | ;This insures that the actor keeps a safe distance from the target | ||
If (akActor.GetDistance(akTarget) <= fDistanceCheck) | If (akActor.GetDistance(akTarget) <= fDistanceCheck) | ||
Return True | Return True |
Revision as of 22:44, 24 January 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
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 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