Skip to content

System COG Functions

Function List

GetSenderRef

GetSenderRef() -> int

GetSenderType

GetSenderType() -> int

GetSenderID

GetSenderID() -> int

GetSourceType

GetSourceType() -> int

GetSourceRef

GetSourceRef() -> int

GetSysDate

GetSysDate() -> Vector

GetSysTime

GetSysTime() -> Vector

InEditor

InEditor() -> int

GetThingCount

GetThingCount() -> int

GetGravity

GetGravity() -> float

SetGravity

SetGravity(float gravity)

GetLevelTime

GetLevelTime() -> float

GetGameTime

GetGameTime() -> int

GetFlexGameTime

GetFlexGameTime() -> float

GetThingTemplateCount

GetThingTemplateCount(Template template) -> int

SetFog

SetFog(int bEnable, Vector vecColor, float start, float end)

FindNewSector

FindNewSector(Vector startPos, Sector sector, Vector endPos) -> int

FindNewSectorFromThing

FindNewSectorFromThing(Thing thing, Vector vec) -> int

Sleep

Sleep(float wait)

SetPulse

SetPulse(float interval)

SetTimer

SetTimer(float when)

SetTimerEx

SetTimerEx(float when, int param1, int param2, int param3)

KillTimerEx

KillTimerEx(int timerId)

Reset

Reset()

MaterialAnim

MaterialAnim(Material mat, float fps, int flags) -> int

StopMaterialAnim

StopMaterialAnim(Material material)

StopAnim

StopAnim(int animID)

StopSurfaceAnim

StopSurfaceAnim(Surface surf)

GetSurfaceAnim

GetSurfaceAnim(Surface surf) -> int

SurfaceAnim

SurfaceAnim(Surface surf, float speed, int flags) -> int

GetKeyLen

GetKeyLen(Keyframe keyframe) -> float

LoadTemplate

LoadTemplate(string templateName) -> int

LoadKeyframe

LoadKeyframe(string keyFilename) -> int

LoadModel

LoadModel(string modelFilename) -> int

Print

Print(string value)

PrintInt

PrintInt(int value)

PrintFlex

PrintFlex(float value)

PrintVector

PrintVector(Vector vec)

printhex

printhex(int value)

VectorAdd

VectorAdd(Vector b, Vector a) -> Vector

VectorSub

VectorSub(Vector b, Vector a) -> Vector

VectorDot

VectorDot(Vector a, Vector b) -> float

VectorCross

VectorCross(Vector a, Vector b) -> Vector

VectorSet

VectorSet(float x, float y, float z) -> Vector

VectorLen

VectorLen(Vector vec) -> float

VectorScale

VectorScale(Vector a, float scalar) -> Vector

VectorDist

VectorDist(Vector b, Vector a) -> float

VectorX

VectorX(Vector vec) -> float

VectorY

VectorY(Vector vec) -> float

VectorZ

VectorZ(Vector vec) -> float

VectorNorm

VectorNorm(Vector vec) -> Vector

VectorEqual

VectorEqual(Vector b, Vector a) -> int

VectorRotate

VectorRotate(Vector vec, Vector pyr) -> Vector

VectorTransformToOrient

VectorTransformToOrient(Thing thing, Vector vec) -> Vector

GetSithMode

GetSithMode() -> int

GetDifficulty

GetDifficulty() -> int

SetSubModeFlags

SetSubModeFlags(int value)

GetSubModeFlags

GetSubModeFlags() -> int

ClearSubModeFlags

ClearSubModeFlags(int value)

SetDebugModeFlags

SetDebugModeFlags(int value)

GetDebugModeFlags

GetDebugModeFlags() -> int

ClearDebugModeFlags

ClearDebugModeFlags(int value)

BitSet

BitSet(int flags, int mask) -> int

BitTest

BitTest(int flags, int mask) -> int

BitClear

BitClear(int flags, int mask) -> int

FireProjectile

FireProjectile(Thing shooter, Template projectile, Sound fireSnd, int submode, Vector fireOffset, Vector fireError, float extra, int flags, float autoAimFovX, float autoAimFovZ) -> Thing
Creates and fires a projectile from the specified shooter using the provided projectile template, with additional parameters influencing the shot.

Parameters: - shooter -The game object which fires projectile. - projectile - The template used for creating and shooting a projectile game object. - fireSnd - Fire sound effect. - submode - The shooter puppet submode number to play upon firing projectile. - aimError - Shot projectile aim error. Affected by aimFov and aimMax depending on the flags parameter. - scale - The projectile properties scale multiplier. The flags parameter defines which projectile property is affected by this multiplier. - aimFov - The aim field of view. - aimMax - The projectile max aim. - flags: * 0x01 - Multiply projectile velocity with scale param. * 0x02 - Multiply projectile impact damage with scale param. * 0x04 - Multiply unknown projectile param with scale param. * 0x08 - Multiply unknown projectile param with scale param. * 0x10 - Burst fire up to 10 projectiles if shooter has set fire wait time. (Set by SetFireWait cog function) * 0x20 - [Player] Apply aimFov and aimMax to aimError. * 0x80 - [Player] Shoot projectile from the right hand of the player's 3D model (inrhand) * 0x100 - [Player] Shoot projectile from the torso of the player's 3D model (intorso). There is a bug for this flag and the rotation vector is not initialized which can crash the game. * 0x200 - Add weapon fire effect. Note, this only works if shooter model has inrhand hierarchy hand node defined in it's model 3DO file.
For 250 ms engine switches the current weapon model with firing weapon model for weapons: * pistol - weap_revolver_fire.3do * tokarev - weap_tokarev_fire.3do * mauser - weap_mauser_fire.3do * simonov - weap_simonov_fire.3do * submachine - weap_ppsh41_fire.3do * shotgun - weap_toz34_fire.3do

