TypeScript type definitions for Infinity Engine scripting, for use in TBAF and TD.
Provides branded types, object specifiers, IDS constants, and typed action/trigger function declarations for IDE autocompletion and type checking.
pnpm install @bgforge/iets
A .tbaf source file using IETS types. Top-level if blocks are transpiled to IF / THEN / END BAF blocks; all imports resolve to typed declarations and emit nothing at runtime.
import { LOCALS } from "@bgforge/iets";
import {
FaceObject, Global, LastSeenBy, LevelLT, Myself, NearestEnemyOf, Player1,
ReallyForceSpell, ReallyForceSpellRES, See, SetGlobal, SmallWait, StartDialog,
WIZARD_ARMOR, WIZARD_SHIELD,
} from "@bgforge/iets/bg2";
const LVAR_doomed = "doomed";
const LVAR_castSpellTrigger = "castSpellTrigger";
// First talk, then fight
if (See(Player1) && Global(LVAR_doomed, LOCALS, 0)) {
SetGlobal(LVAR_doomed, LOCALS, 1);
FaceObject(Player1);
SmallWait(8);
StartDialog("WM_RHIA", Player1);
}
/* Result:
IF
See(Player1)
Global("doomed", "LOCALS", 0)
THEN
RESPONSE #100
SetGlobal("doomed", "LOCALS", 1)
FaceObject(Player1)
SmallWait(8)
StartDialog("WM_RHIA", Player1)
END
*/
See Getting Started, Examples and Type system for more.