Result
{% _faction = lower input:Faction %}
{# See if we get exactly one match on the main table #}
{% factions = get_chart cols:1 id:103912 %}
{% matches = filter pattern:_faction source:factions %}
{# If we don't have an exact match, try to salvage the situation using the aliases table #}
{%if matches.size != 1%}
{% aliases = get_chart id:104358 %}
{% matches = filter cols:1 pattern:_faction source:aliases %}
{%if matches.size == 1%}
{% _faction = roll_chart cols:2 filter:_faction filter_cols:1 id:104358 %}
{%end%}
{%end%}
{# If we have a match, get our results #}
{%if matches.size == 1%}
{% result = roll_chart cols:2 filter:_faction filter_cols:1 id:103912 %}
{% is_error = filter pattern:result source:[Error] %}
{%if is_error.size < 1 and Name != "(Optional) Unit Name"%}
{% _type = lower input:Type %}
{% is_battlescar = filter pattern:"scar" source:[_type] %}
{$Name} is rolling a {{ if_true condition:{is_battlescar.size>0} else:"Battle Honor" then:"Battle Scar" }}!
{%end%}
{$result}
{# If we have no matches or too many matches, print some helpful text. #}
{%else%}
{%if _faction == "none"%}
Welcome to the Battle Trait roller for Warhammer 40k Crusade!
Please enter the following input_vars:
- Faction: a supported source book or faction from the list below
- Type: unit keyword for the desired Battle Honor table, or "Battle Scar"
- (Optional) Name: a descriptive unit name, such as "Ultramarines Terminator Captain Octavius"
{%else%}
Error while rolling a Battle Trait: Faction "{$Faction}" has no match or too many matches!
{%end%}
Supported factions and sources are: '{{ title input:{{ join sep:"', '" source:factions }} }}'
Partial matches and common alternate/abbreviated names are accepted as long as they match a single result.
"Space Marines" is allowed as a special case because of course it is.
{%end%}
Subcharts
Factions (d15)
| d15 | Source | Result |
|---|---|---|
1 |
core |
Roll on "40k Crusade Core Traits" |
2 |
pariah nexus |
|
3 |
space marines (adeptus astartes) |
|
4 |
adepta sororitas |
|
5 |
adeptus custodes |
|
6 |
adeptus mechanicus |
|
7 |
agents of the imperium |
|
8 |
astra militarum |
|
9 |
chaos space marines |
|
10 |
aeldari |
Roll on "40k Crusade Aeldari Traits" |
11 |
genestealer cults |
|
12 |
necrons |
Roll on "40k Crusade Necrons Traits" |
13 |
orks |
Roll on "40k Crusade Orks Traits" |
14 |
tau |
Roll on "40k Crusade Tau Traits" |
15 |
tyranids |
Roll on "40k Crusade Tyranids Traits" |
Aliases (d9)
| d9 | Alias | Result |
|---|---|---|
1 |
space marines adeptus astartes |
adeptus astartes |
2 |
sisters of battle battle sisters |
adepta sororitas |
3 |
adeptus mechanicus admech |
adeptus mechanicus |
4 |
imperial agents inquisition |
agents of the imperium |
5 |
csm |
chaos space marines |
6 |
gsc |
genestealer cults |
7 |
imperial guard ig |
astra militarum |
8 |
eldar |
aeldari |
9 |
t'au empire tau empire |
tau |