AngelScript
One of JJ2+’s biggest features is AngelScript, as written and maintained by Andreas Jönsson of AngelCode.com. This is an entire scripting language with an immense API that lets you edit huge portions of the game! Here are some quick possibilities to get you excited:
- Change tiles or entire layers
- Change the level palette
- Spawn enemies and other objects out of nowhere
- Design totally new weapons, enemies, and other objects
- Code your own multiplayer gamemodes
- Load and save external files, including new graphics and sounds
- Draw your own HUD
- Add your own info to JJ2+’s ingame Help pages
Kinds of Scripts
There are two kinds of scripts: level scripts, which are attached to specific levels (e.g. a script castle1.j2as that turns bats blue in Dungeon Dilemma), and mutators, which are run by servers and can affect all the levels hosted by that server.
With very rare exception, the two kinds use all the same syntax, functions, and so on. Learning to write one kind of script will transfer over to the other kind, it's just a question of what you want to write.
Warnings
Your script files must all be syntactically correct AngelScript. Any syntax error anywhere will prevent all AngelScript from running. To be told about errors and warnings in the chatlog, set [General]AngelscriptDebug=True in plus.ini.
Most AngelScript functions only run locally, so in multiplayer, you'll need to find ways to sync gameplay among clients. A few properties are synced automatically such as jjTeamScore or the current gamemode, but most other code—individual items, bullets, graphical effects, etc.—needs to be written more carefully, in particular using the jjSTREAM network communication class. Fortunately, in any server, all players run the same code. (Or if you just want to make Single Player levels, there’s nothing to worry about!)
Topic Guides
This section is still in progress! Let us know if you want to request an article on a particular topic, or if you want to write an article!
- Writing a Level Script
- Writing a Mutator
- jjOBJ
- Object behaviors
- jjPLAYER
- Sprite arrays
- Tile IDs
- Strings
- Enums
- jjSTREAM
API
Link to the complete JJ2+ AngelScript API
AngelScript has its own manual for general language syntax. Besides the standard constructs, we offer the string, array, math, and dictionary modules.