Reference

Command line tools

The devkit's and the game's command-line options for modders, and the tools beside them - rta-qsc for level scripts, rta-cook for the game's caches and rta-race-export for the races' models as glTF, with its axes, units and bone names.

Most modding is done in the devkit, but a few jobs are quicker from a command line: checking every script of a mod, redoing the game's caches, or exporting the races' models to animate in Blender.

The devkit

RTNDEVKIT [--mods <mods dir>] [--cache <data/cache>] [--disc <iso or extracted disc dir>]
Option Does
--mods <dir> The mods folder (default: mods beside the game)
--cache <dir> The game's converted data (default: data/cache)
--disc <path> The disc image or an extracted disc folder, instead of the one in settings.ini
--version Prints the version and exits

The game

Option Does
RTN --recook Converts everything again: the disc cache and the enabled mods' caches (normally only a cache that changed is)
RTN --norrath Skips the launcher and starts Return to Norrath
RTN --mods <dir>, --iso <image>, --data <dir> Another mods folder; another disc image, or an extracted disc folder
RTN --level <NAME> [--play] Opens a level, optionally playing it, with the Developer Tools
RTN --model <name> Opens the model viewer on a model
RTN --version Prints the version and exits

The game writes what it used and what failed to rtanative.log in its data folder: see Testing.

rta-qsc: level scripts

Compiles, converts and checks QuestScript and Pawn:

rta-qsc compile <in.qs> [-o out.scr]           compile (includes are read beside the file)
rta-qsc convert <in.scr> [-o out.qs]           a script.scr to QuestScript, checked against the original
rta-qsc decompile <in.scr> [-o out.qs] [--asm] the same without the check (--asm: every function as asm)
rta-qsc verify <original.scr> <script.qs>      does the .qs run as the original?
rta-qsc disc <disc image> <out dir>            every level script on the disc, converted

Tip After editing scripts in a text editor, rta-qsc compile each one to see its errors with their line and column, as the Script Editor shows them.

The Script Editor's All levels tab converts every level into a mod at once; see Script Editor.

rta-cook: the game's caches

The game converts your disc into its caches by itself at startup. rta-cook is a developer front end to the same code:

rta-cook --iso <your disc image> [--out <cache dir>] [--mods mods] [--jobs N]
         [--uncompressed] [--no-mips] [--verify] [--filter <substring>] [--force] [--levels]
Option Does
--out <dir> Where the disc cache goes; each mod's cache goes beside it in cache-mods/
--mods <dir> The mods folder (default mods); each mod's cache is converted only if out of date
--jobs N Threads
--levels Also converts every level (normally a level is converted the first time it is opened)
--uncompressed, --no-mips Textures without compression or mipmaps
--verify Checks the compressed textures against the originals
--filter <text>, --force Only the matching entries; convert even if up to date

Warning The caches are made from your disc. Never share them or commit them anywhere.

A mod's own models, textures and clips are cooked by the devkit, not by rta-cook: see Cook and package.

rta-race-export: the races' models

rta-race-export writes each playable race's body model as glTF 2.0, with its skeleton, skin and the race's clips, for making animations in Blender or another tool:

rta-race-export --iso <disc.iso>   (or --data <extracted disc dir>)   [--out <dir>] [--race <code>]...
rta-race-export --iso <disc.iso> --model <archive> <stem>             (any other model, e.g. --model ANT.LMP ant)
                 [--onto <race> --map <file.map> [--thickness <x>] [--meshes <name> <n,n...>]...] [--sounds]

The files are made from your own disc: don't share them. The Model Replacer's Export model (.glb)... writes the same glTF as one file, for any model, from the devkit.

Race codes

Code Race Class
bm, bf Barbarian male, female Barbarian
wem, wef Wood Elf male, female Ranger
hem, hef High Elf male, female Cleric
em, ef Erudite male, female Wizard
dem, def Dark Elf male, female Shadow Knight
vm Vah Shir (male only) Berserker
im Iksar (male only) Shaman

Files per race

<out>/<code>/:

