Asset Definition Reference

 

This document is intended as a reference to asset definition scripts. The focus is on completeness rather than brevity. Refer to the tutorials for more detailed examples on how to use the material described here.

The Lua functions described here follow the “define*” naming convention and they can be accessed from your dungeon’s init scripts. All assets must be created when loading the dungeon. It is not possible define assets after the dungeon has been initialized.

Basic Terminology

A 3d vector refers to an object returned by the global function vec. For example, a new 3d vector can be created with vec(1,2,3).

A valid asset reference means a filename that starts with either “assets/” or “mod_assets/”. Filenames starting with “assets/” are assets that are contained in the main game’s data archive grimrock.dat. Files starting with “mod_assets/” are included and packaged with your mod when the dungeon is exported from the Dungeon Editor.

The following file types are supported:

  • *.lua containing Lua source code in text format,
  • *.dds texture files containing textures in DDS format,
  • *.model files containing 3d models in a custom file format,
  • *.animation files containing animation data in custom file format,
  • *.wav files containing sound effects in wave format and
  • *.ogg files containing background music.

Animation Events

defineAnimationEvent{…}
Defines a new animation event. Animation events are used to trigger footstep sounds and attack methods for monsters. The function takes the following named parameters:

  • animation: the filename of the animation to attach the event to. The filename must be a valid asset reference ending with “.fbx”.
  • event: an event name to attach. Typical event names used are “footstep”, “attack” and “ranged_attack”.
  • frame: a frame number in the animation to attach the event to (one frame equals 1/30th of a second).

Dungeon Objects

cloneObject{…}
Clones an existing object and overrides its properties. The function takes the following unnamed parameters:

  • name: the name of the new object to define.
  • baseObject: the name of the base-object to clone.

Additionally any number of override parameters can be added. The list of additional parameters that can be added depends on base-object’s class. See defineObject() for a details about supported properties for each class.

For example, the following script will define a new type of spider with an overridden move sound and increased health.

cloneObject{
	name = "strange_spider",
	baseObject = "spider",
	moveSound = "snail_walk",
	health = 250,
}

defineObject{…}
Defines a new dungeon object or replaces an existing object definition. It is recommended to use cloneObject() if you want to change only a few properties of an existing object. The function takes the following named parameters:

  • name: the name of the object to define or replace.
  • class: the class name of the object.
  • model: the filename of the model for rendering. The filename must be a valid asset reference ending with “.fbx”.
  • editorIcon: index of the icon in Dungeon Editor.

The remaining parameters depend on the class of the object as follows.

Alcove:

  • replacesWall: a boolean, if true the alcove model replaces the entire wall model. Typically set to true.
  • anchorPos: a 3d vector specifying the item anchor position in model’s local space.
  • anchorRotation: a 3d vector specifying the item anchor rotation in model’s local space.
  • targetPos: a 3d vector specifying the center position of the click box in model’s local space.
  • targetSize: a 3d vector specifying the extents of the click box.
  • placement: must always be set to “wall”.
  • onInsertItem: a hook which is called when an item is being placed on the alcove. The function receives two parameters: the alcove itself and the item being placed. If the function returns false, the alcove rejects the item.

Altar:

  • anchorPos: a 3d vector specifying the item anchor position in model’s local space.
  • anchorRotation: a 3d vector specifying the item anchor rotation in model’s local space.
  • targetPos: a 3d vector specifying the center position of the click box in model’s local space.
  • targetSize: a 3d vector specifying the extents of the click box.
  • placement: must always be set to “floor”.

Blockage:

  • brokenModel: the filename of the model that is swapped in when the blockage is destroyed.The filename must be a valid asset reference ending with “.fbx”.
  • health: the amount of damage it takes to destroy the blockage.
  • evasion: the evasion statistic of the blockage. Usually set to something very small, such as -1000.
  • hitSound: the name of the sound to play when the blockage is hit.
  • hitEffect: the name of the particle system to play when the blockage is hit.
  • repelProjectiles: a boolean, if set the blockage pushes all projectiles out from blockage’s square on impact.
  • placement: must always be set to “floor”.
  • onDamage: a hook which is called when the blockage is damaged. The function gets the following parameters: the blockage itself, amount of damage and the damage type (e.g. “physical”, “fire”, etc.). If the function returns false, the blockage receives no damage.
  • onProjectileHit: a hook which is called when a projectile hits the blockage. The function gets the following parameters: the blockage itself, the projectile which hit the blockage, amount of damage and damage type. If the function returns false, the blockage receives no damage and the projectile drops to ground.
  • onDie: a hook which is called when the blockage is destroyed. The function gets one parameter, the blockage itself. If the function returns false, the blockage is not destoyed.

