Skip to content

New and Modified Level Script Commands

Loobinex edited this page Oct 29, 2021 · 202 revisions

Introduction

KeeperFX has new and updated 'level script commands'. To use the new commands include the LEVEL_VERSION command in your script, or KeeperFX will interpret the level as a classic DK map.

This page can be treated as an addendum to the Dungeon Keeper Script Commands Reference.

KeeperFX Command list

ADD_GOLD_TO_PLAYER

Allows to add some off-map gold as a reward to a player. Example:

ADD_GOLD_TO_PLAYER(PLAYER0,5000)

ADD_TO_CAMPAIGN_FLAG

Adds a numeric value to the current campaign_flag value. Works exactly like the ADD_TO_FLAG command.

ADD_TO_CAMPAIGN_FLAG(​[player],​[flag],​[a])

ADD_TO_FLAG

Adds a numeric value to the current flag value.

ADD_TO_FLAG(​[player],​[flag],​[a])

where:

[player] - The player’s name, e.g. PLAYER1.

[flag] - The flag’s name to which you'll add the value, e.g. FLAG1

[a] - The amount added. This may be a positive or negative value, e.g. -1

Can be used to count the amount of loops, or give different weights to certain events. The values will always be positive and never get bigger than 255. Example:

REM Spawn troll 3 times.
IF(PLAYER0,FLAG2 <= 3)
    IF(PLAYER_GOOD,TIMER1 >= 100)
        NEXT_COMMAND_REUSABLE
        ADD_CREATURE_TO_LEVEL(PLAYER0,TROLL,PLAYER0,1,1,0)
        NEXT_COMMAND_REUSABLE
        ADD_TO_FLAG(PLAYER0,FLAG2,1)
        NEXT_COMMAND_REUSABLE
        SET_TIMER(PLAYER_GOOD,TIMER1)
    ENDIF
ENDIF
REM If player has a lair the troll spawns two more times.
IF(PLAYER0,LAIR >= 1)
    ADD_TO_FLAG(PLAYER0,FLAG2,-2)
ENDIF

ADD_TO_PARTY

This command adds a unit to a party, like it did in the original game. It comes with more objectives. The party leader - the unit with the highest level, or most power when equal - is the one which will follow an objective, the others will follow the leader.

ADD_TO_PARTY(​[party name],​[creature],​[experience],​[gold],​[objective],​[countdown])

These are the possible objectives:

objective description
ATTACK_DUNGEON_HEART Attack the nearest Dungeon Heart.
ATTACK_ENEMIES Attack any enemies.
ATTACK_ROOMS Attack the nearest rooms.
DEFEND_HEART Go to own heart and defend it until destroyed.
DEFEND_LOCATION Never do any objective.
DEFEND_PARTY Will not do any objective so will not assume party leadership.
DEFEND_ROOMS Defend nearest owned room, not counting portals, hearts or bridges.
STEAL_GOLD Steal gold from the Treasure Room until unit carries 1000 gold.
STEAL_SPELLS Go to Library and steal one spell book.

ALLY_PLAYERS

Marks two players as allied, or ends the alliance. The difference to original DK is that this command takes 3 parameters - 2 are players, and third one is 1 if the alliance is being created, and 0 if it is being broken. Note that computer players will not break the alliance by themselves, but human player may do so. So this command is mostly for controlling the computer players behavior. Example:

ALLY_PLAYERS(PLAYER1,PLAYER2,1)

Note: if you enable KeeperFX commands with LEVEL_VERSION, old ALLY_PLAYERS commands (without the extra parameter) will no longer work. Add a '1' to fix this.

BONUS_LEVEL_TIME

Sets time to be displayed on "bonus timer" - on-screen time field, used mostly for bonus levels. Like in original DK, this command accepts one parameter

  • number of game turns to start the countdown from. But now this command can be used to show bonus timer in any level. Setting game turns to 0 will hide the timer. Example:
BONUS_LEVEL_TIME(12000)

CHANGE_CREATURE_OWNER

Changes the owner of given creature based on given criterion.

  CHANGE_CREATURE_OWNER(​[player_from],​[creature],​[criterion],​[player_to])

where:

[player_from] - The player who owns creatures to be affected.

[creature] - Creature model to be searched.

[criterion] - Creature selection criterion. Same criteria as for KILL_CREATURE command.

[player_to] - The player who will receive the creature.

Example:

REM If the player has too many heroes in his army, the barbarians will escape when possible.
IF_CONTROLS(PLAYER0,GOOD_CREATURES >= 20)
	NEXT_COMMAND_REUSABLE
	CHANGE_CREATURE_OWNER(PLAYER0,BARBARIAN,ON_ENEMY_GROUND,PLAYER_GOOD)
ENDIF

CHANGE_SLAB_OWNER

Changes the owner of a slab on the map to specified player. If it's part of a room, the entire room changes owner. Will change PATH to PRETTY_PATH.

  CHANGE_SLAB_OWNER(​[slab x pos],​[slab y pos],​[player]])

where:

[slab x pos][slab y pos] - The x and y coordinates of the slab. Range 0-85.

[player] - The player’s name, e.g. PLAYER1, of the new owner of the slab/room

Example:

REM If the player has stolen his allies room, just give it back.
IF_SLAB_OWNER(30,65,PLAYER0)
	NEXT_COMMAND_REUSABLE
	CHANGE_SLAB_OWNER(30,65,PLAYER1)
ENDIF

CHANGE_SLAB_TYPE

Changes a slab on the map to the specified new one. It will not change an entire room, just a single slab.

  CHANGE_SLAB_TYPE(​[slab x pos],​[slab y pos],​[slab]])

where:

[slab x pos][slab y pos] - The x and y coordinates of the slab. Range 0-85.

[slab] - The name of the new slab. Take if from fxdata\terrain.cfg.

Example:

REM Break open the unbreakable wall when the player reaches the first objective.
IF_ACTION_POINT(1,PLAYER0)
	CHANGE_SLAB_TYPE(13,44,PRETTY_PATH)
ENDIF

CREATURE_AVAILABLE

Tells the game whether a creature of specific kind can come through that player's Portal. Parameters of this command are changed to original, an now look like this:

  CREATURE_AVAILABLE(​[player],​[creature],​[can be attracted],​[amount forced])

where:

[can be attracted] - If set to 1, it is possible to attract the creature, either by rooms or by forced attraction. (so it works like 4th parameter in original command).

