ACRs
The template's ACR framework: builds that play your profession for you.
An ACR is a build that plays itself: a list of skills with priorities and conditions, which the plugin goes through every tick to pick what to cast next. The template comes with a framework for writing them in Lua, in its acr/ folder, and four builds written with it, in acrs/.
The framework follows the Rust ACRs: the same node builders, node groups and trees, both engines (queued and direct), and a runner that does what the Rust ACR plugin does each tick: pick the target, crowd-control break bars, skip invulnerable targets, auto heal and revive. A Rust build can be ported almost line by line; see Coming from Rust.
How it fits together
acr/ the framework: require("acr")
acr.lua the Acr base class every build extends
builders.lua Skill, WeaponSwap, Evade, Kennel, Cancel
node_group.lua NodeGroup
node_tree.lua NodeTree
runner.lua runs the current build every tick
engine_queued.lua the queued engine
engine_direct.lua the direct engine
util.lua game helpers for conditions
targeting.lua which target to attack, invulnerability and break bars
encounters.lua boss-specific checks
widgets.lua toggles for a build's settings
acrs/ the builds, one file each
acr_registry.lua which builds each profession can pick
config/config.lua every build's settings, under its file name- A build is a class made with
acr.Acr:extend. Itsbuildmethod makes its nodes once, when the build is made. See Writing a build. - A node is one thing the rotation can do: cast a skill, swap weapons, evade, give a pet order, or cut a cast short. Nodes are made with builders such as
Skill(id):skill_range(). See Nodes and builders. - Nodes go in groups with priorities, and groups in trees. Each tick the highest priority node that can run, runs. See Groups and trees.
- The runner calls the build every tick: the rotation with a target, crowd control on break bars, idle out of combat. See The runner.
- An engine checks whether a node can run (on the bar, ready, in range, facing) and sends it to the game at the right moment.
Adding a build
A build takes three changes: its file, its name in the registry, and its settings.
- Put the build in
acrs/, asacrs/<name>.lua. It returns its class. Start from one of the example builds, or from a small build. - Add
<name>to its core profession inacr_registry.lua. The ACR window lists the builds of your character's profession, and remembers your pick per profession. - Add a table of defaults under
<name>inconfig/config.lua. The build gets it assettings, and it's saved like every other setting. A build without settings still needs an empty table.
-- acr_registry.lua
M.BUILDS = {
[professions.ENGINEER] = { "power_mechanist" },
[professions.ELEMENTALIST] = { "condition_evoker", "fire_scepter" },
[professions.MESMER] = { "condition_virtuoso", "heal_chrono" },
}
-- config/config.lua, next to the other builds
fire_scepter = {
signet_of_fire = true,
},Reload the plugin, pick the build in the ACR window and tick Enabled. The window's traits button equips the build's specs, traits and utility_skills; its warning and error icons show what on your bar and in your hands the build doesn't use.
Debugging
Add :dbg() to a builder to print, in the Lua Console, why its node can't run (not on bar, not ready, not in range, and #2 not met...) and when it runs. :dbg_condition() and :dbg_execution() print only one of the two. NodeGroup({ dbg = true }) does the same for every node in a group, and also says when the group's own conditions fail.
self.root = NodeGroup({ dbg = true })
:push(10, Skill(BIG_HIT):skill_range():dbg())Coming from Rust
The framework follows the Rust API, with these differences:
- Every builder method returns a new builder, so one builder can be the base of several nodes without
.clone()(which is still there). .and(...)and.or(...)are:when(fn)and:when_any(fn), sinceandandorare Lua keywords.:enabled(fn), or:enabled(settings, "key")to read a settings field. Rust'sskill_range_with(r)andskill_radius_with(r)are also:skill_range(r)and:skill_radius(r).Evade,KennelandCancelhold their kinds:Evade(Evade.MOUSE),Kennel(Kennel.SKILL_1, id),Cancel(id, Cancel.STOW).- A build's nodes go in
self.root(a group or a tree),self.cc_groupandself.idle_group. Rust's legacy engine is the direct engine here:direct = truepicks it, andself.executor = acr.engines.direct:with_cd(70)gives a build its own executor (Rust'sLegacyNodeExecutor::with_all(70)). Overriderotation,idle,handle_no_target... as in Rust. - kerosine's helpers are in acr.util (
util.ready_on_bar,util.cooldown,util.Timer,util.face_target...), the boss checks inacr.encounters, andacr.widgets.skill_toggledraws a build's toggles.
Not there yet: the virtual skill bar (only skills on the bar are cast), the encounter-specific ground target spots and Qadim's height fix, mounts (no Lua call says whether the player is mounted), underwater cast times, the ACR Builder (custom builds) and equipping revenant legends.