Blocker:

    This class has no additional properties.

Button:

  • pressAnim: the filename of the button press animation. The filename must be a valid asset reference ending with “.fbx”.
  • replacesWall: a boolean, if true the button model replaces the entire wall model. Typically set to true.
  • placement: must always be set to “wall”.

Counter:

    This class has no additional properties.

Crystal:

  • animation: the filename of the spinning animation. The filename must be a valid asset reference ending with “.fbx”.
  • particleSystem: the name of the particle system to play when the crystal is spinning.
  • placement: must always be set to “floor”.

Decoration:

  • replacesWall: a boolean, if true the decoration model replaces the entire wall model.
  • replacesFloor: a boolean, if true the decoration model replaces the entire floor model.
  • placement: either “floor”, “ceiling” or “wall”.

Door:

  • doorFrameModel: the filename of the door frame model. The filename must be a valid asset reference ending with “.fbx”.
  • pullChainModel: the filename of the door pullchain model. The filename must be a valid asset reference ending with “.fbx”.
  • pullChainAnim: the filename of the door pullchain animation. The filename must be a valid asset reference ending with “.fbx”.
  • openSound: the name of the sound to play when the door is opened.
  • closeSound: the name of the sound to play when the door is closed.
  • lockSound:the name of the sound to play when the door locks into place after opening or closing.
  • killPillars: a boolean which removes pillars next to the door frame. Typically this is set to true.
  • openVelocity: door opening velocity in metres/second.
  • closeVelocity: initial door closing velocity in metres/second.
  • closeAcceleration: door closing acceleration in metres/second^2.
  • sparse: a boolean which controls whether items can be picked through the door.
  • placement: must always be set to “wall”.
  • onOpen: a hook which is called when the door is opened. The function gets one parameter, the door itself. If the function returns false, the action is cancelled.
  • onClose: a hook which is called when the door is closed. The function gets one parameter, the door itself. If the function returns false, the action is cancelled.

FX:

    This class has no additional properties.

Item:

  • uiName: the name of the item as display to the player.
  • model: the filename of the model for rendering. The filename must be a valid asset reference ending with “.fbx”.
  • gfxIndex: index of the item graphics in texture atlas.
  • gfxAtlas: filename of the texture atlas containing the item icon. The filename must be a valid asset reference ending with “.tga”.
  • slot: (optional) a protective inventory slot where the item can be inserted. Must be one of the following: “Head”, “Torso”, “Legs”, “Feet”, “Cloak”, “Neck”, “Gauntlets”, “Bracers”
  • armorSet: (optional) the name of armor set where the item belongs to.
  • reachWeapon: a boolean flag which enables reach attacks with melee weapons from the back row.
  • throwingWeapon: a boolean flag which indicates that the item is a throwing weapon.
  • rangedWeapon: a boolean flag which indicates that the item is a ranged weapon, i.e. a weapon that shoots ammo items.
  • shield: a boolean flag which indicates that the item is a shield.
  • stackable: a boolean flag which enables stacking.
  • key: a boolean flag which indicates that the item is a key.
  • scroll: a boolean flag which indicates that the item is a scroll.
  • sharpProjectile: a boolean flag which causes the item to get stuck to monsters on impact.
  • treasure: a boolean flag which indicates that the item is counted as a treasure.
  • consumable: a boolean flag which indicates that the item can be consumed.
  • nutritionValue: the amount of food gained when the item is consumed.
  • potion: a boolean flag which indicates that the item is a potion. Potions are turned into empty flasks when consumed.
  • container: a boolean flag which indicates that the item can hold other items.
  • containerType: must be one of the predefined values: “sack”, “chest”, “mortar”.
  • capacity: the maximum number of items that can be placed in the container.
  • torch: a boolean flag which indicates that the item is a torch.
  • fuel: fuel for torches in seconds.
  • ammo: the type of ammunition needed by a ranged weapon.
  • ammoType: the ammunition type of the item.
  • bombType: causes the item to explode on impact. Must be one of the following: “fire”, “frost”, “shock”, “poison”.
  • bombPower: attack power for exploding bomb.
  • attackPower: attack power bonus for weapons.
  • accuracy: accuracy bonus for weapons.
  • protection: projection bonus for armors.
  • evasion: evasion bonus for projective gear.
  • energy: energy bonus.
  • strength: strength bonus.
  • dexterity: dexterity bonus.
  • vitality: vitality bonus.
  • willpower: willpower bonus.
  • resistFire: fire resistance bonus.
  • resistCold: cold resistance bonus.
  • resistShock: shock resistance bonus.
  • resistPoison: poison resistance bonus.
  • damageType: (optional) damage type. Must be one of the following: “physical”, “fire”, “cold”, “shock”, “poison”.
  • coolDownTime: cool down time in seconds.
  • weight: weight in kilograms.
  • skill: the weapon skill to use when attacking.
  • requiredLevel: the number of skill points needed to use the item.
  • armorSkill: (optional) armor skill that is required to use the armor. Must be either “light_armor” or “heavy_armor”.
  • attackMethod: the method to be called when the item is used. Must be one of the following: “meleeAttack”, “throwAttack”, “rangedAttack”, “castWandSpell” or “castRuneSpell”.
  • spell: the spell to be cast for wands or the spell explained by a scroll.
  • wandPower: the power of spell for wands which roughly corresponds to attack power of melee weapons.
  • charges: number of charges for wands.
  • emptyItem: the name of the empty version of the item which the item is swapped to when charges run out.
  • attackSwipe: the swipe effect to be played when attacking with the item. Must be one of the following: “vertical”, “horizontal”.
  • attackSound: the sound effect to be played when attacking with the item. Typically set to “swipe”.
  • impactSound: the sound effect to be played when the weapon hits an obstacle such as a wall. Typically set to “impact_blade” or “impact_blunt”.
  • projectileRotationSpeed: the speed of rotation for projectile items.
  • projectileRotationX: rotation angle around x-axis in degrees for projectile items.
  • projectileRotationY: rotation angle around y-axis in degrees for projectile items.
  • projectileRotationZ: rotation angle around z-axis in degrees for projectile items.
  • description: the description of the item that is display in tooltips.
  • gameEffect: additional game effect description for tooltips.
  • scrambleText: text that is display using the scramble text effect in the tooltip.
  • glitterEffect: (optional) name of the particle system attached to the item model.
  • onUseItem: a hook which is called when the item is used (e.g. by right-clicking on it). The function gets two parameters: the item used and the champion who used the item. If the function returns true, the item is consumed when it is used.
  • onEquipItem: a hook which is called when the item is equipped, i.e. placed in an inventory slot. The function gets two parameters: the champion and inventory slot.
  • onUnequipItem: a hook which is called when the item is unequipped, i.e. removed from an inventory slot. The function gets two parameters: the champion and inventory slot.

Lever:

  • activateAnim: the filename of the lever activate animation. The filename must be a valid asset reference ending with “.fbx”.
  • deactivateAnim: the filename of the lever deactivate animation. The filename must be a valid asset reference ending with “.fbx”.
  • placement: must always be set to “wall”.

LightSource:

  • lightPosition: a 3d vector specifying the origin of the light source in entity’s local space.
  • lightRange: the range of the light source in meters.
  • lightColor: a 3d vector specifying the RGB color of the light source in range 0-1.
  • brightness: scales the intensity of the light source.
  • castShadow: a boolean which turns dynamic shadow rendering on and off.
  • flicker: a boolean which turns flickering effect on and off. Default is on.
  • particleSystem: (optional) name of a particle system to attach to the light source.
  • placement: must always be set to “floor”.

Lock:

  • height: y-coordinate of the lock from the floor.
  • placement: must always be set to “wall”.

MapMarker:

    This class has no additional properties.

