GSC reference › Built-in
Abs()
Built-in (engine)
Server + client
Math
Returns the absolute value of a float
Signature
Abs(<value>)
Parameters
| Name | Required? | Details |
|---|---|---|
| value | Required | A float or integer value. |
Example (from Treyarch's docs)
x = Abs( x )
Real uses in BO3's scripts
Called 349 times in the decompiled scripts. A few, zombies first:
- scripts/zm/_zm_ai_astro.gsc, line 448
if(abs(yaw) > 45) - scripts/zm/_zm_ai_dogs.gsc, line 847
if(abs(dogangle) > 90 && distance2d(self.origin, players[i].origin) > 100) - scripts/zm/_zm_ai_margwa.gsc, line 455
yaw = abs(zombie_utility::getyawtospot(entity.destroy_octobomb.origin)); - scripts/zm/_zm_ai_margwa_elemental.gsc, line 763
if(abs(angleclamp180(enemy_angles[0])) > 60) - scripts/zm/_zm_ai_margwa_no_idgun.gsc, line 497
yaw = abs(zombie_utility::getyawtospot(entity.destroy_octobomb.origin));
Related built-ins
- Int()Casts a floating point number or a string to an integer
- RandomFloatRange()Returns a random floating point number r, where min <= r < max
- DistanceSquared()Returns the squared distance between two points - this is cheaper than the actual distance as it doesn't involve a square root
- RandomInt()Returns a random integer between 0 and max-1 inclusive
- RandomIntRange()Returns a random integer r, where min <= r < max
- AnglesToForward()Returns the forward vector corresponding to a set of angles.
- VectorNormalize()Returns a normalized copy of this vector
- Distance2DSquared()Returns the squared distance between two points, ignores height difference.
- Distance()Returns the distance between two points
- VectorDot()Returns the dot product of two vectors
- VectortoAngles()Returns a set of angles corresponding to the given vector.
- RandomFloat()Returns a random floating point number r, where 0 <= r < max
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).