Skip to content

Animatronics

A quick reference for working with animatronics in Fazbear's Hunt.

How animatronics work

All animatronics in FH are registered using the same method as in Parakeets Pill Pack, but with small adjustments and new features for Pills that give developers more capabilities.

The gamemode defines:

  • Playable — can appear in the selection at the start of a normal round
  • Secondary — can appear in the selection only if there are more than two animatronics

Basic operations

Add an animatronic to the selection

lua
pill_makePreferable("pill_springtrap", true)

Avoid

Avoid dynamically changing an animatronic's playability, as playability can be changed at any time in the Admin Panel.

Make secondary

lua
-- Shadow Freddy now appears in the selection even if there aren't enough animatronics
pill_makeSecondary("pill_sfreddy2", false)

Get a player's animatronic model

lua
local ent = pills.getMappedEnt(ply)
if IsValid(ent) then
    print("Model:", ent:GetModel())
end

You can also get the Pill structure

lua
local ent = pills.getMappedEnt(ply)
if IsValid(ent) then
    if ent.formTable.reload then
		print("Pill has a +reload bind ability!")
	else
		print("Pill does not have a +reload ability")
	end
end

Difference

The gamemode adds a ply:GetPill() function to PlayerMeta, but it directly calls pills.getMappedEnt(ply), so it is recommended to use the latter for optimization.

Reacting to abilities

Use hooks to react to animatronic actions:

AnimatronicHookDescription
FreddyFH_BlindRageStartBlind Rage started
BonnieFH_YoursMineStartThrough Your Mind started
ChicaFH_MinePlantedCupcake planted
Shadow FreddyFH_SFreddySubmergeInFading into invisibility
Golden FreddyFH_OutworldStartOutworld Dimension

See full list: Animatronic abilities →

Jumpscares

A jumpscare is the animatronic's climax action. Intercepting jumpscares is done via:

Creating a custom jumpscare

lua
function simpleJumpscare(ply, ent)
	local target = FindNearestPlayer(ply:EyePos(), 120, ply, 36)
				
	local success = performJumpscare(ply, ent, target, 1.6)

	if success then
		print( "[TEST] Animatronic " .. ply:Nick() .. " jumpscared " .. target:Nick() )
	end
end