Skip to content

Instantly share code, notes, and snippets.

@theneosloth
Created January 3, 2013 02:19
Show Gist options
  • Save theneosloth/4440221 to your computer and use it in GitHub Desktop.
Save theneosloth/4440221 to your computer and use it in GitHub Desktop.
Tf2 random item generator
import random
weapon_nouns = ["Bat","Bottle","Fists","Launcher","Knife","Axe","SMG","Kukri","Syringe Gun","Flame Thrower","Sticky Launcher","Huntsman","Saw","Shotgun","Revolver"]
weapon_adjectives = ["Pain","Direct","Charging","Power","Eternal","Black","Crusader's","Back","Steel","Volcano","Persian","Family","Disciplinary","Atomic"]
hat_nouns = ["Hat","Cap","Helmet","Beanie","Fedora","Beard","Earbuds","Bucket","Mask","Head","Gasmask"]
hat_adjectives = ["Fancy","Mining","Football","Towering","Expensive","Detective","Splendid","Last"]
class Item:
def __init__(self):
chance = random.random()
if (chance>0.80):
self.rarity = "Ultra Rare"
elif (chance>0.70):
self.rarity = "Rare"
elif (chance > 0.50):
self.rarity = "Scarce"
elif (chance > 0.10):
self.rarity = "Ordinary"
else:
self.rarity = "Extremely Common"
chance = random.random()
if (chance > 0.60):
self.type = "Hat"
self.adjective = random.choice(hat_adjectives)
self.noun = random.choice(hat_nouns)
else:
self.type = "Weapon"
self.adjective = random.choice(weapon_adjectives)
self.noun = random.choice(weapon_nouns)
self.name = self.rarity + " " + self.adjective + " " + self.noun
while True:
item = Item()
print item.name
@zombiejohn22
Copy link

how do you use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment