Special Types
Helper functions which let you construct internal data types.
Constructors
NewObject
NewObject(typeName: string
) -> GameType
string
) -> GameType
Create a new object of the type given by typeName
. This type should be an internal game type.
The geometric types discussed below can also be created with NewObject.
ToVector3
ToVector3(values: table<x: float, y: float, z: float>
) -> Vector3
table<x: float, y: float, z: float>
) -> Vector3
Create a new Vector3
from a table of x
, y
, and z
floats.
Property | Description |
| The x-axis component of the vector |
| The y-axis component of the vector |
| The z-axis component of the vector |
In Cyberpunk, the Z axis is the up axis.
ToVector4
ToVector4(values: table<x: float, y: float, z: float, w: float>
) -> Vector4
table<x: float, y: float, z: float, w: float>
) -> Vector4
Create a new Vector4
from a table of x
, y
, z
, and w
floats.
Property | Description |
| The x-axis component of the vector |
| The y-axis component of the vector |
| The z-axis component of the vector |
| The w-axis component of the vector |
You may notice that functions like PlayerPuppet:GetWorldPosition
will return a Vector4
, even though, intuitively, 3D coordinates only include x, y, and z values. These Vector4
values are known as homogenous coordinates in graphical programming, useful in matrix transformations.
All you really need to know is that the 4th value, w
, should always be 1 when you are dealing with 3D coordinates.
ToEulerAngles
ToEulerAngles(angles: table<roll: float, pitch: float, yaw: float>
) -> EulerAngles
table<roll: float, pitch: float, yaw: float>
) -> EulerAngles
Create a new EulerAngles
from a table of roll
, pitch
, and yaw
. Angle values are in degrees.
Property | Description |
| The horizontal angle in degrees along the axis pointing up. 0 is north, 90 is west, 180 and -180 are south, and -90 is east. |
| The vertical angle in degrees along the axis pointing to the right. -90 is down, 0 is straight ahead, and 90 is up. |
| The roll angle in degrees along the axis pointing forward. Positive values rotate anti-clockwise and negative values rotate clockwise. |
ToQuaternion
ToQuaternion(values: table<i: float, j: float, k: float, r: float>
) -> Quaternion
table<i: float, j: float, k: float, r: float>
) -> Quaternion
Create a new Quaternion
from a table of a vector part i
, j
, k
, and a scalar (real) part r
.
Property | Description |
| The x-axis component of the quaternion |
| The y-axis component of the quaternion |
| The z-axis component of the quaternion |
| The scalar (real) part of the quaternion |
Quaternions are also often expressed with w, x, y, z
terms, which map to our terms as following:
w == r
x == i
y == j
z == k
ToCName
ToCName(hash: table<hash_hi: uint32, hash_lo: uint32>
) -> CName
table<hash_hi: uint32, hash_lo: uint32>
) -> CName
Create a new CName
from a table of hash_hi
and hash_lo
.
Property | Description |
| The higher 32 bits of the |
| The lower 32 bits of the |
| The text value of the |
ToTweakDBID
ToTweakDBID(data: table<hash: uint32, length: uint8>
) -> TweakDBID
table<hash: uint32, length: uint8>
) -> TweakDBID
Create a new TweakDBID
from a table of hash
and length
.
Property | Description |
| The CRC32 hash of the item name |
| The length of the item name |
ToItemID
ToItemID(data: table<id: TweakDBID, rng_seed: uint32, unknown: uint16, maybe_type: uint8>
) -> ItemID
table<id: TweakDBID, rng_seed: uint32, unknown: uint16, maybe_type: uint8>
) -> ItemID
Create an ItemID
from a table of id
, rng_seed
, an unknown field unknown
, and an unknown field maybe_type
.
Property | Description |
| The TweakDBID referenced by this ItemID |
| Alias for |
| The RNG (random number generation) seed used for loot generation |
| Unknown field |
| Unknown field, possibly a type |
Last updated