Verse Library verse

03 Standalone

Spawns a pet that follows players, emotes when close, and maintains a cheerful mood.

verse-library/verse-npc-sidekick-companion/03-standalone.verse

using { /Fortnite.com/AI }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Playspaces }
using { /Verse.org/Simulation }
using { /Verse.org/SceneGraph }
using { /UnrealEngine.com/Temporary/Diagnostics }

# SIDEKICK COMPANION — a pet that follows you and emotes how it feels.
#
# Sidekicks are NPC companions with their own moods and reactions. You spawn one
# from an NPC Spawner using a Sidekick character definition, then drive it with
# an npc_behavior. The Sidekick API lives on the npc_sidekick_component, which
# you read off the behavior's ENTITY (GetEntity[].GetComponent[...]).
#
# This companion locks onto its owner, follows them around, and plays a Happy
# reaction the moment it catches up — then forces a permanent cheerful mood so
# it never sulks. You cannot BUILD a sidekick_component in Verse (it's
# epic_internal), but once the spawner gives you one, every method here is public.
sidekick_companion := class(npc_behavior):

    # How close the pet tries to get to its owner (centimeters).
    FollowRadius : float = 300.0

    OnBegin<override>()<suspends> : void =
        if:
            Agent := GetAgent[]
            Character := Agent.GetFortCharacter[]
            Entity := GetEntity[]
            # Pull the sidekick component off our own entity.
            Sidekick := Entity.GetComponent[npc_sidekick_component]

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in