Custom Unit: Difference between revisions
No edit summary |
(→Setup) |
||
Line 12: | Line 12: | ||
└── scripts | └── scripts | ||
├── battleanimations | ├── battleanimations | ||
│ └── BATTLEANIMATION_NIGHT_STALKER.js | │ └── '''BATTLEANIMATION_NIGHT_STALKER.js''' | ||
├── building | ├── building | ||
│ └── factory.js | │ └── '''factory.js''' | ||
├── units | ├── units | ||
│ └── night_stalker.js | │ └── '''night_stalker.js''' | ||
└── weapons | └── weapons | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 04:50, 12 September 2023
Notice: Modding tutorials assume you know at least the basics of coding or scripting. Commander Wars uses Javascript as the Scripting Language. In case you want to learn more about Javascript, you can check the tutorial here: Derek Banas' Javascript tutorial , purchase O'Reilly's excellent book on the subject JavaScript: The Definitive Guide, or check out W3 Schools Interactive Tutorials
Setup
In this tutorial, you will learn how to create a custom Infantry Unit with double the movement range of normal Infantry and 6000g cost, with the ability to hide, which we will call 'Night Stalker'. The Night Stalker unit can only be attacked by other Infantry Units while hidden.
To start off, create a folder named nightstalker, and inside of it the following folder and file structure:
.
├── mod.txt
└── scripts
├── battleanimations
│ └── '''BATTLEANIMATION_NIGHT_STALKER.js'''
├── building
│ └── '''factory.js'''
├── units
│ └── '''night_stalker.js'''
└── weapons