Kingsvein

Kingsvein

Not enough ratings
Kingsvein Modding Guide
By Rad Codex
Covers the basics of making mods for Kingsvein, such as making new zones, items, and creatures.
3
   
Award
Favorite
Favorited
Unfavorite
DISCLAIMER
WARNING : Mods are generally safe to install and uninstall, but it is entirely possible to corrupt your game data or save data by creating or installing mods! In these instances, you may be forced to reinstall the game! Back up your save files, and mod at your own risk!
Intro, Filepaths, Console Commands
Welcome to a brief guide to modding Kingsvein! This guide is still a work in progress and is not comprehensive, but should explain enough to start making most kinds of content for Kingsvein.

To learn even more about modding, you can visit the official Rad Codex discord (more info here) and check out the #mod-creation channel.

First: there are two important folder locations for modding.
The Mods directory is at
X:\Users\Username\AppData\Roaming\Kingsvein\Mods
and can be easily accessed by pressing the small folder button in the top left of the Save/Load menu. When making a new mod, make a new folder here and put your files in it.

The Game Data is stored at
X:\Program Files (x86)\Steam\SteamApps\common\Kingsvein\Content
and is important for viewing examples of existing data formats. You can easily open this directory by right-clicking Kingsvein in Steam and selecting Manage > Browse Local Files.

By pressing "Shift" + "~" in-game, you can bring up the Console.

Some important console commands:
  • h lists commands or gives more info on them.
  • dm toggles Debug Mode, which:
    • allows you to bring up the console with just "~"
    • allows you to hold right-click on character stats, then mousewheel to alter them
    • causes the B key to toggle Build mode at any time
    • automatically refreshes mod files when you refocus the window
    • enables a warning system for common typos in mod files
  • b enters Build mode, allowing terrain editing, item placement, etc.
  • go and gob sends you to the specified zone (ex: go zSE1). gob puts you into Build mode immediately. Going to a zone that doesn't exist yet generates a brand new zone.
  • z shows a list of zone data. They do not list zones in the Mods folder.

To permanently enable Debug Mode, open config.ini, found in X:\Users\Username\AppData\Roaming\Kingsvein. Change debugMode=False; to debugMode=True;.
Build mode
Enter build mode with the console command 'b'.

In build mode, you can view and edit the zone, actors, and even terrain types. Use WASD to pan the camera.


The left panel creates Items or Actors.
  • Click the tabs at the top to view different categories.
  • Mousewheel to scroll the list of items or actors.
  • Left click an item to create 1, or right-click to create a stack.

The right panel edits the zone and shows TerrainTypes.
  • brings up a list of shortcuts and hotkeys when hovered.
  • The Zone's ID can be edited in the text field at the top.
  • Most buttons are self-explanatory if you hover them and read the tooltip.
  • Below these buttons are the TerrainTypes.
    • Left-click or right-click to assign a TerrainType to that type of click. Click the zone to place that terrain type.
    • Mousewheel to scroll the list of TerrainTypes.
    • Middle-click a TerrainType to view or edit the TerrainType's properties.
  • opens the Zone Settings Window.
    • From here you can edit many values of the zone, such as palettes, darknessColor, etc.
    • Hold Right-click on palette text fields to view a mousewheel-able list of options.
    • Hold Right-click on color text fields to bring up a mousewheel-able color picker.
  • saves the current zone to Game Data. Be careful not to overwrite your work!


Press T to toggle Trigger mode. This allows you to place event triggers in the zone.



  • Press New Trigger to create a new Trigger, or + Task to add a Task to the currently edited trigger.
  • Hold left-click on the zone to set the trigger box. Right-click to add additional boxes for the same trigger. Middle-click to remove additional boxes.
  • Left click any trigger box to edit its trigger.
  • Hold right-click on the effectID text field for a mousewheel-able list of possible Tasks.
  • Hold right-click on the Triggered by text field for a mousewheel-able list of possible Elements.
  • Triggered by can also take multiple elements. (Example: "physical, ruin, fire")
  • Some common Tasks are:
    • travel_point handles most normal travel from zone to zone.
    • fx plays an fx or sound at the specified spot.
    • setGlobalVar sets a variable that is stored in the player's save.
    • spawn is a complicated effect, but is used to create actors or groups of actors.
    • enterCombat forces combat start in the specified area.
  • Note: any Task can also be called via the console, dialog, or actions.

----------

To edit an Actor, middle-click them and it will bring up their properties window.
Notes on editing Actors:
  • If debugMode is on, you can right-click a stat and mousewheel to alter its value.
  • If debugMode is on, you can alter hostile/neutral by clicking the red or green gem in the character stats window. Right-click adds them to your party.
  • To make an actor ride another actor, place them on the actor. (This is how Possessed have Wisp Nodes added to them.)
  • To rotate an actor 90 degrees, pick them up and press 'R'.
  • To change an actor's class, hover them and press 'C'.
  • To edit an actor's appearance, hover them and press 'E'.
    • Left-click the arrows to select from options available to the player.
    • Right-click the arrows to select from all options.
    • The bottom text field is a sprite selector for bodyParts. Hold right-click and mousewheel to select a part to edit.
  • Most actor properties do nothing or are very glitchy to edit directly. But others are very useful. Some important ones:
    • dialogNodeID specifies what DialogNode to use when the Actor is spoken to.
    • ai_lua is which .lua script to use for AI. "idle" is the proper script for almost all NPCs.
    • aggressiveness affects positioning in combat. High aggression (1+) makes the Actor move as close as possible instead of maintaining attack distance.
    • bravery affects likelihood of the AI fleeing in combat.
    • intelligence affects max time the AI can spend thinking, and how easy it is for them to reach a 'good enough' action and stop thinking.
