Skip to main content

Overview

OptionManager is a global singleton that stores all configurable game-mode options as a flat key–value table. Other modules read and write options through two functions: GetOption and SetOption. The module is designed to be safe to require multiple times — a guard at the top prevents re-initialisation:
if not OptionManager then
    OptionManager = OptionManager or {
        options = {}
    }
end

API

OptionManager:GetOption(optionName, default)

Returns the current value of optionName. If the key has never been set, returns default (or 0 when no default is provided).
function OptionManager:GetOption(optionName, default)
    if OptionManager.options[optionName] ~= nil then
        return OptionManager.options[optionName]
    end
    return default or 0
end
Examples:
-- Check whether anti-rat is enabled
if OptionManager:GetOption('antiRat') == 1 then
    -- ...
end

-- Read neutral multiply with a fallback
local mult = OptionManager:GetOption('neutralMultiply', 1)

-- Read the map name
local map = OptionManager:GetOption('mapname')

OptionManager:SetOption(optionName, newValue)

Writes newValue into the option store.
function OptionManager:SetOption(optionName, newValue)
    OptionManager.options[optionName] = newValue
end
Examples:
-- Enable anti-rat after a successful vote
OptionManager:SetOption('antiRat', 1)

-- Double neutral creep spawns
OptionManager:SetOption('neutralMultiply', 2)

-- Store the current map name on init
OptionManager:SetOption('mapname', GetMapName())

-- Unlock the ingame hero builder
OptionManager:SetOption('allowIngameHeroBuilder', 1)

Default option values

All defaults are written once during the first require('optionmanager') call (guarded by OptionManager.initialSettings).

Timing

KeyDefaultDescription
maxOptionSelectionTime300Max seconds for option selection
maxOptionVotingTime30Max seconds for option voting
banningTime90Duration of the ban phase (seconds)
heroBanningTime60Duration of the hero ban phase
pickingTime180Duration of the pick phase
randomSelectionTime120Time to review random builds
reviewTime15Post-pick review time

Skill slots

KeyDefaultDescription
maxSlots6Total ability slots
maxSkills6Max normal abilities
maxUlts2Max ultimates (always rightmost slots)
startingLevel1Hero starting level
maxHeroLevel30Maximum hero level

Game modifiers

KeyDefaultDescription
bonusGold0Bonus gold awarded to players
useEasyModetrueEnable easy mode
wtfModefalseNo cooldowns or mana costs
freeScepterfalseGive everyone a free Aghanim’s
useLevel1ultsfalseUltimates start at level 1
fullPriceSellbackfalseFull gold refund on item sell
multicastMadnessfalseMulticast Madness mutator
useFatOMeterfalseFat-O-Meter tracking
allowIngameHeroBuilderfalseIngame hero rebuild panel
goldModifier100Gold income multiplier (%)
expModifier100Experience gain multiplier (%)

Picking rules

KeyDefaultDescription
forceRandomHerofalseForce random hero assignment
forceUniqueSkills0Prevent duplicate skills across picks
uniqueHeroes0Prevent duplicate hero picks
banTrollCombostrueBlock known troll ability combinations
useDraftArraytrueRestrict picks to whitelisted heroes
autoDraftHeroNumber10Heroes auto-allocated in draft mode
maxBans5Maximum ability bans per game
maxHeroBans2Maximum hero bans per game
enableHeroBanningfalseEnable the hero banning phase
hostBanningfalseAllow host to ban without a vote
gamemode1Default gamemode index
balanceMode0Balance mode variant

Mutators

KeyDefaultDescription
fastRunesfalseFaster rune spawns
superRunesfalseSuper Runes mutator
vampirismfalseVampirism mutator
killstreakPowerfalseKillstreak power mutator
cooldownReductionfalseCooldown reduction mutator
explodeOnDeathfalseDeath explosion mutator
goldDropOnDeathfalseGold bag drop on death
resurrectAlliesfalseAlly resurrection mutator
randomLaneCreepsfalseRandom lane creep mutator
noHealthbarsfalseHide health bars
convertableTowersfalseTowers can be converted
memesRedux0Memes Redux mutator
refreshCooldownsOnDeath0Refresh all cooldowns on death
gottaGoFast0Speed mutator
battleThirst0Battle Thirst mutator
3220322 mode

Runtime keys (not pre-seeded)

These keys are written at runtime and have no static default in optionmanager.lua: mapname · antiRat · neutralMultiply · allowIngameHeroBuilder · ingameBuilderPenalty · respawnModifier · respawnModifierConstant · respawnModifierPercentage · buybackCooldownConstant · strongTowers · towerCount · middleTowers · laneMultiply · darkMoon · sharedXP · goldPerTick · neutralItems · banInvis · consumeItems · stacking · turboCourier · extraAbility · globalCastRange · direBotDiff · radiantBotDiff · stupidBots · duplicateBots · botsSameHero · randomOnDeath · lodOptionCrazyWTF

Build docs developers (and LLMs) love