File Holds
<code>.gltf The scene, nodes, mesh, skin, material and animations
<code>.bin The binary buffer (geometry, skin, inverse bind matrices, animation keys)
<code>.png The body texture (skin tone 1)
<code>_bones.tsv The bone table: index, node name, parent index, label, bind position (glTF axes, metres)
  • Mesh: the unarmoured body, as the game draws it with skin tone 1. Hair, beards and armour are separate models and aren't included.
  • Skin: every bone of the race's skeleton (58 to 64), each vertex weighted to up to 4 bones.
  • Bind pose: the skeleton's bind pose. Bind rotations are identity in this engine, so each joint's rest is a translation from its parent.
  • Animations: the race's four character-select clips (<code>_intro1 to 4) and every gameplay clip that fits its skeleton, such as nw_idlea, ohw_walk, ohw_atakseq1. The stance prefixes are nw_ unarmed, ohw_ one-handed, dha_ / dhs_ two-handed, l_ polearm and dw_ dual wield. Linear keys at 60 frames a second.

Axes and units

Game glTF
Up, facing +Z up, facing -Y +Y up, facing +Z
A position (x, y, z) (x, y, z) (x, z, -y)
A rotation (w, x, y, z) (w, x, y, z) (x, z, -y, w)
Units 41.7 to a metre Metres
Time Frames Frame / 60 seconds

The devkit's glTF import uses the same 41.7 units a metre, so a file brought back in comes out at the game's size. Blender's glTF importer turns +Y up back into its own +Z up: with the default settings the model stands up facing Blender's -Y.

Bone names

The disc's skeletons carry no bone names: a bone is only its index. The joints are named bone_<index>, and that index is the bone's identity in the game. Keep the names and the hierarchy when you animate, and the clip maps back to the game's bones by name.

  • Bones are in the game's order, parents before children (bone 0 is the root).
  • Each joint's extras.label (a custom property in Blender) and the _bones.tsv give a label worked out from the hierarchy: root, pelvis, spine:0.5, chest, leg.+x:0, arm.-x:-1 (the hand), neck:0.5, head, tail:3; empty for face and helper bones. +x and -x are the sides.
  • Skeletons differ between races (the Iksar and Vah Shir have tails, the Iksar an extra leg joint), so an animation is made per race code.

Bring a clip back with the Animation Replacer, or polish it in the Animation Editor. For clips made on other skeletons (Mixamo, Unreal...), use the Retarget Studio.

Monsters as races

--onto <race> with --model moves a creature's model onto a playable race's skeleton, so the Race Builder can make it a race that plays all of that race's animations:

rta-race-export --iso <disc> --model FROGLOCK.LMP froglock --onto im --map froglock_on_im.map ^
    --meshes body 0,3 --meshes helmet 1,2 --sounds

Each creature bone the map lists is moved to its race bone, turned to point where the race's limb points and stretched to its length; the vertices follow their skin, and are then skinned to the race's bones. The files land in <out>/<stem>/ beside the creature's own export:

File Holds
<stem>_on_<race>.glb The meshes the creature shows by default, on the race's skeleton, its texture inside
<stem>_on_<race>_mesh<n>.glb Each of the model's meshes alone (a creature's looks: helmets, weapons, pouches...)
<stem>_on_<race>_<name>.glb --meshes <name> <n,n...>: those meshes together
sounds/*.wav --sounds: the archive's samples, for the race's voice

--thickness <x> scales the model across its bones (default: the race's height over the creature's).

The bone map is a text file, one bone per line, by index (the _bones.tsv rows of both exports):

# creature_bone  race_bone  [aim]
0   0          # root
1   1   10     # pelvis, pointing up the spine (bone 10) rather than at a hip
13  16  -      # head: moved and scaled, never turned
18  30         # upper arm
  • aim: the creature bone it points at. Left out: its one listed child (with several, or none, it turns as its parent does). -: moved and scaled only (a foot kept flat, a head kept as it is).
  • Creature bones not listed ride along with the nearest listed bone above them, and give it their skin.
  • Several creature bones may go to the same race bone (shoulder pads onto the collar bone).

The playable-froglock example's tools/froglock_on_im.map is a complete, commented map (Examples).