Skip to content

Instantly share code, notes, and snippets.

@Suor
Created September 27, 2023 05:17
Show Gist options
  • Save Suor/a43ff60709e7f0d3ffd1f14e87541792 to your computer and use it in GitHub Desktop.
Save Suor/a43ff60709e7f0d3ffd1f14e87541792 to your computer and use it in GitHub Desktop.
Dev Console Cheatsheat
// Cycle bros
local bros = World.getPlayerRoster().getAll();
foreach (bro in bros) {
logInfo(bro.getName());
// ...
}
// Add skill to a bro
local bro = ::getBro("Hubert")
local trait = this.new("scripts/skills/traits/master_trait");
bro.getSkills().add(trait);
// Fix/break items in stash
local items = World.Assets.m.Stash.getItems();
foreach (item in items) {
if ("setCondition" in item) item.setCondition(item.getConditionMax() - 1);
}
// Find enemies in combat by name
local name = "Brigand Headshot";
local ops = getBro().getAIAgent().getKnownOpponents();
ops = ops.map(@(r) r.Actor).filter(@(_, a) a.getName() == name);
std.debug(ops);
// reroll all hires
local towns = this.World.State.m.Entities.m.Settlements;
foreach (town in towns) {
this.logInfo(town.getName());
town.resetRoster()
town.updateRoster()
}
// reroll hires in a city
local town = ::getTown("Quadim");
town.resetRoster()
town.updateRoster()
// reroll hires in a nearest city
local towns = this.World.EntityManager.getSettlements();
local playerTile = this.World.State.getPlayer().getTile();
local town, distance = 99999;
foreach (i, t in towns) {
local d = t.getTile().getDistanceTo(playerTile);
if (d < distance) {distance = d; town = t}
}
::logInfo("Nearest town is " + town.getName());
town.resetRoster()
town.updateRoster()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment