Scenario Generator

by wizviper

HTML

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<p id='text'>

</p>
<h2 id='header'>
# Of Players
</h2>

<input type='text' id='userInput'/>
<br>
<input type='submit' id='submit' class='btn btn-primary'/>

CSS

#header {
  text-align:center;
}
#userInput {
  position:absolute;
  left:30%
}
#submit {
  position:absolute;
  left:35%;
  width:25%;
  top:20%;
}

JavaScript

document.getElementById("submit").addEventListener("click", function() {
  generate();
})

var settings = [
'in a field',
'in a town',
'in a city',
'on the moon',
'on mars',
'in the pacific ocean',
'in a post-apocalypse',
'in a kingdom',
'in a futuristic city',
'in siberia',
'in a desert'
];
var traits = [
'with a bad temper',
'who gets scared easily',
'who is crippled and cant walk',
'who cries milk',
'that dabs uncontrollably',
'whos family was murdered',
'who is a pathological liar',
'that is greedy'
];
var people = [
'a police officer',
'a soldier',
'a doctor',
'a lawyer',
'Bear Grylls',
'a youtuber',
'a truck driver',
'a computer programmer',
'a monkey',
'a dinosaur',
'a cyborg',
'a zombie',
'a soccer player',
'a newborn infant'
];
var equipment = [
'a sword',
'a shotgun with 6 shells',
'a car with half a tank of gas',
'a rabid hamster',
'a boat',
'a life jacket',
'a pistol with 10 bullets',
'a sniper rifle with 8 bullets',
'an assault rifle with 24 bullets',
'a laser rifle with 16 laser cells',
'metal armor',
'combat armor',
'night vision goggles',
'2 grenades',
'a rocket launcher with 3 rockets',
'2 packs of c4',
'a pack of wolves',
'a horse',
'a medkit with 2 uses',
'an antidote',
'a bow with 8 arrows',
'a virus',
'a vial of poison',
'a crossbow with 12 bolts',
'a grappling hook,'
];

function generate() {
var players = document.getElementById('userInput').value;
document.getElementById('submit').style = 'visibility:hidden;'
document.getElementById('userInput').style = 'visibility:hidden;'
document.getElementById('header').style = 'visibility:hidden;'
var setting = settings[Math.floor(Math.random() * (settings.length ))];
var player1equip1 = equipment[Math.floor(Math.random() * (equipment.length  ))];
var player1equip2 = equipment[Math.floor(Math.random() * (equipment.length  ))];
var player2equip1 = equipment[Math.floor(Math.random() *(equipment.length))];
var player2equip2 = equipment[Math.floor(Math.random() *(equipment.length))];
var player1trait1 =...