Enables creating Age of Empires 4 mods in TypeScript using TypeScriptToLua.
Uses type definitions from the @aoemods/aoetypes npm package (types also viewable online here).
Join the AoE 4 Modding Discord server if you experience any issues or have questions.
- (Optional) Create an AOE4 mod with the modding tools
- Clone this repository, then run
npm install
as with any npm project. Recommended: runnpm install @aoemods/aoetypes@latest
to update the type definitions - Copy or rename the
.env.example
file to.env
file and set its output path to where you want the generated script to be. - (Optional) Create a new win condition in your AOE4 mod
- Set your win condition's script path to the generated script path (same path as in
.env
) - Run
npm run dev
which will detect your script changes inscripts/
and automatically transpile and copy the generated script over
Now you can open the project in the Age of Empires 4 editor as you would normally while being able to edit the TypeScript scripts.
npm run dev
: Automatically transpiles and copies your scripts whenever you change themnpm start
: Transpiles and copies your scripts once
Since TypeScript support is still experimental you will likely experience incorrect types.
To fix them yourself you can create a type definition file (eg. types.d.ts
in scripts/
) and create your own type definitions in it.
These will automatically get picked up.
Check the existing AoE4 types or
the official documentation for more information
about how to create type definitions.