Multi-level dungeon generator

This chart uses input variables
Result

{% Currentfloors = 0%}

{% Level = 0%}

{% KC1 = {2d6} %}

ORIGIN:

Roll on "Dungeon origin"

{%if RNF == "Yes"%}

{% Floors = {2d3-1} %}

Number of floors: {$Floors}

{%end%}

ENTRANCES:

Entrance 1 (Connects to Floor 1): Roll on "Dungeon entrance"
{%if {d6} <= 4%}

Entrance 2 (Connects to Floor Roll d{$Floors}): Roll on "Dungeon entrance"

{%if {d6} <= 4%}

Entrance 3 (Connects to Floor Roll d{$Floors}): Roll on "Dungeon entrance"

{%end%}

{%end%}

Keys:

Key #1: Roll on "Untitled - Sun 19 Oct 04:25:59" Key #2: Roll on "Untitled - Sun 19 Oct 04:25:59" Key #3: Roll on "Untitled - Sun 19 Oct 04:25:59" Key #4: Roll on "Untitled - Sun 19 Oct 04:25:59" Key #5: Roll on "Untitled - Sun 19 Oct 04:25:59" Key #6: Roll on "Untitled - Sun 19 Oct 04:25:59" Key #7: Roll on "Untitled - Sun 19 Oct 04:25:59" Key #8: Roll on "Untitled - Sun 19 Oct 04:25:59" Key #9: Roll on "Untitled - Sun 19 Oct 04:25:59" Key #10: Roll on "Untitled - Sun 19 Oct 04:25:59"

{%while Currentfloors < Floors%}

{% Currentrooms = 0%}

{% Roomnumber = 1%}

{% Corridornumber = 1%}

{% Currentfloors = {{$Currentfloors}+1}%}

{%if Difficulty == "1"%}

{% Level = {{$Level}+1}%}

{%end%}

{%if Difficulty == "2"%}

{% Level = {{$Level}+d2}%}

{%end%}

{%if Difficulty == "3"%}

{% Level = {{$Level}+d3}%}

{%end%}

{%if Difficulty == "4"%}

{% Level = {{$Level}+d4}%}

{%end%}

{%if Difficulty == "5"%}

{% Level = {{$Level}+d6}%}

{%end%}

FLOOR #{$Currentfloors} - Depth: {$Level} 

{% Faction1 = {CHART(114250)} %}

{% Faction2 ={CHART(114250)} %}

{% Faction3 ={CHART(114250)} %}

{% Creature1 = {CHART(114250)} %}

{% Creature2 = {CHART(114250)} %}

{% Creature3 = {CHART(114250)} %}

{% Creature4 = {CHART(114250)} %}

{% Creature5 = {CHART(114250)} %}

{% Creature6 = {CHART(114250)} %}

{% Rel1 = {CHART(114329)  } %}

{% Rel2 = {CHART(114329)} %}

{% Rel3 = {CHART(114329)} %}

FACTIONS:

Faction 1: {$Faction1}s, Motive: Roll on "Faction motive"
Relationships: Faction 2: {$Rel1}, Faction 3: {$Rel3}

Faction 2: {$Faction2}s, Motive: Roll on "Faction motive"

Relationships: Faction 1: {$Rel1}, Faction 3: {$Rel2}

Faction 3: {$Faction3}s, Motive: Roll on "Faction motive"

Relationships: Faction 1: {$Rel3}, Faction 2: {$Rel2}

Wandering creatures (d10)

1: Roll on "Number" x {$Creature1}
2: Roll on "Number" x {$Creature2}
3: Roll on "Number" x {$Creature3}
4: Roll on "Number" x {$Creature4}
5: Roll on "Number" x {$Creature5}
6: Roll on "Number" x {$Creature6}
7: Roll on "Number" x {$Faction1} (Faction 1)
8: Roll on "Number" x {$Faction2} (Faction 2)
9: Roll on "Number" x {$Faction3} (Faction 3)
10: Roll twice and combine

FEATURES:

{% Rooms = {3d6} %}

{%if Floorsize == "Small"%}

{% Rooms = {2d6-1}%}

{%end%}

{%if Floorsize == "Large"%}

{% Rooms = {4d6+3}%}

{%end%}

{%while Currentrooms < Rooms%}

{%if {d6} <= 4%}

{%if {d100} <= {$KC1}%}

{% Key = "1" %}

{% KC1 = 0%}

{%else%}

{% Key = "0" %}

{% KC1 = {{$KC1}+d12} %}

{%end%}

Room # {$Roomnumber}:

{% Creature = {CHART(114328)  }%}

Roll on "Room generator"

{% Roomnumber = {{$Roomnumber}+1}%}

{%else%}

Corridor # A-{$Corridornumber}:

Roll on "Hallway generator"

{% Currentrooms = {{$Currentrooms}-1}%}

{% Corridornumber = {{$Corridornumber}+1}%}

{%end%}

{% Currentrooms = {{$Currentrooms}+1}%}

{%end%}

{%end%}

Subcharts

Creatures (d12)

d12 Result

1

{$Creature1}

2

{$Creature2}

3

{$Creature3}

4

{$Creature5}

5

{$Creature6}

6

{$Creature4}

7-8

{$Faction2} (Faction 2)

9-10

{$Faction1} (Faction 1)

11-12

{$Faction3} (Faction 3)

Faction relations (2d6)

2d6 Result

2

War

3-5

Hostile

6-8

Neutral or indifferent

9-11

Friendly

12

Allied

Number (d12)

d12 Result

1-2

d6

3-4

d3

5-6

d4

7-8

2d3

9-10

d6

11

2d4

12

2d6

Faction motive (d10)

d10 Result

1

Hiding from stronger creature

2

Waiting for wounded members to recover

3

Hoarding a resource

4

Protecting young

5

Expanding their territory

6

Scavenging for food or resources

7

Exploring

8

Got trapped/lost in the dungeon and can't leave

9

Following or hunting another creature

10

Guarding passage from intruders