[amount forced] - Amount of creatures of that kind which can be force-attracted (attracted even if player doesn't have rooms required by that creature). Originally there was no possibility to skip attraction conditions.

DISPLAY_COUNTDOWN

Displays on screen how long a specific script timer reaches the target turn.

  DISPLAY_COUNTDOWN([player], [timer], [target], [clocktime]*)

Where:

[player] - The player’s name, e.g. PLAYER1.

[timer] - The timer’s name. Each player has their own set of eight timers to choose from.

[target] - Show the difference between the current timer value, and the target timer value.

[clocktime] - Set to 1 to display the countdown in hours/minutes/seconds. Set to 0 or don't add the param to display turns.

DISPLAY_INFORMATION

Displays one of the text messages from language-specific strings banks in an Information Box. Each Information Box stacks over previous messages, and can be removed by right clicking. It disappears automatically some time after has been read.

  DISPLAY_INFORMATION(​[a],​[location])

where:

[a] - The number of the message, assigned to it in .po or .pot translation file.

[location] - Location where the view should be centered if the player clicks on the "zoom to" icon on the Message Panel. It can now have the following values:

  • PLAYERx - zoom to player's dungeon heart
  • positive integer - zoom to Action Point of given number
  • negative integer - zoom to Hero Gate of given number
  • ALL_PLAYERS - zoom button will be inactive

DISPLAY_OBJECTIVE

Displays one of the text messages from language-specific strings banks in an Objective Box. Each Objective Box replaces previous one, and cannot be removed from the messages list. It removes itself only after level is won or lost.

  DISPLAY_OBJECTIVE(​[a],​[location])

where:

[a] - The number of the message, assigned to it in .po or .pot translation file.

[location] - Location where the view should be centered if the player clicks on the "zoom to" icon on the Message Panel. It can have the same values as in DISPLAY_INFORMATION command above.

DISPLAY_TIMER

Displays a script timer on screen.

  DISPLAY_TIMER([player], [timer], [clocktime*])

Where:

[player] - The player’s name, e.g. PLAYER1.

[timer] - The timer’s name. Each player has their own set of eight timers you can trigger

[clocktime] - Set to 1 to display the countdown in hours/minutes/seconds. Set to 0 or don't add the param to display turns.

DISPLAY_VARIABLE

Displays a script variable on screen.

  DISPLAY_VARIABLE([player], [variable], [target*], [target_type*])

Where:

[player] - The player’s name, e.g. PLAYER1.

[variable] - The variable that is to be exported, e.g. SKELETONS_RAISED

[target] - If set, it would show the difference between the current amount, and the target amount.

[target_type*] - Can be set to 0, 1 or 2. Set to 0 it displays how much more you need to reach the target, 1 displays how many you need to lose to reach the target, 2 is like 0 but shows negative values too.

DRAWFROM

Is not a command itself but may replace a parameter of most other commands. Replaces the old RANDOM() command.

   DRAWFROM(a,b,c,d,e,f,g,h)

It draws at random one value or number from up to eight parameters. Examples:

    REM Human player will have random start gold between 10000 and 15000
    START_MONEY(PLAYER0,DRAWFROM(10000,11000,12000,13000,14000,15000))
	
    REM One bug type creature will be added to pool
    ADD_CREATURE_TO_POOL(DRAWFROM(FLY,BUG,SPIDER),5)
	
    REM Add one of three predefined Hero parties to Hero gate 6 or 9
    ADD_PARTY_TO_LEVEL(PLAYER0,DRAWFROM(thugs,fiends,dudes),DRAWFROM(-6,-9),1)

It is also possible to draw a value from a range of numbers using a tilde(~). Example:

    REM Spawn a BUG at a random time at the start or near the end of the level
    IF(PLAYER0,TIMER1 >= DRAWFROM(0~12000,72000~108000))
        ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,BUG,-1,1,1,500)
    ENDIF

Ranges can be combined with values. The '~' is a separate parameter. Example:

   DRAWFROM(1~4,6,8~11,13)

A range cannot be used for hero gates, action points or any non-consecutive values.

The command shouldn't be used in multiplayer maps, as it will lead to synchronization problems. Value represented by DRAWFROM is selected at start of a map, and never changes during the gameplay.

EXPORT_VARIABLE

Exports a variable to a campaign flag to use in a future campaign level. To be used together with the IMPORT command.

EXPORT_VARIABLE(​[player],​[variable],​[flag])

where:

[player] - The player’s name, e.g. PLAYER1. Linked to both the variable and campaign flag.

[variable] - The variable that is to be exported, e.g. BATTLES_WON

[flag] - The flag’s name to which you'll export the variable. Must be a campaign flag, e.g. CAMPAIGN_FLAG1.

Example:

REM Save annoyed creatures of player1 to player1,campaign_flag1 for next level.
NEXT_COMMAND_REUSABLE
EXPORT_VARIABLE(PLAYER1,CREATURES_ANNOYED,CAMPAIGN_FLAG1)

REM Bring over how much gold player 2 has for next level
IF(PLAYER0,ALL_DUNGEONS_DESTROYED == 1)
	EXPORT_VARIABLE(PLAYER2,MONEY,CAMPAIGN_FLAG7)
	WIN_GAME
ENDIF

IF

This is used to test the differences between two values ([name] and [a]). If those two values agree with the comparison, the script will continue. If the two values do not agree with the comparison, the script will find the next ENDIF and continue from there. New option values have been added to this command, and some original options were changed:

  IF(​[player],​[name]​[comparison]​[a])

where:

[name] - The name of a variable, timer, flag (all types), creature, room, trap or door.

  • Checking variable returns its value at the moment. Variables are:
name description
MONEY The amount of money the player has
GAME_TURN The current game turn (player independent)
HEART_HEALTH The amount of health the dungeon heart of the player has
TOTAL_DIGGERS The number of special diggers (Imps) that player has got
TOTAL_CREATURES The number of creatures that player has got
EVIL_CREATURES The number of evil creatures that player has got
GOOD_CREATURES The number of heroes that player has got
TOTAL_RESEARCH The amount of research points that player has got (see manipulating research section for more information)
TOTAL_DOORS The amount of doors that player has got
TOTAL_DOORS_MANUFACTURED The amount of doors the player created in the workshop
TOTAL_DOORS_USED The amount of doors the player placed on the map
TOTAL_TRAPS_MANUFACTURED The amount of traps the player created in the workshop
TOTAL_TRAPS_USED The amount of traps the player placed on the map
TOTAL_MANUFACTURED The amount of traps and doors the player created in the workshop
TOTAL_AREA The amount of tiles that player owns
TOTAL_CREATURES_LEFT The amount of creatures that have left that player's dungeon because they were annoyed
TOTAL_SALARY The amount of salary the player has payed up to this point
CURRENT_SALARY The current estimated amount of the players next payday
CREATURES_ANNOYED The number of creatures annoyed in that player's dungeon
TIMES_ANNOYED_CREATURE The number of times player did something a creature disliked
TIMES_TORTURED_CREATURE The number of times player placed any creature in torture room
TIMES_LEVELUP_CREATURE The number of times a creature gained a level in the training room
BATTLES_WON The number of battles won by that player
BATTLES_LOST The number of battles lost by that player
ROOMS_DESTROYED The number of rooms belonging to the player which were sold or destroyed
SPELLS_STOLEN The number of spells stolen from that player
TIMES_BROKEN_INTO The number of times that players walls have been breached
DUNGEON_DESTROYED Whether that players Dungeon Heart has been destroyed (0 if still active, 1 if destroyed)
CREATURES_SCAVENGED_LOST Number of creatures lost by that player due to scavenging
CREATURES_SCAVENGED_GAINED Number of creatures gained by that player through scavenging
CREATURES_SACRIFICED Number of creatures sacrificed in the temple
CREATURES_FROM_SACRIFICE Number of creatures gained by the player through the temple
CREATURES_CONVERTED Number of creatures gained by the player through converting in the torture room
ALL_DUNGEONS_DESTROYED Whether all the players Dungeon Hearts has been destroyed (0 if still active, 1 if destroyed) (player independent)
KEEPERS_DESTROYED The amount of dungeon hearts destroyed by this player
DOORS_DESTROYED The number of doors belonging to the player which were sold or destroyed
TOTAL_GOLD_MINED Total amount of gold mined by the player
GOLD_POTS_STOLEN Number of gold pots that were stolen from the player
BREAK_IN Amount of break-ins
GHOSTS_RAISED Number of Ghosts created in torture room
SKELETONS_RAISED Number of Skeletons created in prison
VAMPIRES_RAISED Number of Skeletons created in graveyard
  • Checking creature returns how many creatures of that kind a player owns. It doesn't matter if the player can controls them, or they're in custody.
  • Checking room returns how many slabs of that room the player owns.
  • Checking trap or door availability returns amount of deployed traps and doors owned by that player.
  • Checking TIMERx, FLAGx or CAMPAIGN_FLAGx returns its current value.

