SixL client API / game/graphics / GameGraphicsMp

Interface: GameGraphicsMp

Graphics: particle effects (looped and one-shot), decals, timecycle modifiers, tracked points, high quality photos and the screen.

Remarks

Positions are metres (x east, y north, z up). Particle effect handles and decal ids are integers.

Methods

addPetrolTrailDecalInfo()

addPetrolTrailDecalInfo(x, y, z, radius): void

Adds the information of a petrol trail decal: where a trail of fuel is laid.

Parameters

x

number

Centre x, metres.

y

number

Centre y, metres.

z

number

Centre z, metres.

radius

number

Radius, metres.

Returns

void

Example

mp.game.graphics.addPetrolTrailDecalInfo(0, 0, 72, 1);

animpostfxStopAll()

animpostfxStopAll(): void

The same as GameGraphicsMp.stopAllScreenEffects.

Returns

void

Example

mp.game.graphics.animpostfxStopAll();

beginTakeHighQualityPhoto()

beginTakeHighQualityPhoto(): Promise<boolean>

Starts taking a high quality photo.

Returns

Promise<boolean>

A Promise of true when the photo was started.

Example

const started = await mp.game.graphics.beginTakeHighQualityPhoto();

clearDrawOrigin()

clearDrawOrigin(): void

Clears the draw origin, so that drawing goes back to the screen's own coordinates.

Returns

void

Example

mp.game.graphics.clearDrawOrigin();

clearTimecycleModifier()

clearTimecycleModifier(): void

Removes the timecycle modifier.

Returns

void

Example

mp.game.graphics.clearTimecycleModifier();

createTrackedPoint()

createTrackedPoint(): Promise<number>

Creates a tracked point.

Returns

Promise<number>

A Promise of the new point's handle (an integer).

Example

const point = await mp.game.graphics.createTrackedPoint();

destroyTrackedPoint()

destroyTrackedPoint(point): void

Destroys a tracked point.

Parameters

point

number

The tracked point's handle.

Returns

void

Example

mp.game.graphics.destroyTrackedPoint(point);

doesParticleFxLoopedExist()

doesParticleFxLoopedExist(handle): Promise<boolean>

Tells whether a looped particle effect still exists.

Parameters

handle

number

The looped effect's handle.

Returns

Promise<boolean>

A Promise of true while the effect exists.

Example

const exists = await mp.game.graphics.doesParticleFxLoopedExist(handle);

drawRect()

drawRect(x, y, width, height, r, g, b, a, p8?): void

Draws a filled rectangle on the screen, for this frame.

Parameters

x

number

The rectangle's centre, as a fraction of the screen's width (0 left, 1 right).

y

number

The rectangle's centre, as a fraction of the screen's height (0 top, 1 bottom).

width

number

Its width, as a fraction of the screen's width.

height

number

Its height, as a fraction of the screen's height.

r

number

Red, 0..255.

g

number

Green, 0..255.

b

number

Blue, 0..255.

a

number

Alpha, 0..255, 255 is opaque.

p8?

boolean

Ignored.

Returns

void

Remarks

Call it every frame in the render event, as in RAGE MP: a rectangle that is not drawn again disappears. It is drawn by SixL's overlay, above the game and below the browsers.

Example

mp.events.add('render', () => mp.game.graphics.drawRect(0.5, 0.95, 0.3, 0.02, 0, 0, 0, 160));

drawText()

drawText(text, pos, data?): void

Draws a line of text on the screen, for this frame.

Parameters

text

string

The text.

pos

[number, number] | [number, number, number]

Where it is drawn, as fractions of the screen: [x, y] (0, 0 is the top left corner).

data?

