QDT Sprite Scripting

Table of Contents


kpdata.exe

There a few examples of qdt scripting under Kingpin:

Kingpin\main\models\weapons\v_colt\test.qdt
Kingpin\main\models\weapons\v_colt\testmag.qdt
Kingpin\main\models\weapons\v_hmgt\test.qdt
Kingpin\main\models\weapons\v_hmgcool\test.qdt

Where you open v_colt\test.qdt with a notepad editor and see:

// Add SFX to gun
$sfx_load pistol

$sfx_define
101       // type (fire)
0        // flags
0        // VEL_TYPE_UP (will move upwards)
3        // vel_speed
0        // gravity
2        // spawn interval, 2 = 0.1 seconds
0.5        // random spawn interval (sprite will be spawned 80% of the time)
0.9       // start alpha
0.0        // end alpha
0.2       // fadein time
4.0       // lifetime
0.2        // random time scale (fadein and lifetime will be multiplied by (x * 0.5), where x is a random number between -1 and 1
4.25       // start width
4.25       // end width
4.25       // start height
4.25       // end height
0.5       // random size scale (same as random time scale, but effects onle sizes)

$sfx_add
2       // INDEX (assigned to the first vertex)
0        // uses the first sfx_define (above)
0       // tells the engine to use the above INDEX is a vertex index
8 - 8    // frame ranges to enable the effect for

$sfx_save pistol

Most of the stuff should mostly explainable, you can edit stuff and change effects of the pistol.

Get kpdata.exe from the Kingpin_SDK_121.zip.

Put kpdata in the folder of the qdt file you want to alter for in this example:
Kingpin\main\models\weapons\v_colt\

Run a batch or cmd prompt:

kpdata test.qdt

It should say now:

--------------------------

Succesfully loaded pistol.mdx

Added sfx define #0
Added sfx entry, using sfx_define #0

Succesfully saved pistol.mdx.

--------------------------

It applied the QDT script file to the pistol.mdx.

If you did not alter the qdt file you probably would not see any difference in game.

If you alter 101 (fire sprite) to the QDT Sprite List to a other number you will defenly see a effect.
That effect will applied at vertices 2 on the gun during frames 8-8 (one frame) as defined in this script.


Flags

Flags in q.shared.h:

// SFX flags

#define SFX_FLAG_GRAVITY 1 // velocity is effected by gravity
#define SFX_FLAG_SURFACE_EFFECT 2
// this is a surface effect, therefore velocity is the surface normal,
// and sprite will use alpha = 1 for "fadein_time"
#define SFX_FLAG_NO_FLIP 4
// this SFX won't have it's S coordinate randomly flipped
#define SFX_FLAG_LIGHTFLARE 8 // no depth checking, align with view
#define SFX_FLAG_DEPTHHACK 16
#define SFX_FLAG_UPRIGHT 32 // used for fire in barrel
#define SFX_FLAG_VEL_IS_ANGLES 64
#define SFX_FLAG_ADDITIVE_BLEND 128
#define SFX_FLAG_ALPHA_IS_FRAME 256
#define SFX_FLAG_VEL_IS_COLOR_MODULATION 512
#define SFX_FLAG_CLOSE_CULL 1024


Kingpin Model Skin Changer

With Kingpin Model Skin Changer you can easly change sprites of a mdx model.

Get Kingpin Model Skin Changer from here.

It also shows already if a model has a sprite.

You can load and save .qdt files for kpdata.exe

Settings: Info:
SFX type: 101 (fire sprite) is based on QDT Sprite List change the number and you will see what effect it will be with a images.
Flags: Press button button for more info or looks at flags in q.shared.h
Direction: Velocity direction.
Speed: Velocity speed.
Gravity: Use gravity for sprite
Time 0.1s: Spawn interval, 2 = 0.1 seconds
Spawn %: Random spawn interval (sprite will be spawned 80% of the time)
Start Alpha: The start of a sprite with how much alpha the sprite has.
End Alpha: The end of a sprite with how much alpha the sprite has.
Fade In: Fade in time.
Lifetime: How long will the sprite will be shown before it is gone.
Rand Scale: Random time scale (fadein and lifetime will be multiplied by (x * 0.5), where x is a random number between -1 and 1.
Start width: Start size of sprite in width.
End width: End size of sprite in width.
Start height: Start size of sprite in height.
End height: End size of sprite in height.
Rand W/H: Random size scale (same as random time scale, but effects only sizes)
Vert/Tri Index#: On what vertices do you want the sprite to be active. You can find a correct vertices with Kingpin Model Viewer under Model Info.
Define Index: Disabled used for multiple sprites.
Vert/Tri ?: Select vertices(vertex) or Triangle in Vert/Tri Index#
Show on frame/s (0-Based) Select the frames of the mdx model where you want the sprite active

Select the Add SFX button to make sure the sprite is added to the mdx model.


Map

With MDX sprites you don't always have to add them to a v_weapon, they also just work with other kind of mdx models. So long it's a mdx model

You can have single vertices(vertex) and add a sprite to it.

I have created a example map with all sprites and a single vertex

tutorial/modeling/sprites/spritetest_map.png

Get spritetest_map.zip from here.

You can also adjust the sprites with other settings see Kingpin Model Skin Changer

It just a good example map to see all the sprites and that you don't always need to code to have custom sprites to your map.


FREDZ | Monday 18 March 2019 - 00:23
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • email
  • Facebook
  • Google
  • PrintFriendly