[player] - The player’s name, e.g. PLAYER1. If ALL_PLAYERS is used, then the condition has to be met for all of the players in order for the commands inside to be executed.

IF_AVAILABLE

Checks availability of an item for the player. New option values have been added to this command:

  IF_AVAILABLE(​[player],​[name]​[comparison]​[a])

where:

[name] - The name of a creature, room, spell, trap or door.

  • Checking creature availability returns how many creatures of that kind can come from portal to that player. The check includes creature pool, players creature limit and whether attraction criteria are met.
  • Checking room availability returns whether the room can be built by a player. Cost of the room is not considered.
  • Checking spell availability returns whether the spell can be cast by a player. Cost of the spell is not considered.
  • Checking trap or door availability returns amount of traps and doors a player has stored, either in workshop or in off-map storage.

IF_CONTROLS

Allows to execute commands based on the items a player controls.

  IF_CONTROLS(​[player],​[name]​[comparison]​[a])

where:

[name] - The name of a creature. Returns how many creatures of given kind the player owns, excluding these under enemy control (in custody). Also accepts TOTAL_CREATURES, TOTAL_DIGGERS, EVIL_CREATURES and GOOD_CREATURES.

IF_SLAB_OWNER

Checks if a specific slab on the map belongs to specified player.

  IF_SLAB_OWNER(​[slab x pos],​[slab y pos],​[player]])

where:

[slab x pos][slab y pos] - The x and y coordinates of the slab. Range 0-85.

[player] - The player’s name, e.g. PLAYER1, to check against.

IF_SLAB_TYPE

Checks if a specific slab is of a specific type.

  IF_SLAB_TYPE(​[slab x pos],​[slab y pos],​[slab]])

where:

[slab x pos][slab y pos] - The x and y coordinates of the slab. Range 0-85.

[slab] - The name of the slab to check for. Take if from fxdata\terrain.cfg.

IMPORT

Like DRAWFROM, it is not a command itself but may replace a parameter of most other commands. At the start of the level it is replaced by the value of the specified campaign flag.

IMPORT(​[player],​​[flag])

where:

[player] - The player’s name, e.g. PLAYER0.

[flag] - The flag’s name to which you'll export the variable. Must be a campaign flag, e.g. CAMPAIGN_FLAG1.

Example:

REM Give player 2 the gold he ended with on the previous level
ADD_GOLD_TO_PLAYER(PLAYER2,IMPORT(PLAYER2,CAMPAIGN_FLAG7))

REM Player0 gets no more creatures as he managed to annoy from player1 last level.
MAX_CREATURES(PLAYER0,IMPORT(PLAYER1,CAMPAIGN_FLAG1))

KILL_CREATURE

Kills given amount of creatures based on given criterion.

  KILL_CREATURE(​[player],​[creature],​[criterion],​[count])

where:

[player] - The player who owns creatures to be affected.

[creature] - Creature model to be searched.

[criterion] - Creature selection criterion.

criterion description
MOST_EXPERIENCED Highest level creature
MOST_EXP_WANDERING Highest level idle creature
MOST_EXP_WORKING Highest level working creature
MOST_EXP_FIGHTING Highest level creature in combat
LEAST_EXPERIENCED Lowest level creature
LEAST_EXP_WANDERING Lowest level idle creature
LEAST_EXP_WORKING Lowest level working creature
LEAST_EXP_FIGHTING Lowest level creature in combat
NEAR_OWN_HEART Creature close to friendly dungeon heart
NEAR_ENEMY_HEART Creature close to enemy dungeon heart
ON_ENEMY_GROUND Creature on enemy tile
ON_FRIENDLY_GROUND Creature on friendly tile
ANYWHERE Creature anywhere on the level

[count] - Amount of creatures affected.

LEVEL_UP_CREATURE

Levels up given creature based on given criterion.

  LEVEL_UP_CREATURE(​[player],​[creature],​[criterion],​[levels])

where:

[player] - The player who owns creatures to be affected.

[creature] - Creature model to be searched.

[criterion] - Creature selection criterion. Same criteria as for KILL_CREATURE command.

[levels] - Number of times the unit levels up.

Example:

REM The Lord that remain inside hero dungeon will level up every 3 minutes
IF(PLAYER_GOOD,TIMER1 >= 3600)
	NEXT_COMMAND_REUSABLE
	LEVEL_UP_CREATURE(PLAYER_GOOD,KNIGHT,ON_FRIENDLY_GROUND,1)
	NEXT_COMMAND_REUSABLE
	SET_TIMER(PLAYER_GOOD,TIMER1)
ENDIF

LEVEL_VERSION

Lets the game know if the level was designed specially for KeeperFX. To use new script commands, you must start the script with LEVEL_VERSION(1). Without it, the new commands will not work properly, and the game will try to emulate old behavior of commands which were modified.

PLAY_MESSAGE

Allows to play any SOUND or SPEECH from the game. Messages can be found here. To hear which sounds are available use the DKSound utility from the DKtools pack. Example:

PLAY_MESSAGE(PLAYER0,SPEECH,107)

Players

The name PLAYER_NEUTRAL is added as a new possible player name, but it works only on some specific commands. Use it to place units or modify slabs. As Neutral players have no dungeon, you cannot query information relating to the neutral dungeon structure, for example how many neutral units there are.

Player Command Colour
Player 1 (single player) PLAYER0 red
Player 2 (enemy) PLAYER1 blue
Player 3 (enemy) PLAYER2 green
Player 4 (enemy) PLAYER3 yellow
Hero Dungeon PLAYER_GOOD white
Neutral PLAYER_NEUTRAL no colour/​multicoloured
All Players ALL_PLAYERS

QUICK_INFORMATION

Works like DISPLAY_INFORMATION, but instead of using a string from translations, allows to type it directly.

  QUICK_INFORMATION(​[a],​["message"],[location])

where:

[a] - Message slot selection. There are 50 quick message slots, and each message you're making should use a different one. Using one message slot twice will lead to the first message being lost.

["message"] - The message string to be shown in a box. Message length may be up to 1024 characters.

[location] - Location where the view should be centered if the player clicks on the "zoom to" icon on the Message Panel. It can have the same values as in DISPLAY_INFORMATION command.

QUICK_OBJECTIVE

Works like DISPLAY_OBJECTIVE, but instead of using a string from translations, allows to type it directly.

  QUICK_OBJECTIVE(​[a],​["message"],[location])

Parameters have the same meaning as in QUICK_INFORMATION command.

QUICK_INFORMATION_WITH_POS, QUICK_OBJECTIVE_WITH_POS

Accepts additional XY coordinates of the zoom place.

RANDOM

The RANDOM() function of original DK has been replaced by DRAWFROM. This command is currently unimplemented - use DRAWFROM instead.

