GetNPCBehavior

method
(InAgent: agent).GetNPCBehavior<native><public>()<transacts><decides>: npc_behavior

Returns the `npc_behavior` for `InAgent`.

Module
/Fortnite.com/AI
Declared in
AI
Source
fortnite

Used in

SaveSystem / Player Events verse-source
else if (Character := fort_character[Causer]):
                if( NPC := Character.GetAgent[].GetNPCBehavior[]):
                    if (GetGameData().Config.UsingPlayerEvents?.DebugEvents?):
                        ToDiagnostic(log{Channel := log_player_events,  DefaultLevel := log_level.Normal}.Print("Causer is a NPC"))
                    return (causer_source_type.NPC, option{NPC.GetAgent[]})
                if (Player := player[Character]): # Typecast to player
                    if (GetGameData().Config.UsingPlayerEvents?.DebugEvents?):
                        ToDiagnostic(log{Channel := log_player_events,  DefaultLevel := log_level.Normal}.Print("Causer is player {Player}"))
                    return (causer_source_type.Player, option{Player})
                else:
                    if (GetGameData().Config.UsingPlayerEvents?.DebugEvents?):
                        ToDiagnostic(log{Channel := log_player_events,  DefaultLevel := log_level.Normal}.Print("Causer is a character"))
                    return (causer_source_type.Character, option{Character.GetAgent[]})
GuardSystem / Guard Security Controller verse-source
if (AttackerChar := Attacker.GetFortCharacter[]):
                if (not AttackerChar.GetAgent[].GetNPCBehavior[]):
                    # Check if victim is a player
                    if (VictimChar := Victim.GetFortCharacter[]):
                        if (not VictimChar.GetAgent[].GetNPCBehavior[]):
                            set DamageInfo.IsPlayerVsPlayer = true
                        else:
                            # Check if victim is a registered guard
                            if (GuardRegistry[Victim]):
                                set DamageInfo.IsPlayerVsGuard = true
NpcSystem / Npc Data verse-source
NewNPCData := npc_data{
            InAgent := InAgent
            InCharacter := InCharacter
            InBehavior := InAgent.GetNPCBehavior[]
            Navigatable := InCharacter.GetNavigatable[]
            InFocus := InCharacter.GetFocusInterface[]
            InAnimation := InCharacter.GetPlayAnimationController[]
            # Initialize new NPCSessionData
            SessionData := npc_session_data{
                SpawnPoint := InCharacter.GetTransform().Translation
                LastKnownPosition := InCharacter.GetTransform().Translation
            }
            # Initialize new NPCPersistentData
            SavedData := npc_persistent_data{
                NpcName := "Unknown"  # Unknown NPC name set during runtime
                SpawnPoint := InCharacter.GetTransform().Translation
            }