GSC reference › Built-in
CanSee()
Built-in (engine)
Server
AI Called on: sentient
Check to see if the AI can see the given entity.
Signature
<sentient> CanSee(<target>, [cacheLength])
Called on an entity: sentient CanSee(...)
Parameters
| Name | Required? | Details |
|---|---|---|
| target | Required | (entity) The entity to check. |
| cacheLength | Optional | (integer) The cache length |
Example (from Treyarch's docs)
if( self CanSee( player ) )
Real uses in BO3's scripts
Called 27 times in the decompiled scripts. A few, zombies first:
- scripts/zm/_zm_ai_margwa_elemental.gsc, line 812
if(!entity cansee(entity.favoriteenemy)) - scripts/zm/archetype_genesis_keeper_companion.gsc, line 699
if(isdefined(enemy.completed_emerging_into_playable_area) && enemy.completed_emerging_into_playable_area && entity cansee(entity.leader,... - scripts/zm/archetype_zod_companion.gsc, line 535
if(entity cansee(entity.enemy) && entity canshootenemy()) - scripts/shared/abilities/gadgets/_gadget_clone.gsc, line 887
if(clone cansee(player)) - scripts/shared/ai/archetype_human_exposed.gsc, line 221
if(!behaviortreeentity cansee(behaviortreeentity.enemy) || !behaviortreeentity canshootenemy())
Related built-ins
- SeeRecently()Check to see if the AI saw the given sentient in the past <time>.
- CantSeeEntities()Returns the set of entities that a player cannot see within a given angle, given a set of entities
- SetGoal()Set this AI 's goal.
- ForceTeleport()Force Teleport the actor to a new position with the given origin and angles, regardless of wether it will be visible to the player or not.
- OrientMode()Set the orient mode of this actor.
- AnimMode()Set the way that animation deltas are interpreted by the game engine
- PathMode()Set the path mode of this actor.
- HasPath()Returns true/false if AI has a path
- ClearForcedGoal()Clears the forcedGoal for this AI's goal.
- setgoalpos()Set this AI 's goal.
- UsePosition()Override where the actor should run to.
- GetPerfectInfo()Forces the AI to become aware of this entity regardless of whether it can be seen or not.
New to GSC?
Start with the basics, or paste a compile error to get the fix.
Built-in descriptions, parameters and examples come from Treyarch's BO3 mod tools docs. Usage links point at shiversoftdev/t7-source (decompiled BO3 scripts).