It is meant to be a function used in same way as DRAWFROM, but selecting value each time during gameplay instead of doing it once at start of the level.

RESEARCH

Changes amount of research points needed to discover an item in library. It doesn't affect research order, only amount of points. If the item never was in research list, it's added at end. Example:

    RESEARCH(PLAYER1,MAGIC,POWER_CHICKEN,10000)

RESEARCH_ORDER

When this command is first called, the research list for specified players is cleared. Using it you may create a research list from beginning. Note that if you won't place an item on the list, it will not be possible to research it. So if you're using this command, you must add all items available on the level to the research list. Example:

   RESEARCH_ORDER(ALL_PLAYERS,ROOM,SCAVENGER,50000)
   [...] - more RESEARCH_ORDER commands should follow.

REVEAL_MAP_LOCATION

Reveals square area of subtiles around given location. Location meaning is identical to the one in DISPLAY_OBJECTIVE. For example, to reveal Hero Gate no.1:

  REVEAL_MAP_LOCATION(PLAYER0,-1,11)

REVEAL_MAP_RECT

Reveals rectangular map area for given player.

  REVEAL_MAP_RECT(​[player],[x],​[y],[width],[height])

where:

[player] - The player’s name, e.g. PLAYER1.

[x,y] - Coordinates of area center point. In subtiles (range is 1..254).

[width] - The width of the area in subtiles

[height] - The height of the area in subtiles

RUN_AFTER_VICTORY

Lets the game know the script should continue to run after the game is won. Normally everything stops as soon as the a player wins the map, but include RUN_AFTER_VICTORY(1) in the script to have the game continue normally until the player presses the space bar. Useful if you want to give a player the chance to complete an optional objective you want to bring over to a next campaign level with SET_CAMPAIGN_FLAG or EXPORT_VARIABLE.

SET_CAMPAIGN_FLAG

Assign a numeric value to a campaign-wide persistent variable. Works like the SET_FLAG command, but the values set can be accessed throughout the campaign.

SET_CAMPAIGN_FLAG(​[player],​[flag],​[a])

Where:

[player] - The player’s name, e.g. PLAYER1.

[flag] - The flag’s name. There are eight flag names which can be used for multiple players:

Flag name
CAMPAIGN_FLAG0
CAMPAIGN_FLAG1
CAMPAIGN_FLAG2
CAMPAIGN_FLAG3
CAMPAIGN_FLAG4
CAMPAIGN_FLAG5
CAMPAIGN_FLAG6
CAMPAIGN_FLAG7

[a] - The number assigned to the flag. This can be between -2,147,483,648 and 2,147,483,647.

Use it to store information from one level and give this consequences in another level of the campaign. Example:

REM See if the player has defeated the lord of the land of level 1
IF_CONTROL(PLAYER_GOOD,KNIGHT >= 1)
	SET_CAMPAIGN_FLAG(PLAYER_GOOD,CAMPAIGN_FLAG1,1)
ENDIF
REM Spawn a knight if the player did not defeat the knight on the last level.
IF(PLAYER_GOOD,CAMPAIGN_FLAG1 >= 1)
	ADD_CREATURE_TO_LEVEL(PLAYER_GOOD,KNIGHT,-1,1,10,0)
ENDIF

SET_COMPUTER_EVENT

SET_COMPUTER_EVENT(​[player],​["event name"],​[value3],​[param1],​[param2]​,[param3],​[param4])

Where:
[player] - The computer player’s name, e.g. PLAYER1.

["event name"] - Text name of the event which is being altered. See fxdata\keepcompp.cfg

[value3] - Updates the third number listed at Values. (test_interval)

