Help Home

Tutorials

Weapon Scr. I
Weapon Scr. II
Missions

Reference

All Commands
General
Load/Add
Graphics
HUD
Sounds
Player
Terrain
Projectiles
Particles
Collision
Objects
AI
Nodes
Missions

Commands: graphics

Legend

  • X - X is a number
  • 'X' - X is a string (a letter/word/text)
  • [X=0] - X is an optional parameter with value 0 when omitted (NEVER add [] to your script!)
  • hard sync - command is hard synced

drawhud(IMAGE, X, Y, [MODE=0])

Parameters:
IMAGE - ID of an image
X - x coordinate
Y - y coordinate
[MODE=0] - rendering mode
Draws IMAGE at the (X|Y) coordinate. The position is NOT affected by scrolling.
Use this function to draw your own interface elements.

MODE can be used to switch between different rendering modes:
0 - draw always, standard
1 - only draw when all menus are closed
2 - draw as normal image, just ignore scrolling

drawimage(IMAGE, X, Y)

Parameters:
IMAGE - ID of an image
X - x coordinate
Y - y coordinate
Draws IMAGE at the (X|Y) coordinate on the map. The Position is affected by scrolling.

There are some built-in images which can be used. Just insert one of the following variables as IMAGE:
gfx_crater25
gfx_crater50
gfx_crater75
gfx_crater100
gfx_crater125
gfx_crater150
gfx_crater175
gfx_crater200
gfx_blood25
gfx_blood50
gfx_blood75
gfx_fire
gfx_flare1
gfx_flare2
gfx_flare3

drawinhand(IMAGE, [X OFFSET=0], [Y OFFSET=0], [SIZE=1.0])

Parameters:
IMAGE - ID of an image
[X OFFSET=0] - x offset value
[Y OFFSET=0] - y offset value
[SIZE=1.0] - size modification
Draws IMAGE in the hand of the current player.
The weapon is automatically rotated into the right direction. Moreover you can use the recoil command to easily create a recoil effect.
Use X OFFSET and Y OFFSET to change the position relative to the player position. Use SIZE to change the size of the image.
Moreover note that the weapon is always drawn with a vertical (Y) base offset of 3 pixels. This is important to know for spawning projectiles / drawing a crosshair.

drawline(X1, Y1, X2, Y2, [WIDTH=1])

Parameters:
X1 - start x coordinate
Y1 - start y coordinate
X2 - end x coordinate
Y2 - end y coordinate
[WIDTH=1] - line width/thickness
Draws a line from X1|Y1 to X2|Y2 with the given width (1 pixel by default).

This command is affected by setblend, setcolor and setalpha.

Attention: It is NOT affected by setscale and setrotation! It actually RESETS the scale factors to 1 and the rotation to 0!

drawrect(X, Y, WIDTH, HEIGHT)

Parameters:
X - x coordinate
Y - y coordinate
WIDTH - rectangle width
HEIGHT - rectangle height
Draws a rectangle at X|Y with the given WIDTH and HEIGHT.

This command is affected by setblend, setcolor, setalpha, setrotation and setscale.

outofscreenarrow(X, Y)

Parameters:
X - x coordinate
Y - y coordinate
Checks if the (X|Y) coordinate is outside of the screen (the currently displayed area). If this is the case it will draw an arrow at the border of the screen which will point at the (X|Y) coordinate.

setalpha(ALPHA)

Parameters:
ALPHA - 0.0 to 1.0 alpha value
Sets the alpha value. Affects drawimage, drawhud and drawline.
The alpha value defines the transparency.
1.0 = 100% visible
0.0 = 0% visible (=invisible)

setbgcolor(RED, GREEN, BLUE, [ALPHA=1.0], [FADE=0.1])

Parameters:
RED - red value (0 to 255)
GREEN - green value (0 to 255)
BLUE - blue value (0 to 255)
[ALPHA=1.0] - 0.0 to 1.0 alpha mixing value
[FADE=0.1] - 0.001 to 1.0 fade-out speed
Sets the color for the background. The color consists of red, green and blue values.
ALPHA defines how much these colors will be mixed with the original/default background color. It ranges from 0.0 to 1.0.

Examples:
0.0 = 100% original background color
0.5 = 50% original / 50% custom colors
1.0 = 100% custom colors

The command should be called every frame you want the background to have another color. Call it with ALPHA 0.0 or FADE 1.0 to instantly remove the custom background color.

If you don't call it anymore the background will fade back to the original color with the speed of FADE (ALPHA will be decremented by FADE each frame until it reaches zero).

setblend(BLENDMODE)

Parameters:
BLENDMODE - a blend mode you want to use
Changes the blend mode. Affects drawimage, drawhud and drawline.
Possible blendmodes are:
blend_mask - don't draw magenta pixels
blend_solid - draw complete image
blend_alpha - draw transparent
blend_light - draw bright
blend_shade - draw dark

setcolor(RED, GREEN, BLUE)

Parameters:
RED - red value (0 to 255)
GREEN - green value (0 to 255)
BLUE - blue value (0 to 255)
Set the color for an image. The color consists of red, green and blue values which are mixed. Affects drawimage, drawhud and drawline.
Use 255 for RED, GREEN and BLUE (=white) in order to draw images with their original color.

sethandle(IMAGE, X, Y)

Parameters:
IMAGE - ID of an image
X - x handle coordinate
Y - y handle coordinate
Sets the handle (origin for drawing) of IMAGE to the coordinate (X|Y).

Attention: It will lead to problems when you load the same image several times and set different handles for it right after loading. In this case you have to set the handles always before drawing in order to avoid problems.

setmidhandle(IMAGE)

Parameters:
IMAGE - ID of an image
Sets the handle (origin for drawing) of IMAGE to its center.

Attention: It will lead to problems when you load the same image several times and set different handles for it right after loading. In this case you have to set the handles always before drawing in order to avoid problems.

setrotation(ROTATION)

Parameters:
ROTATION - rotation angle (360 degrees)
Changes the rotation for images. Affects drawimage and drawhud.
ROTATION 0 draws images without rotation.

setscale(X SCALE, Y SCALE)

Parameters:
X SCALE - x scale factor
Y SCALE - y scale factor
Changes the scale factor for images. Affects drawimage and drawhud.
Use 1 for X SCALE and Y SCALE in order to draw images at their original size. Use negative values to mirror images.