Verse Library verse

01 Device

Links a trigger device to an NPC spawner, enabling player interaction to start NPC movement.

verse-library/get-the-navigatable-interface-this-allows-you-to-tell-it-to-move/01-device.verse

# We are creating a script that runs when the game starts.
# This script will hold our logic.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/AI }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Simulation }

# This is our main script structure.
# Think of it as the "Brain" of our island feature.
loot_goblin_behavior := class(creative_device):

    # Wire these up in the UEFN Details panel by selecting your placed devices.
    # Drag your NPC device into the first slot, your trigger into the second.
    @editable
    Goblin : npc_spawner_device = npc_spawner_device{}

    @editable
    Trigger : trigger_device = trigger_device{}

    # This function runs once when the island loads.
    OnBegin<override>()<suspends> : void =
        # 4. CONNECT THE EVENT
        # We want this code to run when someone enters the trigger.
        # TriggeredEvent is the event that fires when a player activates the trigger.
        Trigger.TriggeredEvent.Subscribe(OnTriggerActivated)

    # This function is called when the trigger fires.
    # 'Agent' is the player who walked in.
    OnTriggerActivated(Agent : agent) : void =

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