Options: font (the font number), color ([r, g, b, a], white by default), scale ([x, y]: the second number is the text's size, about 0.3 for small and 1 for large; 0.5 by default), outline and centre (centred on pos).

centre?

boolean

color?

[number, number, number, number]

font?

number

outline?

boolean

scale?

[number, number]

Returns

void

Remarks

Call it every frame in the render event, as in RAGE MP: a text that is not drawn again disappears. It is drawn by SixL's overlay, above the game and below the browsers.

Example

mp.events.add('render', () => mp.game.graphics.drawText('SixL', [0.5, 0.1], { font: 4, color: [255, 255, 255, 255], scale: [0.5, 0.5], centre: true }));

enableMovieSubtitles()

enableMovieSubtitles(toggle): void

Shows or hides the subtitles of movies.

Parameters

toggle

boolean

true to enable them, false to disable them.

Returns

void

Example

mp.game.graphics.enableMovieSubtitles(true);

endPetrolTrailDecals()

endPetrolTrailDecals(): void

Ends the petrol trail decals that were started.

Returns

void

Example

mp.game.graphics.endPetrolTrailDecals();

freeMemoryForHighQualityPhoto()

freeMemoryForHighQualityPhoto(): void

Frees the memory that a high quality photo was using.

Returns

void

Example

mp.game.graphics.freeMemoryForHighQualityPhoto();

getScreenAspectRatio()

getScreenAspectRatio(b?): Promise<number>

The aspect ratio of the screen: width divided by height.

Parameters

b?

boolean

Accepted for RAGE MP compatibility; ignored.

Returns

Promise<number>

A Promise of the aspect ratio, for example 1.777 for 16:9.

Example

const ratio = await mp.game.graphics.getScreenAspectRatio();

getScreenCoordFromWorldCoord()

Call Signature

getScreenCoordFromWorldCoord(position): object

The same as GameGraphicsMp.world3dToScreen2d.

Parameters
position

IVector3

The point, metres.

Returns

object

The screen point, x and y from 0 to 1, or undefined when the point is behind the camera.

x
x: number
y
y: number
Example
const screen = mp.game.graphics.getScreenCoordFromWorldCoord({ x: 0, y: 0, z: 72 });

Call Signature

getScreenCoordFromWorldCoord(x, y, z): object

The same as GameGraphicsMp.world3dToScreen2d.

Parameters
x

number

x of the point, metres.

y

number

y of the point, metres.

z

number

z of the point, metres.

Returns

object

The screen point, x and y from 0 to 1, or undefined when the point is behind the camera.

x
x: number
y
y: number
Example
const screen = mp.game.graphics.getScreenCoordFromWorldCoord(0, 0, 72);

getStatusOfSaveHighQualityPhoto()

getStatusOfSaveHighQualityPhoto(): Promise<number>

The state of saving the high quality photo.

Returns

Promise<number>

A Promise of the state, an integer in the game's numbering.

Example

const state = await mp.game.graphics.getStatusOfSaveHighQualityPhoto();

getStatusOfSortedListOperation()

getStatusOfSortedListOperation(p0?): Promise<number>

The state of the last sorted list operation.

Parameters

p0?

number

Accepted for RAGE MP compatibility; ignored.

Returns

Promise<number>

A Promise of the state, an integer in the game's numbering.

Example

const state = await mp.game.graphics.getStatusOfSortedListOperation(0);

getStatusOfTakeHighQualityPhoto()

getStatusOfTakeHighQualityPhoto(): Promise<number>

The state of taking a high quality photo.

Returns

Promise<number>

A Promise of the state, an integer in the game's numbering.

Example

const state = await mp.game.graphics.getStatusOfTakeHighQualityPhoto();

getTimecycleModifierIndex()

getTimecycleModifierIndex(): Promise<number>

The index of the current timecycle modifier.

Returns

Promise<number>

A Promise of the index, an integer.

Example

const index = await mp.game.graphics.getTimecycleModifierIndex();

getTvVolume()

getTvVolume(): Promise<number>

The volume of the in-game television.

Returns

Promise<number>

A Promise of the volume, a float.

Example

const volume = await mp.game.graphics.getTvVolume();

getUsingnightvision()

getUsingnightvision(): Promise<boolean>

Tells whether the night vision effect is on.

Returns

Promise<boolean>

A Promise of true while night vision is on.

Example

const night = await mp.game.graphics.getUsingnightvision();

getUsingseethrough()

getUsingseethrough(): Promise<boolean>

Tells whether the see-through effect is on.

Returns

Promise<boolean>

A Promise of true while the see-through effect is on.

Example

const seeThrough = await mp.game.graphics.getUsingseethrough();

hasStreamedTextureDictLoaded()

hasStreamedTextureDictLoaded(textureDict): Promise<boolean>

Tells whether a streamed texture dictionary has finished loading.

Parameters

textureDict

string

The texture dictionary's name.

Returns

Promise<boolean>

A Promise of true once the dictionary is loaded.

Example

const loaded = await mp.game.graphics.hasStreamedTextureDictLoaded('commonmenu');

isTrackedPointVisible()

isTrackedPointVisible(point): Promise<boolean>

Tells whether a tracked point is visible on the screen.

Parameters

point

number

The tracked point's handle.

Returns

Promise<boolean>

A Promise of true while the point is visible.

Example

const visible = await mp.game.graphics.isTrackedPointVisible(point);

removeDecal()

removeDecal(decal): void

Removes one decal.

Parameters

decal

number

The decal's id, an integer.

Returns

void

Example

mp.game.graphics.removeDecal(decalId);

removeDecalsFromObject()

removeDecalsFromObject(object): void

Removes the decals from an object.

Parameters

object

GameEntity

The object.

Returns

void

Example

mp.game.graphics.removeDecalsFromObject(object.handle);

removeDecalsFromVehicle()

removeDecalsFromVehicle(vehicle): void

Removes the decals from a vehicle.

Parameters

vehicle

GameEntity

The vehicle.

Returns

void

Example

mp.game.graphics.removeDecalsFromVehicle(vehicle.handle);

removeDecalsInRange()

removeDecalsInRange(x, y, z, radius): void

Removes the decals within a sphere.

Parameters

x

number

Centre x, metres.

y

number

Centre y, metres.

z

number

Centre z, metres.

radius

number

Radius, metres.

Returns

void

Example

mp.game.graphics.removeDecalsInRange(0, 0, 72, 5);

removeParticleFx()

removeParticleFx(handle, p1): void

Removes a particle effect.

Parameters

handle

number

The effect's handle.

p1

boolean

The game's flag (true or false).

Returns

void

Example

mp.game.graphics.removeParticleFx(handle, false);

removeParticleFxInRange()

removeParticleFxInRange(x, y, z, radius): void

Removes the particle effects within a sphere.

Parameters

x

number

Centre x, metres.

y

number

Centre y, metres.

z

number

Centre z, metres.

radius

number

Radius, metres.

Returns

void

Example

mp.game.graphics.removeParticleFxInRange(0, 0, 72, 5);

removeVehicleCrewEmblem()

removeVehicleCrewEmblem(vehicle, p1?): void

Removes the crew emblem from a vehicle.

Parameters

vehicle

GameEntity

The vehicle.

p1?

number

An integer the game takes (0 when not needed).

Returns

void

Example

mp.game.graphics.removeVehicleCrewEmblem(vehicle.handle, 0);

resetParticleFxOverride()

resetParticleFxOverride(name): void

Removes a particle effect override made with GameGraphicsMp.setParticleFxOverride.

Parameters

name

GameNameOrHash

The effect's name, or its hash.

Returns

void

Example

mp.game.graphics.resetParticleFxOverride('exp_grd_bzgas_smoke');

saveHighQualityPhoto()

saveHighQualityPhoto(p0?): Promise<boolean>

Saves the high quality photo that was taken.

Parameters

p0?

number

An integer the game takes (0 when not needed).

Returns

Promise<boolean>

A Promise of true when the save was started.

Example

const saved = await mp.game.graphics.saveHighQualityPhoto(0);

setParticleFxLoopedAlpha()

setParticleFxLoopedAlpha(handle, alpha): void

Sets the transparency of a looped particle effect.

Parameters

handle

number

The looped effect's handle.

alpha

number

The alpha, a float.

Returns

void

Example

mp.game.graphics.setParticleFxLoopedAlpha(handle, 0.8);

setParticleFxLoopedColour()

setParticleFxLoopedColour(handle, r, g, b, p4): void

Sets the colour of a looped particle effect.

Parameters

handle

number

The looped effect's handle.

r

number

Red component, a float.

g

number

Green component, a float.

b

number

Blue component, a float.

p4

boolean

The game's flag (true or false); not used by the game.

Returns

void

Example

mp.game.graphics.setParticleFxLoopedColour(handle, 0, 1, 0, false);

setParticleFxLoopedFarClipDist()

setParticleFxLoopedFarClipDist(handle, distance): void

The same as GameGraphicsMp.setParticleFxLoopedRange.

Parameters

handle

number

The looped effect's handle.

distance

number

The distance, metres.

Returns

void

Example

mp.game.graphics.setParticleFxLoopedFarClipDist(handle, 50);

setParticleFxLoopedOffsets()

setParticleFxLoopedOffsets(handle, x, y, z, rx, ry, rz): void

Moves and turns a looped particle effect relative to its base.

Parameters

handle

number

The looped effect's handle.

x

number

Offset along x, metres.

y

number

Offset along y, metres.

z

number

Offset along z, metres.

rx

number

Rotation about x, degrees.

ry

number

Rotation about y, degrees.

rz

number

Rotation about z, degrees.

Returns

void

Example

mp.game.graphics.setParticleFxLoopedOffsets(handle, 0, 0, 0.5, 0, 0, 90);

setParticleFxLoopedRange()

setParticleFxLoopedRange(handle, distance): void

Sets how far a looped particle effect is drawn.

Parameters

handle

number

The looped effect's handle.

distance

number

The distance, metres.

Returns

void

Example

mp.game.graphics.setParticleFxLoopedRange(handle, 50);

setParticleFxLoopedScale()

setParticleFxLoopedScale(handle, scale): void

Sets the size of a looped particle effect.

Parameters

handle

number

The looped effect's handle.

scale

number

The scale factor, 1 is normal size.

Returns

void

Example

mp.game.graphics.setParticleFxLoopedScale(handle, 2);

setParticleFxNonLoopedAlpha()

setParticleFxNonLoopedAlpha(alpha): void

Sets the transparency of the next one-shot particle effect.

Parameters

alpha

number

The alpha, a float.

Returns

void

Example

mp.game.graphics.setParticleFxNonLoopedAlpha(0.5);

setParticleFxNonLoopedColour()

setParticleFxNonLoopedColour(r, g, b): void

Sets the colour of the next one-shot particle effect.

Parameters

r

number

Red component, a float.

g

number

Green component, a float.

b

number

Blue component, a float.

Returns

void

Example

mp.game.graphics.setParticleFxNonLoopedColour(1, 0, 0);

setParticleFxOverride()

setParticleFxOverride(name, override): void

Replaces one particle effect with another.

Parameters

name

GameNameOrHash

The effect's name, or its hash.

override

GameNameOrHash

The effect to play instead, its name or hash.

Returns

void

Example

mp.game.graphics.setParticleFxOverride('exp_grd_bzgas_smoke', 'exp_grd_grenade_smoke');

setPtfxAssetNextCall()

setPtfxAssetNextCall(asset): void

Sets the particle effect asset that the next effect call uses.

Parameters

asset

GameNameOrHash

The asset's name, or its hash.

Returns

void

Example

mp.game.graphics.setPtfxAssetNextCall('core');

setScriptGfxDrawOrder()

setScriptGfxDrawOrder(order): void

Sets the draw order of the script's graphics: which layer they are drawn on.

Parameters

order

number

The order, an integer.

Returns

void

Example

mp.game.graphics.setScriptGfxDrawOrder(4);

setStreamedTextureDictAsNoLongerNeeded()

setStreamedTextureDictAsNoLongerNeeded(textureDict): void

Marks a streamed texture dictionary as no longer needed, so that the game may unload it.

Parameters

textureDict

string

The texture dictionary's name.

Returns

void

Example

mp.game.graphics.setStreamedTextureDictAsNoLongerNeeded('commonmenu');

setTimecycleModifierStrength()

setTimecycleModifierStrength(strength): void

Sets how strong the current timecycle modifier is.

Parameters

strength

number

The strength, a float (0 is off, 1 is full).

Returns

void

Example

mp.game.graphics.setTimecycleModifierStrength(0.5);

setTrackedPointInfo()

setTrackedPointInfo(point, x, y, z, radius): void

Sets the position and radius of a tracked point (a point the game follows on screen).

Parameters

point

number

The tracked point's handle.

x

number

x, metres.

y

number

y, metres.

z

number

z, metres.

radius

number

Radius, metres.

Returns

void

Example

mp.game.graphics.setTrackedPointInfo(point, 0, 0, 72, 2);

setTransitionTimecycleModifier()

setTransitionTimecycleModifier(name, strength): void

Changes the timecycle modifier with a transition.

Parameters

name

GameNameOrHash

The modifier's name, or its hash.

strength

number

The strength, a float.

Returns

void

Remarks

Not confirmed in the game yet.

Example

mp.game.graphics.setTransitionTimecycleModifier('drug_trip', 0.5);

stopAllScreenEffects()

stopAllScreenEffects(): void

Stops all screen effects (the post-process effects of the screen).

Returns

void

Example

mp.game.graphics.stopAllScreenEffects();

stopParticleFxLooped()

stopParticleFxLooped(handle, p1): void

Stops a looped particle effect.

Parameters

handle

number

The looped effect's handle.

p1

boolean

The game's flag (true or false).

Returns

void

Example

mp.game.graphics.stopParticleFxLooped(handle, false);

useParticleFxAsset()

useParticleFxAsset(asset): void

The same as GameGraphicsMp.setPtfxAssetNextCall.

Parameters

asset

GameNameOrHash

The asset's name, or its hash.

Returns

void

Example

mp.game.graphics.useParticleFxAsset('core');

washDecalsFromVehicle()

washDecalsFromVehicle(vehicle, amount): void

Washes the decals off a vehicle.

Parameters

vehicle

GameEntity

The vehicle.

amount

number

A float the game takes for the wash.

Returns

void

Example

mp.game.graphics.washDecalsFromVehicle(vehicle.handle, 1);

washDecalsInRange()

washDecalsInRange(x, y, z, radius, amount): void

Washes the decals off the area in a sphere.

Parameters

x

number

Centre x, metres.

y

number

Centre y, metres.

z

number

Centre z, metres.

radius

number

Radius, metres.

amount

number

A float the game takes after the radius.

Returns

void

Example

mp.game.graphics.washDecalsInRange(0, 0, 72, 5, 1);

world3dToScreen2d()

Call Signature

world3dToScreen2d(position): object

Converts a world point to a point on the screen, from the camera of the latest frame.

Parameters
position

IVector3

The point, metres.

Returns

object

The screen point, x and y from 0 to 1 (0, 0 is the top left corner), or undefined when the point is behind the camera or no camera is known yet.

x
x: number
y
y: number
Remarks

Computed from the camera of the latest frame, not read from the game; the camera's roll is taken into account (positive turns the camera clockwise, as seen from behind).

Example
const screen = mp.game.graphics.world3dToScreen2d({ x: 0, y: 0, z: 72 });

Call Signature

world3dToScreen2d(x, y, z): object

Converts a world point to a point on the screen, from the camera of the latest frame.

Parameters
x

number

x of the point, metres.

y

number

y of the point, metres.

z

number

z of the point, metres.

Returns

object

The screen point, x and y from 0 to 1 (0, 0 is the top left corner), or undefined when the point is behind the camera or no camera is known yet.

x
x: number
y
y: number
Remarks

Computed from the camera of the latest frame, not read from the game; the camera's roll is taken into account (positive turns the camera clockwise, as seen from behind).

Example
const screen = mp.game.graphics.world3dToScreen2d(0, 0, 72);