Rounds
The round system is the core of Fazbear's Hunt. With update 3.0.0, creating custom round types has become significantly easier.
Registering a round type
fh.RegisterRoundType(name, id, func, [weight], [minPlayers], [maxPlayers]) SERVER
Registers a new round type. Returns the ID and technical name of the round.
Parameters:
| Name | Type | Description |
|---|---|---|
name | string | Technical name of the round in English |
id | int / string | Round ID. If string, automatically converted to a number |
func | function | Function executed when the round starts |
weight | int (opt.) | Chance of occurring (0–100) |
minPlayers | int (opt.) | Minimum number of players |
maxPlayers | int (opt.) | Maximum number of players |
Example:
local id, name = fh.RegisterRoundType("springtrap_madness", "spring_mad", function()
-- Give everyone Springtrap!
for _, ply in player.Iterator() do
giveKiller(ply, "pill_springtrap", true)
end
end, 5, 4, 16) -- 5% chance, 4–16 players
print(id, name) -- 43700 springtrap_madnessRound management
fh.SetRoundTypeBlocked(id, block) SERVER
Blocks a round by ID, preventing the game from selecting it.
-- Block the Springtrap round
fh.SetRoundTypeBlocked(1, true)Getting round information
fh.SetRoundType(number) SERVER
Sets the round type. The mode calls this itself at the start of a round.
Be careful
Use only if you know exactly what you're doing.
fh.GetRoundType() SERVER
Returns the current round type.
| Value | Round type |
|---|---|
0 | Normal |
1 | Springtrap |
2 | Bonnie-Tag |
3 | Infection round with Bear5 |
fh.GetRoundTypes() SERVER
Returns a table with all registered round IDs.
local all = fh.GetRoundTypes()
PrintTable(all)fh.GetRoundTypeByName(name) SERVER
Returns the round ID by its technical name.
local id = fh.GetRoundTypeByName("springtrap_madness")
print(id) -- 12345 (for example)fh.GetRoundTypeNameByNumber(id) SERVER
Inverse function — returns the name by ID.
local name = fh.GetRoundTypeNameByNumber(1)
print(name) -- "springtrap"Round music
fh.AddRoundMusic(num, music) SERVER
Adds a music theme for the start of a specific round type.
Override not possible
Already registered music cannot be overridden.
fh.AddRoundMusic(
fh.GetRoundTypeByName("springtrap_madness"),
"music/my_addon/madness_theme.mp3"
)fh.GetRoundMusic(num) SERVER
Returns the path to the round start music. If no music is found for the specified type, returns the normal round music.
Related hooks
fh_prestartgame— before round selectionfh_startgame— after round selectionfh_poststartgame— after animatronic unfreezefh_postendgame— after round ends
See also: Round hooks →
