Anyone happen to have enough experience with the code to be able to snipe what line(s) make the 'deserters go first first turn of combat' rule?
this.deserters_scenario <- this.inherit("scripts/scenarios/world/starting_scenario", {
m = {},
function create()
{
this.m.ID = "scenario.deserters";
this.m.Name = "Deserters";
this.m.Description = "[p=c][img]gfx/ui/events/event_88.png[/img][/p][p]For far too long you have been dragged from fight to fight, for little pay, terrible meals, and poor prospects. Last night, after being routed from a particularly gruesome conflict, you and a few others have fled. With little more than what you carry on your back, you must now flee your former comrades charged as a deserter.\n\n[color=#bcad8c]Deserters:[/color] Start with three other deserters and decent armor, but lower funds, equipment, and a noble house that wants to hunt you down.\n[color=#bcad8c]First to Run:[/color] Your men always are first to act in the very first round of combat.[/p]"; this.m.Difficulty = 2;
this.m.Order = 101011;
}
function isValid()
{
return this.Const.DLC.Wildmen;
}
function setupBro( _bro, _faction )
{
_bro.setStartValuesEx([
"deserter_background"
]);
_bro.worsenMood(1.0, "Witnessed his company slaughtered");
_bro.worsenMood(1.0, "Was dragged from one bloody battle to the next");
_bro.improveMood(1.5, "Deserted from the army");
_bro.m.HireTime = this.Time.getVirtualTimeF();
_bro.m.Talents = [];
_bro.m.Attributes = [];
_bro.m.Talents.resize(this.Const.Attributes.COUNT, 0);
if (this.Math.rand(1, 100) <= 20)
{
_bro.addHeavyInjury();
}
else if (this.Math.rand(1, 100) <= 33)
{
_bro.addLightInjury();
}
local items = _bro.getItems();
items.unequip(items.getItemAtSlot(this.Const.ItemSlot.Offhand));
local shield = this.new("scripts/items/shields/faction_heater_shield");
shield.setFaction(_faction.getBanner());
items.equip(shield);
if (this.Math.rand(1, 100) <= 25 && items.getItemAtSlot(this.Const.ItemSlot.Head) != null)
{
items.getItemAtSlot(this.Const.ItemSlot.Head).setCondition(items.getItemAtSlot(this.Const.ItemSlot.Head).getConditionMax() * 0.65);
}
if (this.Math.rand(1, 100) <= 20 && items.getItemAtSlot(this.Const.ItemSlot.Mainhand) != null)
{
items.getItemAtSlot(this.Const.ItemSlot.Mainhand).setCondition(items.getItemAtSlot(this.Const.ItemSlot.Mainhand).getConditionMax() * 0.65);
}
items.unequip(items.getItemAtSlot(this.Const.ItemSlot.Body));
local armor;
local r = this.Math.rand(1, 5);
if (r == 1)
{
armor = this.new("scripts/items/armor/mail_hauberk");
armor.setVariant(28);
}
else if (r == 2)
{
armor = this.new("scripts/items/armor/mail_shirt");
}
else if (r == 3)
{
armor = this.new("scripts/items/armor/gambeson");
}
else
{
armor = this.new("scripts/items/armor/basic_mail_shirt");
}
armor.setCondition(armor.getConditionMax() * this.Math.rand(25, 100) * 0.01);
items.equip(armor);
}
function onSpawnAssets()
{
this.World.Assets.getStash().add(this.new("scripts/items/supplies/ground_grains_item"));
this.World.Assets.getStash().add(this.new("scripts/items/supplies/ground_grains_item"));
this.World.Assets.m.BusinessReputation = -150;
this.World.Assets.m.Money = this.World.Assets.m.Money / 3;
}
function onSpawnPlayer()
{
local randomVillage;
for( local i = 0; i != this.World.EntityManager.getSettlements().len(); i = ++i )
{
randomVillage = this.World.EntityManager.getSettlements()[i];
if (randomVillage.isMilitary() && !randomVillage.isIsolatedFromRoads())
{
break;
}
}
local randomVillageTile = randomVillage.getTile();
local navSettings = this.World.getNavigator().createSettings();
navSettings.ActionPointCosts = this.Const.World.TerrainTypeNavCost_Flat;
do
{
local x = this.Math.rand(this.Math.max(2, randomVillageTile.SquareCoords.X - 7), this.Math.min(this.Const.World.Settings.SizeX - 2, randomVillageTile.SquareCoords.X + 7));
local y = this.Math.rand(this.Math.max(2, randomVillageTile.SquareCoords.Y - 7), this.Math.min(this.Const.World.Settings.SizeY - 2, randomVillageTile.SquareCoords.Y + 7));
if (!this.World.isValidTileSquare(x, y))
{
}
else
{
local tile = this.World.getTileSquare(x, y);
if (tile.Type == this.Const.World.TerrainType.Ocean || tile.Type == this.Const.World.TerrainType.Shore || tile.IsOccupied)
{
}
else if (tile.getDistanceTo(randomVillageTile) <= 4)
{
}
else if (!tile.HasRoad || tile.Type == this.Const.World.TerrainType.Shore)
{
}
else
{
local path = this.World.getNavigator().findPath(tile, randomVillageTile, navSettings, 0);
if (!path.isEmpty())
{
randomVillageTile = tile;
break;
}
}
}
}
while (1);
this.World.State.m.Player = this.World.spawnEntity("scripts/entity/world/player_party", randomVillageTile.Coords.X, randomVillageTile.Coords.Y);
this.World.Assets.updateLook(12);
this.World.getCamera().setPos(this.World.State.m.Player.getPos());
local f = randomVillage.getFactionOfType(this.Const.FactionType.NobleHouse);
f.addPlayerRelation(-100.0, "You and your men deserted");
local names = [];
for( local i = 0; i < 3; i = ++i )
{
while (true)
{
local n = this.Const.Strings.CharacterNames[this.Math.rand(0, this.Const.Strings.CharacterNames.len() - 1)];
if (names.find(n) == null)
{
names.push(n);
break;
}
}
}
local roster = this.World.getPlayerRoster();
for( local i = 0; i < 3; i = ++i )
{
local bro = roster.create("scripts/entity/tactical/player");
bro.setName(names[i]);
bro.setPlaceInFormation(3 + i);
this.setupBro(bro, f);
}
local bros = roster.getAll();
bros[0].getBackground().m.RawDescription = "{Prior to his conscription into the army, %name% was a failed, illiterate baker. His poor work and frequent dessert errors made him prone to being pulled into military ranks. Having always hated the life, the deserter was quick to join your cause and company.}";
bros[0].getBackground().buildDescription(true);
local talents = bros[0].getTalents();
talents[this.Const.Attributes.MeleeSkill] = 2;
talents[this.Const.Attributes.Hitpoints] = 1;
talents[this.Const.Attributes.Fatigue] = 2;
local items = bros[0].getItems();
items.unequip(items.getItemAtSlot(this.Const.ItemSlot.Mainhand));
items.unequip(items.getItemAtSlot(this.Const.ItemSlot.Ammo));
items.equip(this.new("scripts/items/weapons/hatchet"));
bros[1].getBackground().m.RawDescription = "{A fine fighter by any judgment, %name% simply hated the low pay of being a soldier in the army. His pursuit of the sellsword\'s life makes sense. Though he is quite flighty, you believe his transient sense of allegiance will be buffered by a steady flow of good coin.}";
bros[1].getBackground().buildDescription(true);
local talents = bros[1].getTalents();
talents[this.Const.Attributes.MeleeSkill] = 2;
talents[this.Const.Attributes.MeleeDefense] = 2;
talents[this.Const.Attributes.Bravery] = 1;
items = bros[1].getItems();
items.unequip(items.getItemAtSlot(this.Const.ItemSlot.Mainhand));
items.unequip(items.getItemAtSlot(this.Const.ItemSlot.Ammo));
items.equip(this.new("scripts/items/weapons/shortsword"));
bros[2].getBackground().m.RawDescription = "{%name% is like many deserters. You can see the spirit of a fighter in him, but the heart for it is withering. It doesn\'t make him a coward, as many assume deserters to be, but instead simply a man who may need change. Hopefully the coin of mercenary work can provide it.}";
bros[2].getBackground().buildDescription(true);
local talents = bros[2].getTalents();
talents[this.Const.Attributes.RangedSkill] = 2;
talents[this.Const.Attributes.RangedDefense] = 1;
talents[this.Const.Attributes.Initiative] = 2;
items = bros[2].getItems();
items.unequip(items.getItemAtSlot(this.Const.ItemSlot.Mainhand));
items.unequip(items.getItemAtSlot(this.Const.ItemSlot.Offhand));
items.unequip(items.getItemAtSlot(this.Const.ItemSlot.Ammo));
items.equip(this.new("scripts/items/weapons/light_crossbow"));
items.equip(this.new("scripts/items/ammo/quiver_of_bolts"));
bros[3].getBackground().m.RawDescription = "You have killed and bled for the gain of a few opulent men for years. Now, you figure its easiest to fight for your own ends.";
bros[3].getSkills().removeByID("trait.greedy");
bros[3].getSkills().removeByID("trait.loyal");
bros[3].getSkills().removeByID("trait.disloyal");
bros[3].getSkills().add(this.new("scripts/skills/traits/player_character_trait"));
bros[3].m.Talents = [];
local talents = bros[3].getTalents();
talents.resize(this.Const.Attributes.COUNT, 0);
talents[this.Const.Attributes.MeleeSkill] = 2;
talents[this.Const.Attributes.Fatigue] = 2;
talents[this.Const.Attributes.Bravery] = 3;
bros[3].setPlaceInFormation(8);
bros[3].getTags().set("IsPlayerCharacter", true);
bros[3].getSprite("miniboss").setBrush("bust_miniboss");
local items = bros[3].getItems();
items.unequip(items.getItemAtSlot(this.Const.ItemSlot.Mainhand));
items.unequip(items.getItemAtSlot(this.Const.ItemSlot.Ammo));
items.equip(this.new("scripts/items/weapons/scramasax"));
}
this.Time.scheduleEvent(this.TimeUnit.Real, 1000, function ( _tag )
{
this.Music.setTrackList([
"music/retirement_02.ogg"
], this.Const.Music.CrossFadeTime);
this.World.Events.fire("event.deserters_scenario_intro");
}, null);
}
});
Id appreciate the help, because I cant find it. This is my prototype for a custom starting scenario based on deserters. But I dont want the 'go first' rule to be in effect.