Monster:

  • model: the filename of the monster model. The filename must be a valid asset reference ending with “.fbx”.
  • meshName: the name of the monster mesh in the model file.
  • animations: a table of animations to load. The keys in the table corresponds to animation slots and values to animation filenames. Animation file names must be valid asset references ending with “.fbx”. The animations slots are: “idle”, “moveForward”, “turnLeft”, “turnRight”, “strafeLeft”, “strafeRight”, “attack”, “attack2″, “attackBack”, “attackMove”, “attackLeft”, “attackRight”, “turnAttackLeft”, “turnAttackRight”, “rushBegin”, “rushContinue1″, “rushContinue2″, “rushHit1″, “rushHit2″, “getHitFrontLeft”, “getHitFrontRight”, “getHitBack”, “getHitLeft”, “getHitRight”, and “fall”.
  • turnAnimSpeed: (optional) animation speed multiplier for turning animations.
  • attackAnimSpeed: (optional) animation speed multiplier for attack animations.
  • moveSound: the sound to play when the monster moves.
  • footstepSound: the sound to play when “footstep” animation event is triggered.
  • attackSound: the sound to play when the monster attacks.
  • impactSound: the sound to play when the monster’s attack hits.
  • hitSound: the sound to play when the monster attack hits the target.
  • dieSound: the sound to play when the monster dies.
  • rushBeginSound: the sound to play when the monster begins charging.
  • soundClipDistance: (optional) sound clipping distance in squares. Sounds are clipped off if the distance from the monster to the party is larger than sound clipping distance.
  • hitEffect: the name of the particle system to play when the monster is hit.
  • capsuleHeight: the height of the capsule used for placing hit particle effects.
  • capsuleRadius: the radius of the capsule used for placing hit particle effects.
  • collisionRadius: TODO
  • health: the health of the monster when it’s spawned.
  • sight: the sight range of the monster in squares.
  • allAroundSight: a boolean which indicates that the monster can see in all directions.
  • seeInvisible: a boolean which indicates that the monster can see invisible targets.
  • attackPower: the attack power of the monster’s attack.
  • rangedAttack: the ranged attack to perform when “ranged_attack” animation event is triggered. Must be one of the following: “lightning_bolt”, “lightning_bolt_greater”, “ice_shards”, “fireball”, “fireball_greater”, “poison_bolt”, “frost_arrow”.
  • movementCoolDown: TODO
  • flying: if set the monster can fly over pits.
  • coolDown: a table with two number values, the min and max cool down for monster’s attack in seconds.
  • noRecoilInterval: a table with two number values between 0 and 1, the fractional start and end values of monster’s “no recoil interval”, the span of time when monster’s attack animation can’t be interrupted.
  • protection: monster’s protection statistic
  • evasion: monster’s evasion statistic
  • immunities: a list of effecst the monster is immune to. Available immunities are: “poison”, “fire”, “cold”, “shock”, “backstab” and “assassination”.
  • exp: the amount of experience points awarded when the monster is killed.
  • lootDrop: a random loot table containing (chance,item) pairs. For example { 75, “snail_slice”, 25, “snail_slice” } indicates that there is a 75% chance of generating a snail_slice and an additional 25% chance of generating another snail_slice.
  • healthIncrement: the amount of health gained when the monster gains levels.
  • attackPowerIncrement: the amount of attack power gained the monster gains levels.
  • protectionIncrement: the amount of protection gained the monster gains levels.
  • brain: the AI class to use. Must be one of the following: “Melee”, “Ranged”, “HerderSmall”, “HerderBig”, “Ogre”, “SkeletonArcher”, “Goromorg”, “Tentacle”, “Uggardian”, “Crab”, “Slime”, “Warden”, “Cube”
  • particleSystem: (optional) particle system filename to attach to the monster.
  • particleSystemNode: (optional) the node in the monster model for attaching particle systems.
  • lightName: (optional) the node in the monster model for light attachment.
  • lightColor: (optional) a 3d vector specifying the color of the light carried by the monster.
  • lightBrightness: (optional) a scalar intensity of the light carried by the monster.
  • lightRange: (optional) the range of the light carried by the monster.
  • onMove: a hook which is called when the monster moves. The function gets two parameters: the monster itself and the direction it is moving, 0 = north, 1 = east, 2 = south, 3 = west. If the function returns false, the move is cancelled.
  • onTurn: a hook which is called when the monster turns. The function gets two parameters: the monster itself and the direction it is turning, -1 for counterclockwise and 1 for clockwise turns. If the function returns false, the turn is cancelled.
  • onAttack: a hook which is called when the monster attacks. The function gets two parameters: the monster itself and the name of the attack (e.g. “attack” or “attack_left”). Most monsters can only do frontal attacks. If the function returns false, the attack is cancelled.
  • onRangedAttack: a hook which is called when the monster performs a ranged attack. The function receives a single parameter, the monster itself. If the function returns false, the ranged attack is cancelled.
  • onDealDamage: a hook which is called when monster’s attack hits and deals damage. The function gets the following parameters: the monster itself, the champion receiving the attack and the amount of damage. If the function returns false, damage is not dealt to the target.
  • onDamage: a hook which is called when the monster is damaged. The function gets the following parameters: the monster itself, amount of damage and the damage type (e.g. “physical”, “fire”, etc.). If the function returns false, the monster receives no damage.
  • onProjectileHit: a hook which is called when a projectile hits the monster. The function gets the following parameters: the monster itself, the projectile which hit the monster, amount of damage and damage type. If the function returns false, the monster receives no damage and the projectile drops to ground.
  • onDie: a hook which is called when the monster dies. The function gets one parameter, the monster itself. If the function returns false, the monster is resurrected to life.