Zones and Locations
Now that you know how to edit a Zone using Build mode, let's set it up so other people can visit it.

First, save your zone with in Build mode. Now your zone data will be found in Kingsvein\Content\Data\ZoneData. You can open this using the folder button in the top right of the build menu. Find zoneID.txt and zoneID.png (where zoneID is your zone's ID.) Copy these files, create a new folder in the Mods directory, and put the files there.

Now a player can visit your zones using travel triggers or via the console. But let's make it so they can access the zone from the overworld. To do this, we need to make a Location.

Take a look at the game's normal Location data at Kingsvein\Content\SystemSaves\defaultLocations.txt. This is the format we want to use to define our new Location.

In your folder in the Mods directory, create a new text file, and put a new [Location] in it by mimicking the format shown in defaultLocations.txt.

Here's an example:
[Location] ID=myNewPlace; name=Cool Dungeon; x=25; y=16; locationItem=locBase; enterOnTravelPointNum=0; discovered=true; zoneThisLocationIsIn=overworld1;

This example creates a Cool Dungeon on the overworld map. If this file is in the Mods directory, any save that doesn't already have Cool Dungeon will automatically add one to the overworld!

NOTE: you can also override the game's default Locations or Zones by putting your own versions in the Mods directory and using the same ID. The game will always check Mods FIRST when loading Zones.

NOTE: after the first time a Location is created in a save, changing the data will not affect it! The player now has their own version that will never be overwritten!

NOTE: please store Location or Zone data in their own text files, separate from other data types, such as [ItemType] or [ActorType]. If the game detects a [Location] or [Zone] in a text file, it will not load that file on startup, and instead wait until the appropriate time.
ZoneMerge
You can also apply the contents of a Zone directly onto another Zone. This is mostly useful if you want to make changes to the overworld, but you can use it on any zone.

To do this, make a new text file with a unique name. In this file, make a "[ZoneMerge]".
Do NOT put anything else in this file! Here's an example:
[ZoneMerge] filename=zShopOfSecretsZoneMerge; mergeZone=zShopOfSecrets; mergeWith=zSE1; X=79; Y=28;

The properties are:
  • "filename", which is the name of the file.
  • "mergeWith", which is the ID of the zone to merge onto. (example: "mergeWith=zSE1;")
  • "mergeZone", which is the ID of the zone that you are applying on top of that zone.
  • "X" is the X position to put the top left corner of your zone.
  • "Y" is the Y position to put the top left corner of your zone.
  • "fReq" is an optional property if you want to specify a formula requirement that must be calculated as greater than 0 for the ZoneMerge to apply.

Note that ZoneMerges apply once for any save that enters the zone, even saves that have already been in that zone. The ZoneMerge is applied the next time the player enters the zone (not including loading a save).

Once applied, the globalVar zoneID + "_merged" (ex:myModZone_merged) is set to 1 as a way for the game to remember not to reapply the same merge ID to that save file.

NOTE: ZoneMerges overwrite existing items! Be careful that it doesn't overwrite important things.

NOTE: ZoneMerges MUST be larger than 1x1, or the game will assume the file is corrupted.
Creating an ItemType
You can create your own items, or override the normal items of the game.

The game's items are all stored at Kingsvein\Content\Data\SystemData\Definitions\items. Take a look at these files to get an idea of the formatting.

Now, take a look at the example item at Kingsvein\Content\ModSamples\items_mod1.txt. This example creates a new item that uses its own texture. Copy "items_mod1.txt" and "items_mod1.png" to a new folder in the Mods directory so you can access this item in-game using Build mode.

To override an existing item, set your item's ID to the existing item's ID. Additionally, if you'd like to retain all original properties of the item except for those you alter, you can use "cloneFrom".

As an example:
[ItemType] ID=c_armor_ore1; cloneFrom=c_armor_ore1; pR=pBlue;

This example changes the color of all Ore Mail to blue, without changing anything else about it. (cloneFrom also allows multiple mods to 'stack' if they both modify the same item.)
Creating an Action & AvAffecters
You can create Actions that are used by Classes, Items, ActorTypes, or in Reactions on equipment, support abilities, and actor types.

Let's take a look at an example Action - the Knight's Brave:

[Action] ID=c_Kn_Brave; name=Brave; icon=icon_c_Kn_brave; tooltip=Increase <icon=PhysAtk> by <math= c:rank> for <icon=time>2.<br>Each <icon=time> is one combat round.; rankUpTooltip=Each rank increases <icon=PhysAtk> by +1.; tooltipTopRight=; mpCost=1; harmful=false; maxRank=3; canExceedMaxRankBy=1; XPCost=70 * d:u_clever_XPmult; XPCost=350 * d:u_clever_XPmult; XPCost=600 * d:u_clever_XPmult; AIRatingMult=0.75; casterAnimation=c_charge; casterAnimationSpeed=1.5; FXOnCaster=casting; FXOnCasterColor=Red; FXOnCaster=chargeSpiralFast_big; FXOnCasterColor=Red; FXOnCaster=chargeSpiralFast; FXOnCasterColor=Red; FXOnTarget=sfx_powerup1; [ActionAoE] ID=c_Kn_Brave; cloneFrom=adjacentAndSelf; canSelectEnemies=false; [AvAffecter] ID=c_Kn_Brave; harmful=false; actorValue=PhysAtk; magnitude= c:rank; duration=60; chance=100 - 100 * m:tIsRider; visibleMiss=false; FXOnTile=upwardLines_low_overlap; FXOnTileColor=Red; [AvAffecterAoE] ID=c_Kn_Brave; cloneFrom=oneTile;

The [Action] defines all the important properties such as name, description, XPcosts, special properties, etc.

[ActionAoE] is the area of effect that shows up for the player to select. In this case, it highlights the caster and adjacent tiles.

Each [AvAffecter] (there can be as many as you want) applies an effect. The [AvAffecterAoE] is which tiles (centered on the ActionAoE tile selected) to apply the effect to.

In this case, both AoEs use cloneFrom to use common area of effects. Predefined AoEs that you can cloneFrom include:
  • oneTile
  • adjacent
  • adjacent+1
  • adjacent+2
  • adjacent+3 ... + 9
  • adjacentAndSelf
  • adjacentAndSelf+1
  • adjacentAndSelf+2
  • adjacentAndSelf+3 ... +9
  • allParty
  • allActors
  • allAllies
  • allEnemies
Anyway, for now let's edit Brave so it has a 50% chance to grant +2 Magic Attack for 2 turns. To do so, let's add a new [AvAffecter] and [AvAffecterAoE]. That would look like this:

[AvAffecter] ID=c_Kn_Brave; harmful=false; actorValue=MagAtk; magnitude= 2; duration=60; chance=50 - 100* m:tIsRider; visibleMiss=false; FXOnTile=upwardLines_low_overlap; FXOnTileColor=Red; [AvAffecterAoE] ID=c_Kn_Brave; cloneFrom=oneTile;

NOTE: You'll notice that chance isn't just "50", it's "50 - 100 * m:tIsRider". m:tIsRider gives a value of 1 if the target is riding a mount. Because buffs in Kingsvein always affect only the mount and NOT the rider, we use "-100* m:tIsRider" to make this ability unable to hit the rider.

NOTE: This effect lasts two turns, but duration is 60. In Kingsvein, a turn is 30 tics long. So a 2-turn effect should be 60.



Take a look at the other existing actions to get a better understanding for them! They can be found under Data\SystemData\Definitions\actions.

NOTE: 'duration' can also use a special system for indefinite or turn-based timers. The way to do those effects is:
-1 = indefinite.
-2 = instant + permanent.
-3 = until start of next turn.
-4 = until end of next (including current) turn.
-5 = until end of next 2 turns. (use this for abilities that you want to last until end of next turn.)
-6 = until end of next 3 turns, etc...
Creating other types
You can create ActorTypes, ActorClasses, and dialog in the same way as with ItemType. Look in Kingsvein\Content\Data\SystemData\Definitions\actors\ to find the game's normal types and classes.

Create your own by following the format in the original data - or override existing types by using the same ID.

You can also create TerrainTypes of your own by using the in-game TerrainType editor. Once you finish making your new TerrainType in the editor, click the Clipboard button to put the TerrainType's data into your clipboard. Then paste your new TerrainType into your mod file.
Formulas
Formulas are used in Actions, AvAffecters, Triggers, dialog and more. They allow calculating numbers on the fly and have a unique syntax.

Formulas support normal math operations like +, -, /, *, and use standard order of operation rules.

Here are some examples of valid formulas:
2 + 7 * 15 -w:power - c:PhysAtk - c:skill_Sword w:magnitude * 0.9 d:fireDmg:3*2 100 * lessThan:10:t:HP

In addition to normal numbers, formulas can use a selection of hardcoded calculations that are in the format 'prefix:value'.

Here are the most commonly used calculations:
Calculation
Prefix
Possible Values
Example
Caster actor value
c
any ActorValue
c:PhysAtk
Target actor value
t
any ActorValue
t:PhysAtk
Weapon value
w
power, maxRange, weight, throwDamageMod, throwRangePenalty, any valid Element (returns 1 if has specified Element)
w:power
Offhand weapon vaue
w2
power, maxRange, weight, throwDamageMod, throwRangePenalty, any valid Element (returns 1 if has specified Element)
w2:power
Is Actor in Party?
party
actor ID
party:remir
Is Actor alive in the zone?
alive
actor ID
alive:altahn
Support Ability equipped?
sa
Support Ability ID
sa:c_counter
Formula stored in Data
d
any FormulaGlobal
d:iceDmg:2 + d:hammerDmg
Math
m
see Math appendix
m:sameHostile
Global variable
g
any string
g:turnsTaken + g:exampleVariable
Images, Sound, and Music
Images and sound effects will override eachother if they have the same filename. Please use unique filenames to ensure that your files are not overridden by other mods.

Sound effects and music only support .wav format. Music filenames MUST start with "Song-".
Uploading your mod to Steam Workshop
Uploading to Steam Workshop is a very simple process. And don't worry about doing it perfectly the first time - all mod uploads are set to Private by default!
  1. Put all your mod files into a folder in the local Mods directory.
  2. Add a 512x512 .png into that folder with the same name as the folder. (Example: MyMod/MyMod.png)
  3. Open Kingsvein, go the main menu, select Mods, and click the Upload button on your mod.
  4. Enter the name of your mod folder.
  5. Enter tags to describe your mod, such as Gameplay, Items, Location, etc. Each tag should be separated by commas.
  6. Let the upload complete, then click the checkmark to view your mod online!
  7. Edit your mod's description, images, and so on, then set its Visiblity to Public when you're ready.

If you need to edit the contents, preview image, or tags of your mod, you can do so with the other in-game options 'Edit Content' and 'Edit Tags'. You'll have to type in the ID # of your mod to do so.

The ID # is the long number found in your mod's URL. For example, in the Krakenslayer mod: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3156939551
The ID # would be 3156939551.
Appendix: Editable Types
This is a list of all data types that can be created or edited with a text file.

There are also some types not listed that you don't edit directly (for example, Zones contain Actors, Items, and Triggers, but you would create them via the in-game build mode instead of typing them out).

Notes:
  • In addition to these types, mods can also replace textures, sounds, and music.
  • AoE stands for Area of Effect.
  • Reactions are what happens when the type is affected by an Element or ActorValue.
  • AoE, Effect, Reaction, and Light each use standardized formats across types. (Ex: ItemEffect and SupportAbilityEffect use the same format.)

Type
Comment
Can use cloneFrom?
TerrainType
Use the in-game editor for this type.
TerrainLight
TerrainReaction
ActorValue
see ModSamples/ActorValueSample.txt
ActorValueEffect
see ModSamples/ActorValueSample.txt
ActorValueReaction
see ModSamples/ActorValueSample.txt
ActorType
Includes humanoids, monsters, mounts, and wisps
ActorTypeDetectAOE
ActorTypeReaction
AvEffect
ActorTypeLight
ItemType
See ModSamples/items_mod1.txt
ItemEffect
Applied to Actors when the item is equipped.
ItemEffectInWeapon
ItemEffectInArmor
ItemLight
ItemReaction
ItemReactionInWeapon
ItemReactionInArmor
JournalEntry
Used by Items, ActorTypes, and ActorClasses
Zone
Best to use the in-game Zone editor ('build mode')
ZoneMerge
Best to use the in-game Zone editor ('build mode')
DialogNode
DialogOption
DialogNodeOverride
Location
Place/dungeon data that places an entry to a Zone on the overworld
GlobalAoE
Can be cloneFrom'd or used as ActorType.movementType
GlobalTrigger
A trigger that can be called from any Zone or called by Actions
GlobalTriggerEffect
ActorPrefab
'Example' actors that can be placed in build mode or referred to by triggers
ActorClass
Knight, Chisel, etc.
ActorClassReaction
ActorClassEffect
Action
Includes Class abilities, weapon attacks, consumable actions, enemy actions, and more
ActionAoE
AvAffecter
AvAffecterAoE
SupportAbility
SupportAbilityReaction
SupportAbilityEffect
LevelData
Parameters for procedural zones
LevelDataZone
Zone data used by LevelData
SetPiece
Defines a Zone as a re-usable SetPiece, often placed by LevelData
FormulaGlobal
See ModSamples/FormulaGlobalSample.txt
FXData
See ModSamples/FXsamples.txt
drawOrderFX
See ModSamples/FXsamples.txt
drawOrderFXLight
See ModSamples/FXsamples.txt
SpawnData
Data for spawning groups of actors
SpecialSpawn
spawns items/terrain according to special rules
Animation
See ModSamples/AnimationSample.txt
Keyframe
Appendix: Area of Effect ShapeTypes
When creating an Area of Effect, you can choose a specific shape from these options. It's best to specify the name (shape=line;) but the number also works (shape=2;).

If you are using plus, you can make it a square by adding 0.5 to the maxRange. (Ex: 1.5 reaches all 8 squares surrounding the center.)

Number
Shape
Comment
0
plus
Default shape. Ignores moveCost of items/terrain.
1
walkpath
Movement shape that uses pathfinding. Accounts for moveCost of items/terrain.
111
walkpathShape_straightLinesPlus1
As walkpathShape but reaches 1 less in non-straight lines.
112
walkpathShape_straightLinesPlus2
As walkpathShape but reaches 2 less in non-straight lines.
2
line
Straight line.
3
wideLine
Straight line, but 3 tiles wide.
4
circle
As plus, but rounds off the edges of squares.
5
player
Only the player's tile.
6
playerParty
All tiles with the player's party in them.
66
allButPlayerParty
All tiles with Actors that aren't in the player's party.
7
allActors
All tiles with Actors.
17
allActors_nonIncapped
All tiles with Actors that aren't incapped.
8
allTiles
All tiles in the zone. This usually lags too much to be usable.
10
useWeaponAoE
Inherits all properties of the caster's weapon's Action AoE. Individual properties can be overriden.
11
useWeaponAVAoE
Inherits all properties of the caster's weapon's primary AvAffecter AoE. Individual properties can be overriden.
25
diagonalX
Tiles in an X shape, diagonal from the origin.
castersNextDelayedSpell
All tiles that are in the caster's next delayed ability
Appendix: Elements (1 / 2)
Here is a complete list of all Elements as of v1.062, some with notes on their function. Elements are used to cause Reactions on items, actors, and terrain.

Some Elements are unused, despite not being commented as such.


Element
Comment
any
none
never
physical
magic
melee
ranged
use
examine
applied by LOOKing
slash
smash
heavySlash
unused
heavySmash
unused
lightSmash
for things that are less than physical, but still break fragile items
bash
used by "AI Wants To Bash This Tile" item, and only on Knight's Bash or actions that behave like it (shield bashes, Barge)
arcshot
explode
used by Pyreclots and other heavy explosives
mech
used by machinery/devices/switches
mech2
pickaxe
dig
digDown
unused
spiralDigger
clearSpiralHoles
growth
wither
unused
bury
focus
unused
prayer
unused
fire
thaw
melts icy objects
spreadFire
catalyze
transforms blood into oil
desecrate
transforms blood into ice and deal dmg on ice
heat
for fire effects on terrain such as melting ice, but doesn't ignite bombs, wood, etc. or cause player elemental rxns
ice
water
deepwater
for deep water terrain
abyss
for abyss terrain
submerge
applied to items that fall into water (see action itemFall_water)
elec
fakeElec
unused
spreadArcwile
used by Arcwile plants
gilg
used to pour gilg
earth
geo
wind
life
heal
MPheal
ruin
fireMelee
iceMelee
elecMelee
ruinMelee
spikes
damage dealt by spikes item
acid
poison
oil
HPbased
breakItem
shatter
the Chisel ability 'Shatter'
strikeCall
used by Strike!
strikeMe
used by Strike!
shootCall
used by Shoot!
shootMe
used by Shoot!
grounded
used by grounded passive
mounted
applied when mounted to both the rider and the mount
dismounted
applied when dismounted, either by force or not
nonAttack
used by 'weapons' that do not attack (unloaded crossbow, etc.)
weapon
sword
dagger
fist
axe
hammer
flail
spear
bow
aim
shield
whip
cannon
unused
javelin
axe_throw
unused
dart
unused
kindle
makes fires last longer
extinguish
ends fires
sharpen
upgrades spikes & fangs
ruinTouch
does extra damage based on negative statuses
dispel
removes magical hazards
bonemeld
unused
wispImmune
wisps are immune to things with this element
antiMachine
unused
antiUndead
unused
failsOnUndead
does nothing to undead
mechanistAbil
unused
weaponAugment
damage from a weapon augment
clearHazardAndBuffItems
clears hazards and buff items
clearHazards
clears only hazards that are bad to stand on
pressurePlateDown
when someone stands still on a tile (fires repeatedly) Triggers CANNOT use this as their 'triggeredByElement' value.
pressurePlateUp
pressureMove
when someone moves adjacent to an object. Triggers CANNOT use this as their 'triggeredByElement' value.
pressureMoveAcross
when someone moves into OR out of a tile. Triggers CANNOT use this as their 'triggeredByElement' value.
pressureJumpAcross
when someone jumps into OR out of a tile.
pressureMoveTo
when someone moves ONTO an object. Triggers CANNOT use this as their 'triggeredByElement' value.
elementwalker
for walking through fire, acid, etc
firewalker
for walking through fire
elementwalker_status
for walking through fire, acid, etc
itemEquipped
applied to an item when it is equipped on an actor
itemCombined
called when the item that possesses this rxn element is successfully combined
actionStarted
called on an item after its action has been started (same as actionUsed but happens instantly)
actionUsed
called on an item after its action has been used (Ex: crossbow reacts after it is fired)
timerUp
called on an item when its timer has run out (timers are initiated by items with timer special properties) timerUp is also called on the start of a combat turn.
weaponBuff
adds the action when a weapon attack is used
appliedWeaponBuffs
caster reacts with this when weaponBuffs are applied
spellBuff
adds the action when a 'spell' attack is used
appliedSpellBuffs
caster reacts with this when spellBuffs are applied
spellstrike
appliedSpellstrike
holyKnightBuff
used by Zavarde's Holy Knight trait
spearBanner
used by Spear Banner passive
combatStart
called on the start of combat (used with Support Abilities/actorType rxns, and with triggers)
combatEnd
called on the end of combat (used with Support Abilities/actorType rxns)
combatLost
called on losing a combat (used with triggers)
combatWon
called on winning a combat (used with triggers)
gameOver
called when the game would normally game over (used with triggers)
Appendix: Elements (2 / 2)
Element
Comment
tileReacted
for items; called when the tile beneath the item changes ID
itemReacted_timerUp
called when an item on that tile reacts via timerUp, so that any "X" items are cleaned up
itemFall
applied if an item is pushed onto a tile. unlike actorFall, does not allow items into normally unoccupiable tiles
actorFall
if a tile has this element reaction, Actors can be pushed into normually unoccupiable tiles and then trigger this reaction
actorFalling
called by the actorFall action itself
actionTaken
called when an actor is the caster in executeAction() on their turn or with a charged/casted ability
noActionTaken
called when an actor takes no action on its turn
noMoveTaken
called when an actor takes no movement on its turn
startTurn
called when actor starts turn
overrideEndTurn
called when actor ends turn, and prevents Element.endTurn from firing. used by Gate: Anchor
endTurn
called when actor ends turn
skipTurn
swapAwayFromTurn
applied to an actor when it is swapped away from to another actor by the player
moveAbilUsed
applied to an actor when it uses an ability that moves (or should move) it
usedMeleeWeaponAtk
applied by certain actions that don't normally proc weaponBuffs, but should cause passives like Man of War to trigger
undoMove
applied to actor when you undo its move (after it is relocated)
daytime
called when time advances to day OR a zone is entered during day
nighttime
called when time advances to night OR a zone is entered during night
nightime
newDay
called on a new day or when you re-enter a zone you haven't been to for a day. Called many times in a row for long stays away
instaBright
used by Flare and Void Beam
brighter
used by items like Void Eye to track light level
darker
used by items like Void Eye to track light level
incapped
called when an actor is incapacitated
enemyKOd
applied to current turn actor when an enemy is KO'd
dodged
applied when a Miss! occurs
blocked
applied when a Blocked! occurs
reloading
for rxns triggered by reloading your weapon
reload
for special actions that automatically reload equipped weapons
repair
for triggers that fix broken items
railway
for use with minecart movementAoE.
spreadRope
unused
removeRope
unused
spreadChain
unused
removeChain
unused
unarmed
specific weapon classification
meleeRangeAim
BreakerWpn
shiftcloakWpn
punchDaggerWpn
hammerDaggerWpn
shieldShotWpn
catchFish
cast by weapon types that can catch fish (i.e. spears)
fistWpn
closeContainer
triggered when a container is manually closed
removeDecay
unused
blood
spawned blood
removeBlood
actions that remove blood items (such as Bloodspike)
spike
damage from spawning spikes - also removes old broken spikes
rockBlastItems
rockBlast
spreadRockBlast
gateAnchorActivate
used by Gate: Anchor
removeGateLightningMarker
used by Gate: Lightning
cutsc_destroy
for cutscene destructions
windAnimate
unused
replaceCapsule
unused
stairs
unused
itemPushed
applied on pushDest when an item is pushed
itemPushed0
applied on pushDest when an item is pushed using angle 0
itemPushed90
itemPushed180
itemPushed270
iWasPushed
applied specifically to an item when it is pushed (not applied to tiles, actors, or other items)
pushedInto
applied by the "pushedInto" action that deals push dmg
pushedInto0
applied by the "pushedInto" action that deals push dmg at angle 0
pushedInto90
pushedInto180
pushedInto270
playerPushingInto
applied when player walks into the object for a bit in travel mode
playerPushingInto0
applied when player walks into the object for a bit in travel mode at angle 0
playerPushingInto90
playerPushingInto180
playerPushingInto270
burst1
used by Clumps
burstSpread1
used by Clumps
burst2
burstSpread2
burst3
burstSpread3
drainWater
unused
overchargeWisp
used by the overcharge Wisp action
blockDestroyed
unused
normalMode
used by Castellan to change forms
swordMode
used by Castellan to change forms
spearMode
used by Castellan to change forms
flailMode
used by Castellan to change forms
burnStatus
unused
decaying
unused
defiler
unused
matched
used by the match items trigger
matchedSelf
openGates
unused
closeGates
unused
gameLoaded
triggers have this applied when a new game is loaded.
zoneLoaded
triggers have this applied when a zone is loaded.
enterZone
applied to all tiles & actors in the zone when entering
leavingZone
applied to all tiles & actors in the zone when leaving
removeShadow
for use with looming items that often have shadows under them.
somethingHappened
for triggers and misc
monsterBeaconUsed
unused
bossMoveTile
used by special markers that allow specific bosses to walk there
Appendix: Formulas - Prefixes
In addition to normal syntax, formulas can have extra prefixes that modify a single value. This is a complete list as of v1.062

Prefix
Syntax
Effect
Example
lessThan
lessThan:#:formula
Return 1 if < #, returns 0 otherwise
lessThan:3:c:PhysAtk
moreThan
moreThan:#:formula
Return 1 if > #, returns 0 otherwise
moreThan:1:cb:HP
is
is:#:formula
Return 1 if = #, returns 0 otherwise
is:100:d:reviveAcc
isNot
isNot:#:formula
Return 1 if not = #, returns 0 otherwise
isNot:20:cDur:poison
between
between:#:#:formula
Return 1 if between (and not equal to) both #
between:2:7:c:HP
min
min:#:formula
Limits formula to # minimum
min:5:c:PhysAtk
max
max:#:formula
Limits formula to # maximum
max:8:t:MagAtk
abs
abs:formula
Returns 'absolute value' (if negative, changes to positive)
abs:c:PhysDef
floor
floor:formula
Lowers to nearest integer
floor:d:d_valiant
ceiling
ceiling:formula
Increases to nearest integer
ceiling:d:mpCostMult_onlyWithCT
round
round:formula
Rounds to nearest integer
round:c:MP
not
not:formula
Return 1 if < or = 0
not:t:MagDef
debug
debug:formula
Outputs the result to the top of the screen
debug:c:PhysAtk
targetXY
targetXY:#X:#Y:formula
Sets the target XY to the given #X and #Y coordinates
targetXY:25:56:geo:fire
casterAsCurrent
casterAsCurrent:formula
Uses the current actor as the caster
casterAsCurrent:c:PhysAtk
targetAsCurrent
targetAsCurrent
Uses the current actor as the target
targetAsCurrent:t:MagAtk
swapCasterTarget
swapCasterTarget:formula
Swaps Caster and Target for calculations. Useful for target-only or caster-only math calcs.
swapCasterTarget:m:tBrokenWeapon
swapCasterMount
swapCasterMount:formula
Swaps Caster and its mount for calculations.
swapCasterMount:c:HP
swapCasterActor
swapCasterActor:actorID:formula
Swaps Caster and the specified actor for calculations.
swapCasterActor:zavarde:c:PhysAtk

NOTE: Prefixes can stack. "swapCasterTarget:abs:moreThan:3:t:PhysAtk" is valid syntax.

NOTE: you can only apply the prefix to a single value- "lessThan:5:c:PhysAtk" works, but "lessThan:5:c:PhysAtk - 2" is going to return a negative number.

In order to have your prefix apply to a more complicated formula, you may need to make a FormulaGlobal and refer to it using "d:" (such as something like "lessThan:5:d:myPhysCalc").
Appendix: Global Formulas
Universally accessible Global Formulas are defined throughout various files as [FormulaGlobal]s and used in Actions, items, triggers, and other things. Some of them are hardcoded instead and are listed here.

They are also frequently modified by other [FormulaGlobal]s - for example, 'supportAbilWpnDmgMult' is modified in c_supports.txt to add certain support abilities' damage multipliers to it.

That makes this list rather incomplete for understanding the actual formula, but here is a list of all the hardcoded formulas regardless:

ID
Formula
supportAbilAllDmgMult
1 + dsa:c_innerEye:d_innerEye
supportAbilWpnDmgMult
d:supportAbilAllDmgMult + timedHitCheck:use * 0.01 - 0.01 * t:backDefense * m:backFacing + dsa:c_opportunist:d_opportunist + dMin0:u_rangedAdept_dmgMult
supportAbilAllDmgMod
0
supportAbilWpnDmgMod
d:supportAbilAllDmgMod + c:fullHPBonusDmg * not:m:targetPercentHPLost + c:nonAdjBonusDmg * m:distance:2 * w:melee
mpCostMod
sa:c_burningFocus + dsa:c_coldFocus:d_coldFocus - c:focus
mpCostMult
1
chargeTimeMod
0
chargeTimeMult
1
mpCostMod_onlyWithCT
0
mpCostMult_onlyWithCT
1
chargeTimeMod_onlyWithMP
0
chargeTimeMult_onlyWithMP
1
swordDmg
dMaxNeg1:swordDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
gswordDmg
dMaxNeg1:swordDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
fistDmg
dMaxNeg1:fistDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
wpnDmg
dMaxNeg1:wpnDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
hammerDmg
dMaxNeg1:hammerDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
flailDmg
dMaxNeg1:flailDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
spearDmg
dMaxNeg1:spearDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
javelinDmg
dMaxNeg1:javelinDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
bowDmg
dMaxNeg1:bowDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
aimDmg
dMaxNeg1:aimDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
shieldDmg
dMaxNeg1:shieldDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
swordDmg0
-w:Power - c:PhysAtk - c:skill_Sword+ t:PhysDef
fistDmg0
-w:Power - c:PhysAtk - c:skill_Fist+ t:PhysDef
wpnDmg0
-w:Power - c:PhysAtk + t:PhysDef
hammerDmg0
-w:Power - c:PhysAtk * 1.5 - c:skill_Hammer + t:PhysDef
flailDmg0
-w:Power - c:PhysAtk - c:skill_Flail+ t:PhysDef
spearDmg0
-w:Power - c:PhysAtk - c:skill_Spear+ t:PhysDef
javelinDmg0
-w:Power - c:PhysAtk - c:skill_Spear+ t:PhysDef
bowDmg0
-w:Power - c:PhysAtk - c:skill_Bow+ t:PhysDef
aimDmg0
-w:Power - c:PhysAtk - c:skill_Aim+ t:PhysDef
shieldDmg0
-w:Power - c:PhysAtk*0 - c:skill_Shield*0 + t:PhysDef
physDefPercent
1
physicalAcc
100 * c:Acc - t:PhysEva
physicalAccWpn
100 * c:Acc - t:PhysEva + d:supportAbilWpnAccMod
supportAbilWpnAccMod
0
swordAcc
d:physicalAccWpn
fistAcc
d:physicalAccWpn
hammerAcc
d:physicalAccWpn
flailAcc
d:physicalAccWpn
spearAcc
d:physicalAccWpn - sa:c_spearBanner * m:sameHostile * 999
bowAcc
d:physicalAccWpn
aimAcc
d:physicalAccWpn
shieldAcc
d:physicalAccWpn
magDefPercent
1
supportAbilMagDmgMult
d:supportAbilAllDmgMult + dsa:c_massacre:d_massacre
supportAbilMagDmgMod
d:supportAbilAllDmgMod
supportAbilFireDmgMod
dsa:c_drawPower:d_geomancy_fire + dsa:c_warmage:d_warmage
supportAbilIceDmgMod
dsa:c_warmage:d_warmage
supportAbilElecDmgMod
dsa:c_warmage:d_warmage
supportAbilWindDmgMod
0
supportAbilLifeDmgMod
0
supportAbilGeoDmgMod
0
supportAbilRuinDmgMod
dsa:c_drawPower:d_geomancy_ruin + dsa:c_warmage:d_warmage
reviveAcc
100 * m:incapped * m:sameHostile
reviveAccPlayerBias
100 * m:incapped * m:sameHostileOrPlayerControllable
supportAbilFireDmgMult
1
... same for Ice, Elec, Wind, Life, Geo, and Ruin
d_geomancy_fire
max:2:geo_visuals:fire:1
... same for Ice, Elec, Wind, Life, Geo, and Ruin
fireDmg
dMax0:fireDmg0:x * d:magDefPercent * d:supportAbilMagDmgMult * d:supportAbilFireDmgMult
... same for Ice, Elec, Wind, Life, Geo, and Ruin
fireDmg0
-c:MagAtk - x - c:skill_Fire + t:MagDef - d:supportAbilMagDmgMod - d:supportAbilFireDmgMod
... same for Ice, Elec, Wind, Life, Geo, and Ruin
fireDmgWpn
dMax0:fireDmgWpn0:x * d:magDefPercent * d:supportAbilWpnDmgMult * d:supportAbilFireDmgMult
... same for Ice, Elec, Wind, Life, Geo, and Ruin
fireDmgWpn0
-c:MagAtk - x - c:skill_Fire + t:MagDef - w:power - d:supportAbilMagDmgMod - d:supportAbilFireDmgMod
... same for Ice, Elec, Wind, Life, Geo, and Ruin
magicDmgDisplay
dMin0:magicDmg0Display:x
fireDmgDisplay
dMin0:fireDmg0Display:x
... same for Ice, Elec, Wind, Life, Geo, and Ruin
magicDmg0Display
c:MagAtk + x
fireDmg0Display
c:MagAtk + x + c:skill_Fire
... same for Ice, Elec, Wind, Life, Geo, and Ruin
fireAcc
100 + c:skill_Fire - d:tMagicEva
... same for Ice, Elec, Wind, Life, Geo, and Ruin
lifeDmgPhys
dMax0:lifeDmgPhys0:x * d:supportAbilMagDmgMult * d:supportAbilLifeDmgMult
lifeDmgPhys0
-c:PhysAtk - x - c:skill_Life + t:PhysDef - d:supportAbilMagDmgMod - d:supportAbilLifeDmgMod
lifeDmgPhysDisplay
c:PhysAtk + x + c:skill_Life
geoDmgPhys
dMax0:geoDmgPhys0:x * d:supportAbilMagDmgMult * d:supportAbilGeoDmgMult
geoDmgPhys0
-c:PhysAtk - x - c:skill_Geo + t:PhysDef - d:supportAbilMagDmgMod - d:supportAbilGeoDmgMod
geoDmgPhysDisplay
c:PhysAtk + x + c:skill_Geo
Appendix: Unused Global Formulas
These old formulas are completely unused:

ID
Formula
darkAccPenalty
m:dark * 25 * dMin0:darkAccPenaltyApplies
darkAccPenaltyApplies
1 - c:sight - c:blind
rapierDmg
dMaxNeg1:rapierDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
daggerDmg
dMaxNeg1:daggerDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
daggerDmg_offhand
dMaxNeg1:daggerDmg0_offhand * d:physDefPercent * d:supportAbilWpnDmgMult
fistDmg_offhand
dMaxNeg1:fistDmg0_offhand * d:physDefPercent * d:supportAbilWpnDmgMult
axeDmg
dMaxNeg1:axeDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
whipDmg
dMaxNeg1:whipDmg0 * d:physDefPercent * d:supportAbilWpnDmgMult - d:supportAbilWpnDmgMod
rapierDmg0
-w:Power - c:PhysAtk - c:skill_Sword+ t:PhysDef
daggerDmg0
-w:Power - c:PhysAtk - c:skill_Dagger + t:PhysDef
daggerDmg0_offhand
-w2:Power - c:PhysAtk - c:skill_Dagger + t:PhysDef
fistDmg0_offhand
-w2:Power - c:PhysAtk - c:skill_Fist+ t:PhysDef
axeDmg0
-w:Power - c:PhysAtk - c:skill_Axe+ t:PhysDef
whipDmg0
-w:Power - c:PhysAtk - c:skill_Flail+ t:PhysDef
gswordAcc
d:physicalAccWpn
rapierAcc
d:physicalAccWpn
daggerAcc
d:physicalAccWpn
whipAcc
d:physicalAccWpn
axeAcc
d:physicalAccWpn
magicDmg
dMax0:magicDmg0(x) * d:magDefPercent * d:supportAbilMagDmgMult
magicDmg0
-c:MagAtk - x + t:MagDef - d:supportAbilMagDmgMod
magicDmgWpn
dMax0:magicDmg0(x) * d:magDefPercent * d:supportAbilWpnDmgMult
magicDmgWpn0
-c:MagAtk - x + t:MagDef - d:supportAbilMagDmgMod - w:power
magicAcc
100 - d:tMagicEva
magicProjectileAcc
c:Acc * 100 - d:tMagicEva - t:PhysEva - d:darkAccPenalty
magicAccFacing
100 - d:tMagicEva
tMagicEva
t:MagEva - t:MagEva * t:itchy * sa:soulpierce