[param#] - Updates the four numbers listed at Params. The first 3 have different meanings for different event types, the 4th one is the gameturn the event has last been used.

Use it to tweak computer player behavior on a per map basis. Example:

REM Blue should not add new rooms when at max capacity beyond 36 tiles
SET_COMPUTER_EVENT(PLAYER1,"EVENT CHECK ROOMS FULL",400,0,0,36,0)

Note that without level_version(1) only Param1 and Param2 can be set.

SET_CREATURE_FEAR_STRONGER

Allows to define how many times stronger the enemy has to be for our creature to escape from combat. The value is in %. Example:

    REM Make Avatar fear any other creature which is twice as strong as him
    SET_CREATURE_FEAR_STRONGER(AVATAR,200)

SET_CREATURE_FEAR_WOUNDED

Replacements for SET_CREATURE_FEAR. The value taken by this function is a percentage (0..100) and defines health drop required for the creature to escape from combat. A special value of 101 makes creature avoid any combat other than with one creature of the same kind. Example:

    REM Make Imp escape combat only when his health drops below half
    SET_CREATURE_FEAR_WOUNDED(IMP,50)

SET_CREATURE_FEARSOME_FACTOR

Modifies this value from the creature config for a creature type. It determines how much more or less intimidating a unit is compared to what you would expect from looking at his Strength and Health values. Creatures with lots of spells tend to have a value above 100. Use this command when you've modified a unit type in the level script and need a fear response to match.

SET_CREATURE_FEARSOME_FACTOR([creature],[FearsomeFactor])

Where:
[creature] - The creature name, e.g. BILE_DEMON.

[FearsomeFactor] - The name of the creature property you want to set, e.g. NEVER_CHICKENS. See imp.cfg for options.

SET_CREATURE_PROPERTY

SET_CREATURE_PROPERTY([creature][property][enable])

Where:
[creature] - The creature name, e.g. BILE_DEMON.

[property] - The name of the creature property you want to set, e.g. NEVER_CHICKENS. See imp.cfg for options.

[enable] - Set this to 1 to enable the property, or 0 to disable to property.

Example:

REM Make sure ghosts don't like farts and imps cannot be brought to the graveyard
SET_CREATURE_PROPERTY(IMP,NO_CORPSE_ROTTING,1)
SET_CREATURE_PROPERTY(GHOST,IMMUNE_TO_GAS,0_

SET_CREATURE_TENDENCIES

Allows to set tendencies: IMPRISON and FLEE, for a player's creatures. Example:

SET_CREATURE_TENDENCIES(PLAYER2,FLEE,1)

Note that a player must have prison when IMPRISON command is triggered; otherwise, it won't make any change.

SET_DOOR_CONFIGURATION

Allows you to make changes to door values set in trapdoor.cfg

SET_DOOR_CONFIGURATION([doorname],[val1],[val2],[val3],[val4])

Where:
[doorname] - The name of the door as defined in trapdoor.cfg

[val1] - ManufactureLevel

[val2] - ManufacturePoints

[val3] - SellingValue

[val4] - Health

Use it to tweak doors on a per map basis. Example:

REM On this level, magic doors are cheaper and faster to build
SET_DOOR_CONFIGURATION(MAGIC,2,25000,1000,800)

SET_GAME_RULE

Allows you to make changes to door values set in rules.cfg. You can make them conditional with IF statements.

SET_GAME_RULE([rulename],[val1])

Where:
[rulename] - The name of the variable you want to change.

[val1] - The value you want to give it.

  • Not all rules are configurable. Only these are:
rulename description
BodiesForVampire Number of bodies the graveyard needs to create a vampire
PrisonSkeletonChance The chance that a dying humanoid in prison creates a skeleton
GhostConvertChance The chance that a creature dying from torture creates a ghost
TortureDeathChance The chance a victim broken from torture dies
TortureConvertChance The chance that a victim that survives being broken, is converted
FoodGenerationSpeed The speed at which the hatchery produces chickens
StunEvilEnemyChance The chance to stun a hero when imprisonment is on
StunGoodEnemyChance The chance to stun a creature when imprisonment is on
BodyRemainsFor Time before a body disappears and cannot be used for vampires anymore
FightHateKillValue How much an enemy will hate you for killing a unit. Negative values for love
DungeonHeartHealHealth How much health dungeon hearts will heal (or lose) per 8 game turns
PreserveClassicBugs Re-enable bugs long fixed in KeeperFX. Useful for old maps
ImpWorkExperience Sets experience gain for doing worker tasks
GemEffectiveness Sets the percentage speed of mining gems instead of gold
RoomSellGoldBackPercent The percentage of the room price you get back when you sell it
PayDayGap Game turns between pay days, normally this is 10000 turns, so 500 seconds
PayDaySpeed The normal speed is 100%, set it to 200 to get twice as much time between pay days
PayDayProgress Sets how far along you are to payday
DoorSellValuePercent The percentage of gold the player gets for selling doors
TrapSellValuePercent The percentage of gold the player gets for selling traps
  • To set PreserveClassicBugs, add up the numbers of the bugs you want to enable
number bug
1 ResurrectForever
2 Overflow8bitVal
4 ClaimRoomAllThings
8 ResurrectRemoved
16 NoHandPurgeOnDefeat
32 MustObeyKeepsNotDoJobs
64 BreakNeutralWalls
128 AlwaysTunnelToRed
256 FullyHappyWithGold
512 FaintedImmuneToBoulder
1024 RebirthKeepsSpells
2048 StunFriendlyUnits

SET_TRAP_CONFIGURATION

Allows you to make changes to trap values set in trapdoor.cfg. Look in that file for explanations on the numbers.

SET_TRAP_CONFIGURATION([trapname],[val1],[val2],[val3],[val4],[val5],[val6],[val7])

Where:
[trapname] - The name of the trap as defined in trapdoor.cfg

[val1] - Shots: The number of times the trap can trigger before running out.

[val2] - TimeBetweenShots: Recharge time.

[val3] - Model: What the trap will look like.

[val4] - TriggerType: How to set off the trap.

[val5] - ActivationType: What the activated trap will do when activated.

[val6] - EffectType: The effect of the above activation.

[val7] - Hidden: Set to '1' will make the trap invisible until triggered.

Use it to tweak traps on a per map basis. Example:

REM On this level, alarm traps are replaced by exploding barrels
SET_TRAP_CONFIGURATION(ALARM,1,0,931,2,5,2,0)
REM And gas traps will hurt you from a distance.
SET_TRAP_CONFIGURATION(POISON_GAS,5,200,845,3,5,5,1)

Unreleased

The script commands below are possible in the latest code, but have not been included in the latest full release. Wait for the next full version, compile your own version of the game, or download a prototype/alpha build of the next version.

ADD_BONUS_TIME

Add or remove turns to the Bonus Level timer. Allows negative values.

ADD_BONUS_TIME([turns])

ADD_HEART_HEALTH

Restores or drains health from a players Dungeon Heart.

ADD_HEART_HEALTH([player],[health],[warning])

Where:

[player] - The player’s name, e.g. PLAYER1.

[health] - The hitpoints to restore. Use negative values to take away health. Full heart is 30000 hitpoints.

[warning] - Set to 1 to give a 'heart is under attack' warning when removing hitpoints. Keep it at 0 to do not. You want 0 when you use it against computer players.

ADD_OBJECT_TO_LEVEL

Place any object at a specific place on the map

ADD_OBJECT_TO_LEVEL[object],[location],[property])

Where:

[object] - The object name from fxdata\objects.cfg

[location] - The location you want the object to spawn. Works like other commands and accepts action points, hero gates and players.

[property] - If the objects has properties, set it. For Gold, it's the amount. If you use SPECBOX_CUSTOM to place the mystery box, it's the box number in the BOX#_ACTIVATED variable.

ADD_TO_CAMPAIGN_FLAG

Script remains active but is to be considered deprecated. Function has been completely absorbed by ADD_TO_FLAG command which now accepts all Flag types, including campaign flags.

ADD_TO_FLAG

Adds a numeric value to the current flag value.

ADD_TO_FLAG(​[player],​[flag],​[a])

Where:

[player] - The player’s name, e.g. PLAYER1.

[flag] - The flag’s name to which you'll add the value, e.g. FLAG1, CAMPAIGN_FLAG2, BOX0_ACTIVATED

[a] - The amount added. This may be a positive or negative value, e.g. -1

ADD_TO_PARTY

Can now be used within an IF-statement, to only add units to a party if a specific condition is met.

ADD_TO_TIMER

Add or remove turns to the Script timer. Allows negative values.

ADD_TO_TIMER([player],[timer],[turns])

CHANGE_CREATURES_ANNOYANCE

Can set, increase or decrease the happiness level of all your units.

CHANGE_CREATURES_ANNOYANCE([player],[creature],[operation],[annoyance])

Where:

[player] - The player’s name, e.g. PLAYER1.

[creature] - The creature name, e.g. BILE_DEMON. Includes ANY_CREATURE.

[operation] - Can be SET, INCREASE, DECREASE, MULTIPLY. SET replaces original value, the other three modify it.

[annoyance] - The value to set/increase/decrease. Check the unit configs (like imp.cfg and horny.cfg) to see useful values.

Example:

REM
IF(PLAYER0,SACRIFICED[VAMPIRE] >= 1)
  CHANGE_CREATURES_ANNOYANCE(PLAYER0,VAMPIRE,INCREASE,1000)
  CHANGE_CREATURES_ANNOYANCE(PLAYER0,SORCEROR,SET,0)
ENDIF

BONUS_LEVEL_TIME

Sets time to be displayed on "bonus timer" - on-screen time field, used mostly for bonus levels.

BONUS_LEVEL_TIME([turns],[clocktime*])

Where:

[turns] - The amount of game turns the timer will count down from. That's 20 per second.

[clocktime] - Set to 1 to display the countdown in hours/minutes/seconds. Set to 0 or don't add the param to display turns.

Unlike in original DK, this command can be used to show bonus timer in any level. Setting game turns to 0 will hide the timer. Example:

BONUS_LEVEL_TIME(12000)

COMPUTE_FLAG

Modifies flag's value based on variables or other flags and values.

COMPUTE_FLAG([player],[flag],[operation],[src_player],[src_flag],[alt])

where:

[player] - The player’s name, e.g. PLAYER1.

[flag] - The flag’s name to which you'll set the value.

[operation] - Can be SET, INCREASE, DECREASE, MULTIPLY. SET replaces original value, the other three modify it.

[src_player] - The arg/source player’s name, e.g. PLAYER1.

[src_flag] - Source flag which will be set/added/etc to [flag]

[alt] - If set to 1, creature flags will be interpreted as in IF_CONTROLS and rooms/doors/traps as in IF_AVAILABLE. Set it to 0 and it takes the value as IF uses it.

Example:

   REM PLAYER0 gets a skeleton for every bile demon he has
   COMPUTE_FLAG(PLAYER0,FLAG1,SET,PLAYER0,BILE_DEMON,0)
   IF(PLAYER0,FLAG1 > 1)
	NEXT_COMMAND_REUSABLE
	ADD_CREATURE_TO_LEVEL(PLAYER0,SKELETON,PLAYER0,1,1,0)
	NEXT_COMMAND_REUSABLE
	ADD_TO_FLAG(PLAYER0,FLAG1,-1)
   ENDIF

COMPUTER_DIG_TO_LOCATION

Makes a computer player dig somewhere.

COMPUTER_DIG_TO_LOCATION([player],[origin],[destination])

Where:

[player] - The player’s name, e.g. PLAYER1.

[origin] - The origin location, e.g. PLAYER1 or 1 to go from an action point.

[destination] - The location to dig to, e.g. PLAYER0.

CONCEAL_MAP_RECT

Conceals part of the map with fog of war, opposite to REVEAL_MAP_RECT

CONCEAL_MAP_RECT([Player], [x,y], [Width], [Height], [hide revealed*])

where: [player] - The player’s name, e.g. PLAYER1.

[x,y] - Coordinates of area center point. In subtiles (range is 1..254).

[width] - The width of the area in subtiles

[height] - The height of the area in subtiles

[hide revealed] is optional, but set to 1 or ALL also hides rocks, gems and gold

CREATE_EFFECTS_LINE

Spawns an effect multiple times, forming a line.

CREATE_EFFECTS_LINE([origin],[destination],[curvature], [distance], [speed], [effect])

Where:

[origin] - The origin location, where the first effect spawns. E.g. PLAYER1 or 1 to go from an action point.

[destination] - The location where the line is drawn towards.

[curvature] - 0 to go in a straight line, with bigger values to get a bigger curve. At 64 if you go from the the central top slab to the central bottom slab of a square room, it will go clockwise through the outer right slab. Use negative values to go counter-clockwise.

[distance] - How far apart the effects forming the line are. Where 24 spawns effects a single slab apart

[speed] - The delay between effects. With 80 being a second apart, and 0 is them all spawning at the same time. Max value is 127.

[effect] - The effect to spawn. Can be any effect or effect element that is in game, like the hearts that appear when healing, or the red smoke when claiming a room.
Positive numbers are Effects, Negative numbers are Effect Elements

CREATURE_ENTRANCE_LEVEL

Sets the level at which units come from the portal.

CREATURE_ENTRANCE_LEVEL ([player],[level])

Creature

Script commands that use the [creature] parameter to target a specific creature type, may now use ANY_CREATURE to select a random creature type.

Criterion

There's a new Criterion, to be used on spells like LEVEL_UP_CREATURE. You can now use AT_ACTION_POINT[#]. See the other criteria at KILL_CREATURE.

Example:

REM Red units that reach action point 3 turn blue
NEXT_COMMAND_REUSABLE
CHANGE_CREATURE_OWNER(PLAYER0,ANY_CREATURE,AT_ACTION_POINT[3],PLAYER1)

DELETE_FROM_PARTY

Removes a unit from a defined party. Use it before the party is added to the level. When two equal units are in the party, the one that was first added will be deleted.

DELETE_FROM_PARTY([party_name], [creature], [level])

where:

[party_name] - The name as defined with the CREATE_PARTY command

[creature] - Creature model to be searched.

[level] - The experience level of the unit that is to be removed.

DISPLAY_MESSAGE

Displays one of the text messages from language-specific strings banks as a chat message, with a specific unit or player shown as the sender. It disappears automatically after some time.

  DISPLAY_MESSAGE([a], [icon])

where:

[a] - The number of the message, assigned to it in .po or .pot translation file.

[icon] - The name of the Creature or Player that is shown as the sender of the message. Accepts 'None' for no icon.

HIDE_TIMER

Hides the timer that has been made visible with DISPLAY_TIMER

  HIDE_TIMER 

HIDE_VARIABLE

Hides the variable that has been made visible with DISPLAY_VARIABLE

  HIDE_VARIABLE

IF

This is used to test the differences between two values ([name] and [a]). If those two values agree with the comparison, the script will continue. If the two values do not agree with the comparison, the script will find the next ENDIF and continue from there. New option values have been added to this command, and some original options were changed:

  • It can now be used to compare BOX#_ACTIVATED, SACRIFICED[creature] and REWARDED[creature] flags.

Location

There's a new location. Just like Action Points, Hero Gates and players, you can now spawn units or look at 'LAST_EVENT', which is the location of the last triggered Custom Mystery box or sacrificed unit.

Player name

You can now use alternate player names. RED, BLUE, GREEN, YELLOW and WHITE instead of PLAYER0, PLAYER1, PLAYER2, PLAYER3 and PLAYER_GOOD. PLAYER_NEUTRAL has no alternative name.

QUICK_MESSAGE

Works like DISPLAY_MESSAGE, but instead of using a string from translations, allows to type it directly.

QUICK_MESSAGE([a], "[message]", [icon])

where:

[a] - Message slot selection. There are 50 quick message slots, and each message you're making should use a different one. Using one message slot twice will lead to the first message being lost.

[message] - The message string to be shown in a box. Message length may be up to 1024 characters.

[icon] - The name of the Creature or Player that is shown as the sender of the message. Accepts 'None' for no icon.

RANDOMISE_FLAG

Gives a flag a true random value. Can be used to get truly random level scripts.

RANDOMISE_FLAG([player],[flag],[max value])

where: [player] - The player’s name, e.g. PLAYER1. See players section for more information.

[flag] - The flag’s name.

[max value] - The flag will get a value ranging from 1 to this max value.

Example:

    REM Spawn a party from a random hero gate every 5 minutes
    SET_TIMER(PLAYER_GOOD,TIMER3)
    IF(PLAYER_GOOD,TIMER3 >= 6000)
	NEXT_COMMAND_REUSABLE
	RANDOMISE_FLAG(PLAYER_GOOD,FLAG3,3)
	IF(PLAYER_GOOD,FLAG3 == 1)
		NEXT_COMMAND_REUSABLE
		ADD_PARTY_TO_LEVEL(PLAYER_GOOD,demo_party,-1,1)
	ENDIF
	IF(PLAYER_GOOD,FLAG3 == 2)
		NEXT_COMMAND_REUSABLE
		ADD_PARTY_TO_LEVEL(PLAYER_GOOD,demo_party,-2,1)
	ENDIF
	IF(PLAYER_GOOD,FLAG3 == 3)
		NEXT_COMMAND_REUSABLE
		ADD_PARTY_TO_LEVEL(PLAYER_GOOD,demo_party,-3,1)
	ENDIF
	NEXT_COMMAND_REUSABLE
	SET_TIMER(PLAYER_GOOD,TIMER3)
ENDIF

REMOVE_SACRIFICE_RECIPE

Removes a Temple recipe.

REMOVE_SACRIFICE_RECIPE([creature1],[creature2].....[creature5])

Where [creature2] to [creature5] are only needed when they are used in the recipe.

Example:

IF(PLAYER0,REWARDED[BILE_DEMON] >= 2)
  QUICK_INFORMATION(1, "You have sacrificed enough spiders. No more.", LAST_EVENT)
  REMOVE_SACRIFICE_RECIPE(SPIDER, SPIDER, SPIDER)
ENDIF

IF(PLAYER0,SACRIFICED[IMP] >= 12)
  QUICK_INFORMATION(2, "The gods don't need any more imps.",ALL_PLAYERS)
  REMOVE_SACRIFICE_RECIPE(IMP)
  SET_SACRIFICE_RECIPE(NegUniqFunc,COSTLIER_IMPS,IMP)
ENDIF

ROOM_AVAILABLE

This command tells the game that a specific room is available for the player to place down.

ROOM_AVAILABLE(​[player],​[room],​[can be available],​[is available])

Where:

[player] - The player’s name, e.g. PLAYER1. See players section for more information.

[room] - The room’s name, e.g. TEMPLE. See room names section for more information.

[can be available] - This value can be set to 0, 1, 2, 3 or 4.

  1. It will not become available at all.
  2. The room becomes available through research.
  3. The room becomes available when researched or when found on the map.
  4. The room may not be researched but becomes available when claimed on the map.
  5. The room becomes available for research after claimed on the map.

[is available] - This value should either be 0 or 1. If it is 1 then the room is available straight away. If it is 0 then the room can not be build until the conditions of 'can be available' are met.

SET_CAMPAIGN_FLAG

Script command remains active but is to be considered deprecated. Function has been completely absorbed by SET_FLAG command which now accepts all Flag types, including campaign flags.

SET_FLAG

Sets up a flag that is assigned a number.

SET_FLAG(​[player],​[flag],​[a])

Where:

[player] - The player’s name, e.g. PLAYER1.

[flag] - The flag’s name.

There's multiple Flag types:

Type Flag names Use
FLAG FLAG0 to FLAG7 The classic flag. Will also be updated by custom sacrifice recipes.
CAMPAIGN_FLAG CAMPAIGN_FLAG0 to CAMPAIGN_FLAG7 Value is not forgotten at the end of a level. Accepts bigger numbers.
BOX_ACTIVATED BOX0_ACTIVATED to BOX255_ACTIVATED Value is updated when you claim a custom special box with the respective number.
SACRIFICED SACRIFICED[creature] Shows how many units of the type are currently in the temple pool. Example SACRIFICED[FLY].
REWARDED REWARDED[creature] Shows how many units of the type the player has received from the temple.

Example:

IF(PLAYER0,MONEY == 0)
  REM All units get angry now.
  SET_FLAG(PLAYER0,SACRIFICED[VAMPIRE],2)
ENDIF

REM When player found both boxes with number 3, set the campaign flag give a unit on the next level
IF(BOX3_ACTIVATED >= 2)
  SET_FLAG(PLAYER0,CAMPAIGN_FLAG1,1)
ENDIF

SET_HEART_HEALTH

Set the Dungeon Heart health to a specific value for a player.

ADD_HEART_HEALTH([player],[health])

SET_SACRIFICE_RECIPE

Creates or modifies a Temple recipe.

SET_SACRIFICE_RECIPE([command],[reward],[creature1],[creature2].....[creature5])

Where:

[command] - The possible commands as listed in the sacrifices section in rules.cfg. Additionally, CUSTOMREWARD and CUSTOMPUNISH may be used. These play the respective sounds, and may increase the flag as configured for the reward parameter.

[reward] - The Creature, Spell or Unique function that is triggered when the Sacrifice completes, as seen in rules.cfg. Use FLAG0-FLAG7 to indicate which flag is raised when a player completes the sacrifice.

[creature1] to [creature5] are creature names, like HORNY. Only the first one is mandatory.

Example:

SET_SACRIFICE_RECIPE(CUSTOMREWARD, FLAG3, WIZARD, MONK)
IF(PLAYER0,FLAG3 >= 1)
  QUICK_INFORMATION(2, "If you give the dark gods wizards and monks, we'll give you gold", ALL_PLAYERS)
  NEXT_COMMAND_REUSABLE
  ADD_GOLD_TO_PLAYER(PLAYER0,666)
  NEXT_COMMAND_REUSABLE
  SET_FLAG(PLAYER0,FLAG3,0)
ENDIF

REM Sacrifice 5 heroes for the avatar to attack from the temple
SET_SACRIFICE_RECIPE(MkGoodHero,AVATAR,KNIGHT,SAMURAI,WIZARD,GIANT,MONK)

SET_BOX_TOOLTIP

Creates a custom tooltip for Custom special boxes.

SET_BOX_TOOLTIP([boxnumber],"[Custom tooltip]")

Where:

[boxnumber] - The ID of the custom box. With a new ADiKtEd or the ADD_OBJECT_TO_LEVEL command you can set a number. Multiple boxes may have the same number, and they will get the same tooltip and functionality.

[custom tooltip] - The text that will displayed when you hover your mouse over the Special box.

Example:

SET_BOX_TOOLTIP(4, "Cast Rebound on your creatures.")

REM Place a Special box with ID 4 on action point 2.
ADD_OBJECT_TO_LEVEL(SPECBOX_CUSTOM, 2, 4)

SET_BOX_TOOLTIP_ID

Sets a Tooltip on a custom special box, with a text from the language files.

SET_BOX_TOOLTIP([boxnumber],[a])

Where:

[boxnumber] - The ID of the custom box.

[a] - The number of the message, assigned to it in .po or .pot translation file.

SET_DOOR_CONFIGURATION

Allows you to make changes to door values set in trapdoor.cfg. Look in that file for explanations on the numbers.

SET_DOOR_CONFIGURATION([doorname],[property],[value],[second value*])

Where:
[doorname] - The name of the door as defined in trapdoor.cfg

[property] - The name of the door property you want to change, as found in trapdoor.cfg. E.g. ManufactureRequired.

[value] - The new value you want to set it to. If you want to set the 'Crate' property, use the number from objects.cfg, not the crate name.

[second value] - The SymbolSprites property has 2 values to set. For other properties, do not add this parameter.

Use it to tweak doors on a per map basis. Example:

REM On this level, magic and iron doors do not give much value after several have been sold or destroyed.
IF(PLAYER0,DOORS_DESTROYED > 5)
    SET_DOOR_CONFIGURATION(MAGIC,SellingValue,150)
    SET_DOOR_CONFIGURATION(IRON,SellingValue,100)
ENDIF

SET_OBJECT_CONFIGURATION

Allows you to make changes to object values set in objects.cfg.

SET_OBJECT_CONFIGURATION([objectname],[property],[value])

Where:
[objectname] - The name of the object as defined in objects.cfg

[property] - The name of the object property you want to change, as found in objects.cfg. E.g. DestroyOnLava.

[value] - The new value you want to set it to. If you want to set the value of the property named 'Properties', use a number you get by adding up these values:

number property
1 EXISTS_ONLY_IN_ROOM
2 DESTROYED_ON_ROOM_CLAIM
4 CHOWNED_ON_ROOM_CLAIM
8 DESTROYED_ON_ROOM_PLACE

Use it to tweak objects on a per map basis. Example:

REM On this level gold pots look like gold bags and they can be found at the bottom of water
SET_OBJECT_CONFIGURATION(GOLD,AnimationID,933)
SET_OBJECT_CONFIGURATION(GOLD,DestroyOnLiquid,0)

SET_TRAP_CONFIGURATION

Allows you to make changes to trap values set in trapdoor.cfg. Look in that file for explanations on the numbers.

SET_TRAP_CONFIGURATION([trapname],[property],[value],[second value*])

Where:
[trapname] - The name of the trap as defined in trapdoor.cfg

[property] - The name of the trap property you want to change, as found in trapdoor.cfg. E.g. ManufactureLevel.

[value] - The new value you want to set it to. If you want to set the 'Crate' property, use the number from objects.cfg, not the crate name.

[second value] - The SymbolSprites property has 2 values to set. For other properties, do not add this parameter.

Use it to tweak traps on a per map basis. Example:

REM On this level, alarm traps are replaced by exploding barrels
SET_TRAP_CONFIGURATION(ALARM,Shots,1)
SET_TRAP_CONFIGURATION(ALARM,Model,931)
SET_TRAP_CONFIGURATION(ALARM,TriggerType,2)
SET_TRAP_CONFIGURATION(ALARM,ActivationType,5)
SET_TRAP_CONFIGURATION(ALARM,EffectType,2)
SET_TRAP_CONFIGURATION(ALARM,Hidden,0)

REM And gas traps will hurt you from a distance.
SET_TRAP_CONFIGURATION(POISON_GAS,Shots,5)
SET_TRAP_CONFIGURATION(POISON_GAS,TimeBetweenShots,200)
SET_TRAP_CONFIGURATION(POISON_GAS,TriggerType,3)
SET_TRAP_CONFIGURATION(POISON_GAS,ActivationType,5)
SET_TRAP_CONFIGURATION(POISON_GAS,EffectType,5)

USE_POWER

Casts an untargeted keeper power through the level script.

USE_POWER([caster_player],[power_name],[free])

Where:
[caster_player] - The player who counts as the casting player. Most spells cannot be cast by PLAYER_GOOD.

[power_name] - The name of the power to cast. E.g. POWER_HOLD_AUDIENCE. Get the names from fxdata\magic.cfg

[free] - When at 0, the price of the power is deducted from the player's gold reserves. At 1 the power is free.

Example:

REM Blue will end the level when at 25 units
IF(PLAYER1,TOTAL_CREATURES >= 25)
  USE_POWER(PLAYER1,POWER_ARMAGEDDON,1)
ENDIF

USE_POWER_AT_LOCATION

Casts a keeper power at specific map location through the level script.

USE_POWER_AT_LOCATION([caster_player],[action point],[power_name],[power_level],[free])

Where:
[caster_player] - The player who counts as the casting player.

[action point] - The location you want to cast on. Works like other commands and accepts action points, hero gates and players.

[power_name] - The name of the power to cast. E.g. POWER_CAVE_IN. Get the names from fxdata\magic.cfg

[power_level] - The charge level of the power. Range 1-9. Is ignored for powers that cannot be charged.

[free] - When at 0, the price of the power is deducted from the player's gold reserves. At 1 the power is free.

USE_POWER_AT_SUBTILE

Casts a keeper power somewhere at the map through the level script.

USE_POWER_AT_SUBTILE([caster_player],[subtile_x],[subtile_y],[power_name],[power_level],[free])

Where:
[caster_player] - The player who counts as the casting player.

[subtile_x][subtile_y] - The subtile where the power is cast. Range 1-254.

[power_name] - The name of the power to cast. E.g. POWER_CAVE_IN. Get the names from fxdata\magic.cfg

[power_level] - The charge level of the power. Range 1-9. Is ignored for powers that cannot be charged.

[free] - When at 0, the price of the power is deducted from the player's gold reserves. At 1 the power is free.

Example:

REM If Red has a fortified wall at the breach point, blue will break it with a lvl3 cast of destroy walls
IF_SLAB_TYPE(14,11,DRAPE_WALL)
  USE_POWER_AT_SUBTILE(PLAYER1,44,35,POWER_DESTROY_WALLS,3,1)
ENDIF

USE_POWER_ON_CREATURE

Casts a keeper power on a specific creature. It also accepts non-targeted powers like POWER_SIGHT, which will simply use the location of the unit.

USE_POWER_ON_CREATURE([player],[creature],[criterion],[caster_player],[power_name],[power_level],[free])

Where:
[player] - The name of the player who owns the creature, e.g. PLAYER1.

[creature] - Creature model to be searched.

[criterion] - Creature selection criterion. Same criteria as for KILL_CREATURE command.

[caster_player] - The player which counts as the casting player

[power_name] - The name of the power to cast. E.g. POWER_HEAL. Get the names from fxdata\magic.cfg

[power_level] - The charge level of the power. Range 1-9. Is ignored for powers that cannot be charged.

[free] - When at 0, the price of the power is deducted from the players gold reserves. At 1 the power is free.

Example:

REM Stop Red from claiming Blue tiles
IF(PLAYER1,FLAG1 == 1)
  NEXT_COMMAND_REUSABLE
  USE_POWER_ON_CREATURE(PLAYER0,IMP,ON_ENEMY_GROUND,PLAYER1,POWER_CAVE_IN,1,1)
ENDIF

USE_SPECIAL_INCREASE_LEVEL

Actives the effect of an 'Increase Level' dungeon special.

USE_SPECIAL_INCREASE_LEVEL([player],[count])

Where:
[player] - The name of the player who owns the creature, e.g. PLAYER1.

[count] - How many times the special is activated.

USE_SPECIAL_MULTIPLY_CREATURES

Actives the effect of an 'Multiply Creatures' dungeon special.

USE_SPECIAL_MULTIPLY_CREATURES([player],[count])

USE_SPECIAL_MAKE_SAFE

Actives the effect of an 'Make Safe' dungeon special.

USE_SPECIAL_MAKE_SAFE([player])

USE_SPECIAL_LOCATE_HIDDEN_WORLD

Actives the effect of an 'Locate Hidden World' dungeon special.

USE_SPECIAL_LOCATE_HIDDEN_WORLD

USE_SPELL_ON_CREATURE

Casts a unit spell on a specific creature. Only abilities with actual spell effects can be used. So Freeze yes, Fireball, no.

USE_SPELL_ON_CREATURE([player],[creature],[criterion],[spell],[spell_level])

Where:
[player] - The name of the player who owns the creature, e.g. PLAYER1.

[creature] - Creature model to be searched. Accepts 'ANY_CREATURE'.

[criterion] - Creature selection criterion. Same criteria as for KILL_CREATURE command.

[spell] - The spell to cast, use the spell name from fxdata\magic.cfg. You can only use Freeze, Armour, Rebound, Heal, Invisibility, Teleport, Speed, Slow, Fly, Sight, Light, Disease and Chicken.

[spell_level] - Higher level units cast some spells with more spell power. It's the spells keepers can cast too. For these spells, give the level of the creature, otherwise use 0.

Example:

REM Freeze the blue dragon.
IF(PLAYER1,FLAG1 == 1)
  USE_SPELL_ON_CREATURE(PLAYER1,DRAGON,ANYWHERE,SPELL_FREEZE,0)
ENDIF

Variables

There are new variables, which can be checked with an IF statement.

name description
BONUS_TIME The current value of the BONUS_LEVEL_TIME timer
DOORS_SOLD How many doors the player sold
EVIL_CREATURES_CONVERTED Number of creatures gained by the player through converting in the torture room, excluding heroes and imps
GOOD_CREATURES_CONVERTED Number of heroes gained by the player through converting in the torture room
MANUFACTURE_GOLD How much gold the player gained through selling traps and doors
MANUFACTURED_SOLD How many traps and doors the player sold
TOTAL_SCORE The level score, based on quality of the dungeon and number of creatures
TRAPS_SOLD How many traps the player sold

Clone this wiki locally