MonsterGroup:

  • monsterType: the name of base monster that forms the group.
  • count: number of monsters in the group, must be either 2 or 4.

Party:

  • onMove: a hook which is called when the party moves. The function gets two parameters: the party itself and the numeric compass direction it is moving: 0 (north), 1 (east), 2 (south) or 3 (west). If the function returns false, the move is cancelled.
  • onTurn: a hook which is called when the party turns. The function gets two parameters: the party itself and the direction it is turning, -1 for counterclockwise and 1 for clockwise turn. If the function returns false, the turn is cancelled.
  • onUseItem: a hook which is called when an item is used by clicking on an attack icon, right clicking on an inventory item or clicking a champion’s portrait while holding a mouse item. The function gets the following parameters: the champion who uses the item, the item to use and the numeric inventory slot. The slot parameter is nil if the a champion portrait was clicked. If the function returns false, the action is cancelled.
  • onAttack: a hook which is called when a champion attacks. The function gets two parameters: the attacking champion and the weapon used to attack. The weapon parameter is nil for unarmed attacks. If the function returns false, the attack is cancelled.
  • onDamage: a hook which is called when a champion is damaged. The function gets the following parameters: the champion who receives the damage, amount of damage and the damage type (e.g. “physical”, “fire”, etc.). If the function returns false, the champion receives no damage.
  • onProjectileHit: a hook which is called when a champion is hit by a projectile. The function gets the following parameters: the champion who was hit, the projectile hitting the champion, amount of damage and damage type. If the function returns false, the champion receives no damage and the projectile drops to ground.
  • onDie: a hook which is called when a champion dies. The function gets one parameter, the dying champion. If the function returns false, the champion is resurrected back to life.
  • onRest: a hook which is called when the party starts resting. The function gets one parameter, the party itself. If the function returns false, resting is cancelled.
  • onWakeUp: a hook which is called when the party wakes up. The function gets one parameter, the party itself. If the function returns false, waking up is cancelled.
  • onReceiveCondition: a hook which is called when a champion receives a condition. The function gets the following parameters, the champion, the name of the condition and the numeric value of the condition. If the function returns false, setting the condition is cancelled.
  • onCastSpell: a hook which is called when a champion casts a spell. The function gets two parameters, the casting champion and the name of the spell. If the function returns false, the casting is cancelled.
  • onLevelUp: a hook which is called when a champion gains a level. The function gets one parameters, the champion.
  • onPickUpItem: a hook which is called when an item is picked up. The function gets two parameters, the party itself and the item. If the function returns false, the pick up action is cancelled.
  • onDrawGui: a hook which is called after the dungeon view has been rendered. The function gets one parameter, a gui context object (see below).
  • onDrawInventory: a hook which is called after a champion’s inventory screen has been rendered. The function gets one parameter, a gui context object (see below).
  • onDrawStats: a hook which is called after a champion’s stats screem has been rendered. The function gets one parameter, a gui context object (see below).
  • onDrawSkills: a hook which is called after a champion’s skills screen has been rendered. The function gets one parameter, a gui context object (see below).

The gui context has the following functions and properties:

  • width: returns the width of the screen.
  • height returns the height of the screen.
  • mouseX: x-coordinate of the mouse cursor.
  • mouseY: y-coordinate of the mouse cursor.
  • color(red, green, blue, alpha): sets the pen color. Alpha parameter is optional (defaults to 255).
  • font(font): sets the typeface (font must be “tiny”, small”, “medium” or “large”).
  • drawRect(x, y, width, height): draws a filled rectangle with current pen color.
  • drawImage(filename, x, y): draws an image modulated with current pen color.
  • drawText(text, x, y): draws a line of text with current typeface and pen color.
  • button(id, x, y, width, height): returns true if the mouse was clicked in the given button rectangle. id must be a unique string identifier.
  • mouseDown(button): returns true if a mouse button is down (0=left, 1=middle, 2=right).
  • keyDown(key): returns true if the given key is down.

