NPC callbacks - WoutProvost/FCNPC-AI GitHub Wiki
Home ▸ Callbacks ▸ NPC callbacks
(npcid, bool:reasonShot, firstTarget)
FAI_OnEncounterStart
- Description: This callback is called when a player gets aggro from an idle NPC.
- Parameters:
npcid
: The ID of the NPC for which the encounter started.bool:reasonShot
: True if the NPC was damaged from afar, false if the player entered the NPC's aggro range or FAI_SetTarget was successfully used.firstTarget
: The ID of the player that took aggro from the idle NPC.- Return values: This callback does not handle returns.
- Notes: Called once during the whole encounter, which is at the start of the encounter.
(npcid, bool:reasonDeath, lastTarget)
FAI_OnEncounterStop
- Description: This callback is called when no valid players are available for the NPC after the encounter started.
- Parameters:
npcid
: The ID of the NPC for which the encounter started.bool:reasonDeath
: True if the encounter stopped because the NPC died, false if the encounter stopped because the NPC was respawned, was destroyed, the target was out of range and FAI_SetAggroRange withcheckForTarget
true was used, the target was an NPC and FAI_SetAllowNPCTargets withcheckForTarget
true was used, FAI_SetTarget with INVALID_PLAYER_ID was used.lastTarget
: The ID of the last player that had aggro from the NPC.- Return values: This callback does not handle returns.
- Notes: Called once during the whole encounter, which is at the end of the encounter.
(playerid, npcid)
FAI_OnPlayerGetAggro
- Description: This callback is called when a player gets aggro from an NPC.
- Parameters:
playerid
: The ID of the player that got aggro from the NPC.npcid
: The ID of the NPC that the player aggroed.- Return values: This callback does not handle returns.
- Notes: Can be called multiple times for different players during the whole encounter.
(playerid, npcid)
FAI_OnPlayerLoseAggro
- Description: This callback is called when a player loses aggro from an NPC.
- Parameters:
playerid
: The ID of the player that lost aggro from the NPC.npcid
: The ID of the NPC that the player lost aggro from.- Return values: This callback does not handle returns.
- Notes:
- Can be called multiple times for different players during the whole encounter.
- A player will lose aggro from an NPC if that player becomes invalid for the NPC, or if the NPC streames out for that player.
- A player will lose aggro if the NPC: dies, is respawned, is destroyed, out of aggro range when FAI_SetAggroRange with
checkForTarget
true is used, or if the target is an NPC when FAI_SetAllowNPCTargets withcheckForTarget
true is used, or if FAI_SetBehaviour withcheckForTarget
true is used.