env_sprite

From Sven Co-op
Jump to navigation Jump to search
env_sprite
Type

point

Status

supported

 


The env_sprite entity allows you to render sprites, which are common 2D-graphics which will appear aligned to face you at all times, unless specified otherwise.

1 Keyvalues

Sprite name : model

Set a sprite to be displayed. Path start in modification's folder.

Scale : scale

Set the scale of the sprite effect. This defaults to 0.25 if not set.

Framerate : framerate

Frames per second to be played. Obsolete for non-animating sprites.

Draw Type / Orientation : vp_type

Feature that allows to override view port of the sprite:

  • Parallel: Always face the player
  • Parallel Upright: Sprites rotates around vertical axis to always face player, but it's fixed to this axis
  • Parallel Orientated: Rotate sprite to env_sprite angles
  • Facing Upright: Not supported/unused
  • Orientated: Sprite is oriented to the worlds, uses it's angles and it's not rotating

2 Flags

1 : Start on

Causes the env_sprite effect to be visible from map-load onwards. Useful for when the env_sprite has a targetname. Makes little to no sense in combination with "Play Once".

2 : Play once

If set, the sprite animation won't loop and end after cycling through all of its frames once. If the sprite is not animated, only the first frame will show for a moment.

4 : Once + Remove

If set along with "Play once", causes the env_sprite entity to be removed from the game after having played. Useful for saving some entities.

3 Notes

  • To make sprite work properly use "Render Mode" with optional "FX Amount". Most sprites can make use of "Glow" or "Additive" render modes (most sprites are in 'additive' format), however sprites with 'alphatest' works best with "Texture" mode (background gets removed, image is opaque), while 'indexalpha' sprites are rendered properly only in "Solid" and "Texture", in any other mode they appearance is invalid. You can use third party tools like Sprite Explorer to check format of sprite if you are not sure, or check this Sprite List to check format type each sprite.
  • Sprite alignment can also be set through the sprite itself. To do this, edit byte at offset 8 (meaning the 9th byte) in the sprite file using a HEX editor:
    • 00: Sprite fixed on vertical axis. (SPR_VP_PARALLEL_UPRIGHT)
    • 01: Not supported. (SPR_FACING_UPRIGHT)
    • 02: Normal behaviour; sprite always faces you. (SPR_VP_PARALLEL)
    • 03: Sprite is fixed in space and can be rotated using angles. (SPR_ORIENTED)
    • 04: As SPR_VP_PARALLEL, but sprite can be rotated relatively to perspective using angles. (SPR_VP_PARALLEL_ORIENTED)
  • Oriented mode sprites tend to have problems with angle co-ordinates in hammer so its best to set them manually starting from [180,180,180] instead of [0,0,0]. In addition don't use negative numbers; instead subtract from 360. Also use 360 instead of 0 and carefully watch the use of hammer transforms as it will likely give you numbers that might look fine in hammer but will not work in-game. If you are still having troubles with angles not appearing in map I have an example RMF included in the example file download at the bottom (called "oriented_angles.rmf"). (Taken from the303.org)

4 Issues

There is no key as of yet to set the initial frame of the env_sprite for it to draw. This must be done manually by changing the env_sprite's frame key via trigger_changevalue/trigger_copyvalue.

5 Changes

  • 5.0 Steam Release: Added 'Draw Type / Orientation' keyvalue.