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
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
-- 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
local ent = pills.getMappedEnt(ply)
if IsValid(ent) then
print("Model:", ent:GetModel())
endYou can also get the Pill structure
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
endDifference
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:
| Animatronic | Hook | Description |
|---|---|---|
| Freddy | FH_BlindRageStart | Blind Rage started |
| Bonnie | FH_YoursMineStart | Through Your Mind started |
| Chica | FH_MinePlanted | Cupcake planted |
| Shadow Freddy | FH_SFreddySubmergeIn | Fading into invisibility |
| Golden Freddy | FH_OutworldStart | Outworld Dimension |
See full list: Animatronic abilities →
Jumpscares
A jumpscare is the animatronic's climax action. Intercepting jumpscares is done via:
FH_PlayerShouldJumpscare— can be canceledFH_AnimatronicJumpscare— after a successful jumpscareFH_JumpscareEvent— before freezing the victim
Creating a custom jumpscare
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