Pit:

  • trapDoorModel: the filename of the trap door model. The filename must be a valid asset reference ending with “.fbx”.
  • openAnim: the filename of the pit open animation. The filename must be a valid asset reference ending with “.fbx”.
  • closeAnim: the filename of the pit close animation. The filename must be a valid asset reference ending with “.fbx”.
  • placement: must always be set to “floor”.

PressurePlate:

  • activateAnim: the filename of the pressure plate activate animation. The filename must be a valid asset reference ending with “.fbx”.
  • deactivateAnim: the filename of the pressure plate deactivate animation. The filename must be a valid asset reference ending with “.fbx”.
  • hidden: a boolean which makes the pressure plate invisible if set to true.
  • silent: a boolean which makes the pressure plate silent if set to true.
  • placement: must always be set to “floor”.

Receptor:

  • hidden: a boolean which makes the receptor invisible if set to true.
  • replacesWall: a boolean, if true the receptor model replaces the entire wall model.
  • placement: must always be set to “wall”.

ScriptEntity:

    This class has no additional properties.

Secret:

    This class has no additional properties.

Spawner:

    This class has no additional properties.

Stairs:

  • down: a boolean indicating whether the stairway leads down (true) or up (false).

StartingLocation:

    This class has no additional properties.

Teleporter:

  • particleSystem: the name of the particle system attached to the teleporter.
  • placement: must always be set to “floor”.

Timer:

    This class has no additional properties.

TorchHolder:

  • anchorPos: a 3d vector specifying the anchoring position for an attached torch in model’s local space.
  • anchorRotation: a 3d vector specifying the rotation around x,y and z axis of an attached torch.
  • placement: must always be set to “wall”.

WallTapestry:

  • brokenModel: the filename of the model that is swapped in when the wall tapestry is teared down.The filename must be a valid asset reference ending with “.fbx”.
  • placement: must always be set to “wall”.

WallText:

  • replacesWall: a boolean, if true the wall text model replaces the entire wall model. Typically set to true.
  • placement: must always be set to “wall”.

Materials

defineMaterial{…}
Defines a new material or replaces an existing material definition. The function takes the following named parameters:

  • name: the name of the material to define or replace.
  • diffuseMap: the filename of the diffuse texture. The filename must be valid asset reference ending with “.tga”. If no texture is specified a built-in white texture is used.
  • specularMap: the filename of the specular texture. The filename must be valid asset reference ending with “.tga”. If no texture is specified a built-in white texture is used.
  • normalMap: the filename of the normal map. The filename must be valid asset reference ending with “.tga”. If no texture is specified normal mapping is turned off.
  • doubleSided: a boolean specifying whether the surface using the material can be seen from both sides.
  • lighting: a boolean which turns on and off dynamic lighting.
  • alphaTest: a boolean which turns on and off alpha testing.
  • blendMode: the alpha blending mode, must be one of the following: “Opaque”, “Translucent”, “Additive”, “Modulative”.
  • textureAddressMode: texture addressing mode, either “Wrap” or “Clamp”.
  • glossiness: the glossiness parameter for specular lighting. Typical values range between 1 and 100.
  • depthBias: depth bias value. It is recommended to set this always to zero.

Particle Systems

defineParticleSystem{…}
Defines a new particle system or replaces an existing particle system definition. The function takes the following named parameters:

  • name: the name of the particle system to define or replace.
  • emitters: a table of emitter descriptors. See below.

