Skip to content

Converting a map to use KeeperFX script commands

Loobinex edited this page Mar 5, 2024 · 9 revisions

Intro

Dungeon Keeper maps come with a level script that determine how the map will function. There are script commands define how much gold the player starts with, which units can come from the portal, when hero parties spawn and what the player does to win. The original script guide can be found here.

KeeperFX has seriously expanded the possibilities of mapmakers by adding new commands and changing old ones.
This page is for people who want to expand upon a script written for Dungeon Keeper to use KeeperFX functionality.

KeeperFX can run all old level scripts the way they ran in the original game. In fact, it does so by default. Only scripts that hold the script command LEVEL_VERSION(1) will be interpreted as KeeperFX specific scripts. So, the first step to convert a script to convert a script for KeeperFX commands, is to add LEVEL_VERSION(1) to the script file.

With this done, you are free to add new scripts as listed here.
However, you need to modify the script commands that work differently too:

DK1:

CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,1)
CREATURE_AVAILABLE(PLAYER0,ORC,1,1)
CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,1)

FX:

CREATURE_AVAILABLE(PLAYER0,BILE_DEMON,1,0)
CREATURE_AVAILABLE(PLAYER0,ORC,1,0)
CREATURE_AVAILABLE(PLAYER0,DEMONSPAWN,1,0)

In DK1 you needed 1,1 to set a creature available. In KeeperFX, it is only the first of those parameters that determine if the creature spawns or not. The second parameter determines how many of them can come ignoring room requirements, so leaving it at 1,1 for FX will allow you to get one of each unit type without building any of the rooms. Change it to 1,0

DK:

ALLY_PLAYERS(PLAYER1,PLAYER2)

FX:

ALLY_PLAYERS(PLAYER1,PLAYER2,1)

In DK1 you could only set an alliance, in KeeperFX you can set, break, lock and forbid an alliance so you need an extra parameter. Without the final 1 the command will not work.

DK:

RANDOM(4,10)

FX:

DRAWFROM(4~10)

In DK1 the RANDOM command would pick a value at the start of the map between the min and max value. This command name is reserved in KeeperFX for a command that would be truly random at activation. The DRAWFROM command can work the same, use a ~ to indicate a range.

DK:

SET_CREATURE_FEAR(BARBARIAN,20)

FX:

SET_CREATURE_CONFIGURATION(BARBARIAN,FearWounded,20)

There are multiple fear types in KeeperFX, so SET_CREATURE_FEAR, and since with KeeperFX any creature property can be modified, use the SET_CREATURE_CONFIGURATION script command instead. FearWounded is the variable name of what DK1 called 'Fear'.

DK:

IF(PLAYER0,TOTAL_IMPS < 4)
  MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
ENDIF

FX:

IF(PLAYER0,TOTAL_DIGGERS < 4)
  MAGIC_AVAILABLE(PLAYER0,POWER_IMP,1,1)
ENDIF

The variable TOTAL_IMPS has been replaced with TOTAL_DIGGERS, because for hero players it may count tunnels too. If you want to know specifically how many imps a player has, convert it to IMP.