Return
On success projectile object is returned, otherwise -1.

ActivateWeapon

ActivateWeapon(Thing thing, float timeToWait)

DeactivateWeapon

DeactivateWeapon(Thing thing) -> float

DeactivateCurWeapon

DeactivateCurWeapon(Thing thing)

SetMountWait

SetMountWait(Thing thing, float timeToWait)

SetFireWait

SetFireWait(Thing thing, float waitTime)

SetAimWait

SetAimWait(Thing thing, float timeToWait)

SelectWeapon

SelectWeapon(Thing thing, int weaponID) -> int

SelectWeaponWait

SelectWeaponWait(Thing thing, int weaponId) -> int

DeselectWeapon

DeselectWeapon(Thing thing) -> int

DeselectWeaponWait

DeselectWeaponWait(Thing thing) -> int

SetCurWeapon

SetCurWeapon(Thing thing, int weaponID)

GetCurWeapon

GetCurWeapon(Thing thing) -> int

SetWeaponModel

SetWeaponModel(Thing thing, int typeId)

ResetWeaponModel

ResetWeaponModel(Thing thing)

LoadHolsterModel

LoadHolsterModel(int type, string modelFilename) -> int

SetHolsterModel

SetHolsterModel(Thing thing, int weaponId, int meshNum)

ResetHolsterModel

ResetHolsterModel(Thing thing, int holsterNum)

GetLastPistol

GetLastPistol(Thing thing) -> int

GetLastRifle

GetLastRifle(Thing thing) -> int

CopyPlayerHolsters

CopyPlayerHolsters(Thing sourceThing, Thing destThing)

SendMessage

SendMessage(cog dstCog, int msgType)

SendMessageEx

SendMessageEx(cog dstCog, int msg, int param0, int param1, int param2, int param3) -> int

ReturnEx

ReturnEx(int returnValue)

GetParam

GetParam(int idx) -> int

SetParam

SetParam(int num, int val)

SetInvFlags

SetInvFlags(Thing thing, int bin, int flags)

SetMapModeFlags

SetMapModeFlags(int value)

GetMapModeFlags

GetMapModeFlags() -> int

ClearMapModeFlags

ClearMapModeFlags(int value)

GetMaterialCel

GetMaterialCel(Material value) -> int

SetMaterialCel

SetMaterialCel(Material mat, int celNum) -> int

SetCameraFocus

SetCameraFocus(int camNum, Thing thing)

GetPrimaryFocus

GetPrimaryFocus(int camNum) -> int

GetSecondaryFocus

GetSecondaryFocus(int camNum) -> int

SetCurrentCamera

SetCurrentCamera(int camNum)

GetCurrentCamera

GetCurrentCamera() -> int

CycleCamera

CycleCamera()

SetPOVShake

SetPOVShake(Vector posOffset, Vector angleOffset, float posDelta, float angDelta)

SetCameraStateFlags

SetCameraStateFlags(int flags)

GetCameraStateFlags

GetCameraStateFlags() -> int

SetCameraSecondaryFocus

SetCameraSecondaryFocus(int camNum, Thing focus)

HeapNew

HeapNew(int size)

HeapSet

HeapSet(int idx)

HeapGet

HeapGet(int num) -> int

HeapFree

HeapFree()

GetSelfCog

GetSelfCog() -> int

GetMasterCog

GetMasterCog() -> int

SetMasterCog

SetMasterCog(cog sithCog_g_pMasterCog)

GetCogByIndex

GetCogByIndex(int idx) -> int

IsMulti

IsMulti() -> int

IsServer

IsServer() -> int

SendTrigger

SendTrigger(Thing thing, int srcIdx, int param0, int param1, int param2, int param3)

AutoSavegame

AutoSavegame()

GetHintSolved

GetHintSolved(Thing thing) -> int

SetHintSolved

SetHintSolved(Thing thing)

SetHintUnsolved

SetHintUnsolved(Thing thing)

Rand

Rand() -> float

RandBetween

RandBetween(int min, int max) -> int

RandVec

RandVec() -> Vector

Round

Round(float val) -> float

Truncate

Truncate(float val) -> float

Abs

Abs(float val) -> float

Pow

Pow(float base, float exp) -> float

Sin

Sin(float angle) -> float

Cos

Cos(float angle) -> float

ArcTan

ArcTan(float x, float y) -> float

GetPerformanceLevel

GetPerformanceLevel() -> int

IsLevelName

IsLevelName(string name) -> int