Skip to content

Template for getting started with Age of Empires 4 TypeScript modding

Notifications You must be signed in to change notification settings

aoemods/aoe4-typescript-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Age of Empires 4 TypeScript template

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.

Usage

  1. (Optional) Create an AOE4 mod with the modding tools
  2. Clone this repository, then run npm install as with any npm project. Recommended: run npm install @aoemods/aoetypes@latest to update the type definitions
  3. Copy or rename the .env.example file to .env file and set its output path to where you want the generated script to be.
  4. (Optional) Create a new win condition in your AOE4 mod
  5. Set your win condition's script path to the generated script path (same path as in .env)
  6. Run npm run dev which will detect your script changes in scripts/ 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.

Commands

  • npm run dev: Automatically transpiles and copies your scripts whenever you change them
  • npm start: Transpiles and copies your scripts once

If types are broken

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.