Developers Info

KQtB predominately uses the following languages C and Lua.

Combat
This Document will show you how to add a battle event to a map script.
Place the following in yourmapname.lua
combat(11)
The 11 is a references to the battles[] array in /src/res.c

s_encounter battles[NUM_BATTLES] = { // { Map, Zone, Enc, Etnum, Eidx, BMusic, BackImg }
{MAP_CAVE4, 255, 1, 16, 4, "walk.s3m", "BACK8_PCX"},

Take row number Eidx from section Etnum of erows[]. The section is indicated by the tnum field. Row 4 from section 16 is selected in this example. A row of 99 means it will randomly pick an encounter in that section.

s_erow erows[NUM_ETROWS] = { //{ tnum, lvl, per, {idx }}
{16, 11, 25, {35, 35, 35, 0, 0}},
{16, 11, 50, {36, 36, 0, 0, 0}},
{16, 12, 75, {37, 37, 0, 0, 0}},
{16, 12, 100, {38, 0, 0, 0, 0}},
{16, 0, 0, {39, 0, 0, 0, 0}},

So row 4 (zero-based) is the last one:
{16, 0, 0, {39, 0, 0, 0, 0}},
a combat(11) will have one enemy, 39 (Demnas in KQLives) You can have up to 5 enemies per battle.
An another example: combat(10)
{MAP_CAVE4, 0, 25, 16, 99, "hm.s3m", "BACK8_PCX"},
Zone 0 means any tile in cave4 that doesnt already have a zone specified. It will pick a random encounter from section 16. Due to the cumulative percentage, it will pick one of the first four rows with equal probability, and never pick the 5th row.
-Adapted from an email by Peter Hull of KQLives

Data Files
KQ has three types of data files that are found in /data

.kq (hero.kq, tileset.kq)

Hero initial stats and tileset information (which tiles are animated) can be edited by editing the corresponding text file in /other. Then they need to be packed. Rescmp first needs to be compiled.
gcc -o rescmp ../src/disk.c rescmp.c -I../include -lalleg-4.2.2 ./rescmp hero.txt

.dat (ssprites.dat, kqsnd.dat, mpcx.dat - The tilesets)

In /data use the allegro grabber to edit these data files.
grabber mpcx.dat

.mon (resabil.mon - monster's abilities, allstat.mon - monster's stats)

Edit these with any text editor. Allstat values can be found by reading /src/enemy.c

TODO List

    Create the rest of the maps. Krayiet – Poor town, Destroyed town, Castle.
    Finish scripting for the rest of the maps.
    More enemies and enemy pictures are needed. More graphics are needed for everything.
    Balancing issues – Hit Points, spells, monster difficulty, available items.
    When plot is finished add translations.

Leave a Reply