-
Notifications
You must be signed in to change notification settings - Fork 21
Hunt modes
Greg edited this page May 15, 2024
·
3 revisions
Hunt modes are used by NPCs to select targets from a collection of nearby Entities. Properties defined in hunt-modes.yml
determines under what conditions entities can be targeted, which entities can be targeted, how often a new target is selected.
Hunt modes are use for mechanics such as aggression and hunter npcs getting caught in traps.
Hunt modes are specified in hunt-mode.yml
:
cowardly: # Name of the hunt mode
type: player # Target entity type
check_visual: line_of_sight # Only select targets that can be seen directly
check_not_too_strong: true # Targets combat level must be less than double of npc
check_not_combat: true # Target can't be in combat
check_not_combat_self: true # NPC can't be in combat
check_not_busy: true # Target can't be doing something
And a hunt mode is assigned to an npc in npcs.yml
:
giant_spider:
id: 59
hunt_mode: cowardly # Hunt mode name
hunt_range: 1 # Check for entities up to 1 tile away
When a valid target is found a hunt event will be emitted:
on<HuntFloorItem>({ it.id == "ash_cleaner" && mode == "ash_finder" }) { npc: NPC ->
npc.mode = Interact(npc, target, FloorItemOption(npc, target, "Take"))
}
Hunt events are:
HuntFloorItem
,HuntNPC
,HuntObject
,HuntPlayer
Note
Read more about hunt modes #307