🌱
The Insurgent's Forge
  • Home
  • Getting Started
    • Setup
    • Resources
  • Overview
    • Configuration
      • Formulas
      • Functions
      • Classes
      • Helpers
      • Assemblies
      • Middlewares
      • Dependencies
      • Options
      • Errors
    • Improvements & Additions
    • Structures & Parameters
    • Formula Workflow
      • Combo
      • Counter
      • Area of Effect
      • Reserve Party Member
      • Reflect
      • Mist
      • Trap
      • Chain Benefit
      • Summon
      • Spawn
      • Gambit
    • Limitations
      • Animations
      • Status Effects & Augments
    • Notes
      • Flags
      • Loops
      • Function in a Function
    • Helpers
      • Add Augment
      • Add Status Effect
      • Apply Knockback
      • Get Active Party Member
      • Get Action Status Effects
      • Get Augment Duration
      • Get Battle Unit Keep
      • Get Battle Unit Keep By Focus
      • Get Battle Unit Work
      • Get Character Max Hp
      • Get Character Max Mp
      • Get Character Type
      • Get Elemental Affinities Match
      • Get Equipment Status Effects
      • Get Forced Poach Rarity
      • Get Forced Steal Rarity
      • Get Formula Proc Keep
      • Get Knockback Range
      • Get Location Mist Strength
      • Get Model Evade Types
      • Get One Hit Kill State
      • Get Random Number
      • Get Reflect Target
      • Get Remedy Status Effects
      • Get Status Effect Duration
      • Get Status Effect Tick Duration
      • Get Status Effects Match
      • Get Terrain Type
      • Get Weather
      • Is Interactable
      • Modify Content
      • Modify Gil
      • Modify Hp
      • Modify Mist Charges
      • Modify Mp
      • Modify Sky Pirates Den Stats
      • Refresh Stats
      • Remove Augment
      • Remove Status Effect
      • Set Level
      • Shift Elements
      • Show Combat Log
      • Show Number Text
      • Teleport Location
  • Support & Updates
    • Changelogs
      • Version 1.0.3
      • Version 1.0.2
      • Version 1.0.1
      • Version 1.0.0
    • Known Issues
    • FAQ
Powered by GitBook
On this page
  • Description
  • Layout
  • Arguments
  • Notes
  1. Overview
  2. Configuration

Functions

Description

The functions directory contains all functions used by formulas. Every function is defined in a separate file and has a unique identifier (e.g. 10).

Each function does one specific task and is usually unique.

For example, one function could check if the target is immune to fire while the other calculates the amount of health the target should lose. Now these functions can of course be summed up in one, but it's best to split as many tasks of a formula into several functions so they can be reused in others.

All functions are processed in a predetermined order. At any point within a function, can the processing of the upcoming functions be cancelled.

So when a caster uses the action Fire on a target, the first function would check whether the target is immune to it and if that's the case, not even process the second function which would calculate the damage.

If you want an action to not have an effect on a target that is immune to fire, you can just add the first function to the start of the formula.

Layout

local function func(formula, caster, target, functions, classes, helpers)
 --your code
end

return func

Arguments

Every formula function is called with 6 arguments by default.

Name
Description

Formula

A metatable with all formula processing relevant information. This includes all properties of the Formula Processing Work structure (e.g. current action, caster / target stats, ...)

Caster

A metatable of the Battle Unit Keep structure of the caster.

Target

A metatable of the Battle Unit Keep structure of the target.

Functions

A table with all predefined formula functions from the functions directory.

Classes

A table with all predefined functions from the classes directory that build metatables to simulate object oriented programming.

Helpers

A table with all predefined functions from the helpers directory that help reuse a block of code after defining it once.

These arguments are described in detail in the following pages.

Notes

There can only be a maximum of 340 (0-> 339) functions.

The function filename doesn't include zero padding. So it's 1.lua and not 001.lua.

PreviousFormulasNextClasses

Last updated 1 year ago