An emitter descriptor is a table which contains the parameters for a particle emitter. The following parameters are supported:

  • emissionRate: number of particles to emit per second.
  • emissionTime: duration of emission in seconds. If set to zero, emission time is infinite.
  • maxParticles: maximum number of active particles. Sensible values are between 100 and 1000.
  • spawnBurst: if enabled maximum number of particles are emitted in a single burst when the particle system is started.
  • boxMin: a 3D vector defining the minimum extents for particle emission.
  • boxMax: a 3D vector defining the maximum extents for particle emission.
  • sprayAngle: a table whose first and second elements set the minimum and maximum spraying angle in degrees.
  • velocity: a table whose first and second elements set the minimum and maximum velocity in units per second.
  • size: a table whose first and second elements set the minimum and maximum size for for emitted particles.
  • lifeTime: a table whose first and second elements set the minimum and maximum lifetime for emitted particles.
  • texture: a valid texture asset reference. The texture may contain multiple frames laid out on a grid.
  • frameSize: (optional) pixel size of a frame in the particle animation sequence. Typically 32 or 64.
  • frameCount: (optional) total number of frames in the particle animation sequence.
  • frameRate: (optional) frame rate of the particle animation sequence.
  • color0: a table containing R,G,B values in range 0-1 for initial particle color.
  • color1,color2,color3: (optional) particle color sequence. These parameters have no effect if colorAnimation is not enabled.
  • colorAnimation: a boolean which enables particle color animation.
  • opacity: particle opacity value between 0 and 1.
  • fadeIn: particle’s fade in time in seconds.
  • fadeOut: particle’s fade out time in seconds.
  • gravity: a 3D gravity vector.
  • airResistance: air resistance parameter. Sensible values are between 0 and 10.
  • rotationSpeed: rotation speed of particles in degrees.
  • blendMode: blending mode for particle rendering. Must be either “Additive” or “Translucent”.
  • objectSpace: a boolean flag, if enabled particles are emitted to object space rather than world space.

Sounds

defineSound{…}
Defines a new sound or replaces an existing sound definition. The samples used need to be 16bit 44100Hz .wav-files. The function takes the following named parameters:

  • name: the name of the sound to define or replace.
  • filename: the filename of the sample in wave format. The filename must be a valid asset reference ending with “.wav”. Optionally the filename may be a table containing multiple filenames for random sound variations.
  • loop: a boolean which turns on and off looping.
  • volume: a number between 0 and 1 which controls the amplitude of the sound.
  • minDistance: the minimum distance in squares for sound falloff. The sound plays at max volume if it is closer than min distance to the listener.
  • maxDistance: the maximum distance in squares for sound falloff. The sound is not audible after max distance.

Wallsets

defineWallSet{…}
Defines a new wallset or replaces an existing wallset. The function takes the following named parameters:

  • name: the name of the wallset to define or replace.
  • randomFloorFacing: a boolean flag which enables random floor model rotation.
  • floors: a table of floor models and their relative probabilities. See below.
  • walls: a table of wall models and their relative probabilities. See below.
  • pillars: a table of pillar models and their relative probabilities. See below.
  • ceilings: a table of ceiling models and their relative probabilities. See below.
  • ceilingShafts: a table of ceiling shaft models and their relative probabilities. See below.
  • floorDecorations: a table of floor decoration models and their relative probabilities. See below.
  • wallDecorations: a table of wall decoration models and their relative probabilities. See below.
  • pillarDecorations: a table of pillar decoration models and their relative probabilities. See below.

The tables referred above contain lists of models and their probabilities that are used to randomly pick up pieces for generating the levels. At every odd table index there must be a valid asset reference ending with a “.fbx”. At every even table index there must be a number that indicates the relative probability of the model.

For example,

walls = {
	"assets/models/env/dungeon_wall_01.fbx", 50,
	"assets/models/env/dungeon_wall_drainage.fbx", 1,
}

Would indicate that statistically every 50th generated wall would be a wall drainage.

Floors, walls, pillars, ceilings and ceilingShafts are the basic building blocks of a dungeon. FloorDecorations, wallDecorations, pillarDecorations are additional decorative objects that are placed after floors, walls and pillars have been placed.

Recipes

defineRecipe{…}
Defines a new crafting recipe or replaces an existing recipe. The function takes the following named parameters:

  • item: the name of the item to craft.
  • craftingTool: the name of the crafting item needed for this recipe. Defaults to “mortar”.
  • ingredients: a table of count,item pairs. For example { 1, "flask", 2, "grim_cap" }.

Spells

defineSpell{…}
Defines a new spell or replaces an existing spell. The function takes the following named parameters:

  • name: the name of the spell to define.
  • uiName: the name shown to the user (e.g. in spell scrolls).
  • skill: the name of the skill required to cast the spell.
  • level: the required level in the skill.
  • runes: an alphabetical string of runes: A = top-left rune (fire), B = top rune (creation), C = top-right rune (air), and so on. So e.g. the rune string for fireball spell is “ACF”.
  • manaCost: number of mana points to spend when casting the spell.
  • onCast: this function is called when the spell is cast. The function receives the following parameters: the champion casting the spell, x, y, direction, skill.
© 2013 Almost Human Ltd. Suffusion theme by Sayontan Sinha