QuintinStone's spreadsheet from this thread was incredibly useful in putting this together: viewtopic.php?f=22&t=7810
Code: Select all
items = {}
items["common"] = {
"blooddrop_cap",
"etherweed",
"potion_healing",
"potion_energy",
"bread",
"pitroot_bread",
"rock",
"mudwort",
"falconskyre",
"throwing_knife",
"pellet_box",
"arrow",
"potion_cure_poison",
"potion_cure_disease",
"potion_speed",
"potion_rage",
"quarrel",
"cheese",
"shuriken",
"dart",
"sleep_dart",
"fire_bomb",
"frost_bomb",
"poison_bomb",
"shock_bomb",
"throwing_axe",
"blackmoss",
"potion_resurrection",
"smoked_bass",
"rotten_pitroot_bread",
"rat_shank",
"lizard_stick",
"skull",
"potion_bear_form",
"crystal_flower",
"boiled_beetle",
"borra",
"blueberry_pie",
"crystal_shard_healing",
"cannon_ball",
"crystal_shard_protection",
"crystal_shard_recharging"
}
items["low_tier"] = {
"peasant_cap",
"peasant_tunic",
"peasant_breeches",
"sling",
"branch",
"whitewood_wand",
"xafi_khakis",
"xafi_robe",
"xafi_shemagh",
"tattered_shirt",
"torn_breeches",
"sandals",
"shoes",
"loincloth",
"silk_hose",
"dagger",
"magic_orb",
"blowpipe",
"machete",
"bone_club",
"short_bow",
"crossbow",
"flintlock",
"quarterstaff",
"leather_gloves",
"leather_boots",
"leather_pants",
"round_shield",
"buckler",
"nomad_boots",
"nomad_mittens",
"doublet",
"pointy_shoes",
"conjurers_hat",
"circlet_war",
"flarefeather_cap",
"tattered_cloak",
"hand_axe",
"baton",
"pickaxe",
"leather_cap",
"leather_cuisse",
"leather_brigandine",
"hide_vest",
"tribal_shield",
"makeshift_buckler",
"makeshift_mask",
"makeshift_chestplate",
"makeshift_legplates",
"long_sword",
"cudgel",
"legionary_spear",
"spiked_club",
"tribal_spear",
"zarchton_harpoon",
"rapier",
"lurker_hood",
"lurker_vest",
"lurker_pants",
"lurker_boots",
"embalmers_headpiece",
"embalmers_robe",
"embalmers_boots",
"embalmers_pants",
"ring_mail",
"ring_cuisse",
"ring_gauntlets",
"ring_greaves",
"legionary_helmet",
"rogue_gloves",
"rogue_hood",
"rogue_boots",
"rogue_vest",
"rogue_pants",
"battle_axe",
"two_handed_sword"
}
items["mid_tier"] = {
"reed_gauntlets",
"reed_sabaton",
"reed_cuirass",
"reed_helmet",
"reed_legmail",
"backbiter",
"warhammer",
"great_axe",
"repeater",
"wand_fear",
"stormseed_orb",
"spirit_crook",
"archmage_hat",
"archmage_loafers",
"archmage_scapular",
"archmage_mantle",
"full_helmet",
"plate_gauntlets",
"plate_greaves",
"plate_cuisse",
"plate_cuirass",
"pit_gauntlets",
"bearclaw_gauntlets",
"venom_edge",
"diviner_cloak",
"huntsman_cloak",
"scaled_cloak",
"shaman_cloak",
"spidersilk_cloak",
"bear_pelt",
"lightning_rod",
"fire_torc",
"frostbite_necklace",
"neck_chain",
"jewel_pendant",
"ethereal_blade",
"cutlass",
"bone_blade",
"flail",
"nectarbranch_wand",
"serpent_bracer",
"steel_armband",
"brace_fortitude",
"bronze_brace",
"leafbond_bracelet",
"bracelet_tirin",
"storm_amulet",
"gear_necklace",
"chitin_mask",
"chitin_greaves",
"chitin_mail",
"chitin_cuisse",
"helmet_valor",
"greaves_valor",
"gauntlets_valor",
"cuirass_valor",
"cuisse_valor",
"potion_strength",
"potion_vitality",
"potion_willpower",
"potion_dexterity",
"pearl_shield",
"heavy_shield",
"venomfang_pick",
"fire_blade",
"lightning_blade",
"morning_star",
"poleaxe",
"shaman_staff",
"acolyte_staff",
"spiritwalker_pendant",
"spirit_mirror_pendant",
"nergal_amulet",
"crystal_amulet"
}
items["high_tier"] = {
"mirror_tagelmust",
"mirror_greaves",
"mirror_gauntlets",
"mirror_chestplate",
"mirror_cuisse",
"fire_gauntlets",
"steel_knuckles",
"lightning_bow",
"jeweled_scepter",
"sickle_sword",
"fist_dagger",
"crystal_helmet",
"crystal_gauntlets",
"crystal_greaves",
"crystal_boots",
"crystal_cuirass",
"crystal_shield",
"ax",
"sabre",
"shield_elements",
"meteor_helmet",
"meteor_boots",
"meteor_cuisse",
"meteor_cuirass",
"meteor_gauntlets",
"meteor_shield",
"moonblade",
"scythe",
"bane",
"silver_scepter",
"hand_cannon",
"revolver",
"longbow",
"tome_air",
"tome_earth",
"tome_fire",
"tome_water",
"tome_energy",
"tome_health",
"tome_wisdom",
"assassin_dagger",
"serpent_blade",
"zhandul_orb",
"ancient_claymore",
"meteor_hammer",
"wizards_virge",
"tome_leadership",
"tome_moon"
}
Code: Select all
function getDistRand (mn, mx, power)
local randomDouble = math.random()
local result = math.floor((mn) + (mx + 1 - (mn)) * (math.pow(randomDouble, power)))
return result
end
function getDistRandCurbed (mn, mx, power)
local result
repeat
result = getDistRand (mn - 1, mx, power)
until result ~= (mn - 1)
return result
end
getDistRand (1, 15, 2) -- with 10000 rolls

getDistRand (1, 15, 1) -- with 10000 rolls

getDistRand (1, 15, 0.5) -- with 10000 rolls

getDistRandCurbed() does a similar thing, but reduces the large bias towards returning "1":
getDistRandCurbed (1, 15, 2) -- with 10000 rolls

Hopefully these can be useful to people wanting to put random loot in their dungeon
