GSC reference › Built-in
CanShootEnemy()
Built-in (engine)
Server
AI Called on: actor
Check to see if the actor can shoot his current enemy.
Signature
<actor> CanShootEnemy([cache duration])
Called on an entity: actor CanShootEnemy(...)
Parameters
| Name | Required? | Details |
|---|---|---|
| cache duration | Optional | (int) When set, uses a custom time value for the cache. |
Example (from Treyarch's docs)
canShootEnemy = self CanShootEnemy()
Real uses in BO3's scripts
Called 6 times in the decompiled scripts. A few, zombies first:
- scripts/zm/archetype_zod_companion.gsc, line 535
if(entity cansee(entity.enemy) && entity canshootenemy()) - scripts/zm/archetype_zod_companion.gsc, line 559
if(!entity cansee(entity.enemy) || !entity canshootenemy()) - scripts/shared/ai/archetype_human_exposed.gsc, line 221
if(!behaviortreeentity cansee(behaviortreeentity.enemy) || !behaviortreeentity canshootenemy()) - scripts/shared/ai/archetype_robot.gsc, line 3271
if(entity cansee(entity.enemy) && entity canshootenemy()) - scripts/cp/gametypes/_save.gsc, line 809
if(isactor(self) && self cansee(self.enemy) && self canshootenemy())
Related built-ins
- ClearEnemy()Clear the actor's current enemy entity.
- IsKnownEnemyInRadius()Checks if there is a known enemy in a radius for an AI.
- ShouldHoldGroundAgainstEnemy()Return true if enemy is within pathEnemyFightDist.
- IsKnownEnemyInVolume()Checks if there is a known enemy in a volume for an AI.
- IsActorShooting()Checks whether this entity is an ai is shooting
- CanAttackEnemyNode()Checks if this actor can attack its enemies node.
- CanShoot()Check to see if the actor can shoot the given position.
- GetClosestEnemySqDist()Get the distance to the nearest enemy
- Shoot()Makes this actor shoot.
- SetEnemyModel()Sets the model of the actor that actors enemies will see to the given model name
- GetShootAtPos()Gets the position an attacker would shoot at to hit this entity.For AI or player this is the eye position.For other entities it's the tag_eye if...
- SetEnemyGlobalScrambler()Set to true if there is a global enemy scrambler active
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).