Random Team Generator keeps freezing

ok so ive been trying to implement the random party generator form archeia's subterranean starfield game but it keeps frezzing right as it starts is party generator loop. I don't know exactly how to explain it but here is a link my project: https://www.dropbox.com/s/f4puh3dy9b2ig4m/Dungeon%20Crawler.zip

the event in the game setup map is in the top left hand corner. can some one please help me figure out wtf is going on with it?
The reason for the freezing is that you don't have a "0" variable included in the event. When you select the "easy" difficulty, it sets the variable to 0, but later in your event, the variable for difficulty is 1-6, and doesn't have 0, this is what I believe to cause the freezing. I managed to fix it by changing the variables in the conditional branches to include 0. This fix the freezing, but the event is now stuck in an endless loop with the text  "Actor was added" over and over again. 

It is a bit late where I am now, so I'll take a look at it again in the morning. Unless it is morning for someone somewhere else, and they'll probably fix it by the time I come back.
I have 3 variables: game.difficulty, enemy.difficulty, and party.setup

party.setup does not need a 0, the zero is there for the common event I call when a player chooses a difficulty.

the freeze is when the loop starts. it has nothing to do with the game.difficulty variable. thanks for looking at it though.

[Edit]

Oh, I see what you were getting at. I switched the variables to where the conditional happened when the party.setup variable was called, and not the game.difficulty variable was called. problem solved. Shaz, you know what to do from here bro.

Original thread: https://forums.rpgmakerweb.com/threads/random-team-generator-keeps-freezing.21634/