Skip to content

New and Modified Level Script Commands

Loobinex edited this page Jul 11, 2020 · 32 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)

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)

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_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],​[place])

where:

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

[place] - 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],​[place])

where:

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

[place] - 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.

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.

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, creature, room, trap or door. In Unofficial it's also possible to compare the campaign_flag.

  • 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 ad 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.

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

The last 3 criteria are specific to KeeperFX Unofficial.

[count] - Amount of creatures affected.

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)

QUICK_INFORMATION

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

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

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.

[place] - 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"],[place])

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

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_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.

KeeperFX Unofficial Additions

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.

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

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],​[player]])

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.

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

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))

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

PLAYER_NEUTRAL

PLAYER_NEUTRAL is now possible as a player command on many commands that need a [player].

Example:

REM Add a neutral reaper on the map for the first player to find.
ADD_CREATURE_TO_LEVEL(PLAYER_NEUTRAL,HORNY,5,1,3,300)

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_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

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
  • 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

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)

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.