Verse Library verse

01 Device

Grants cosmetic inventory items to players when they interact with a trigger device.

verse-library/creating-clothing-assets-for-uefn-using-unreal-engine/01-device.verse

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This is a Verse Script attached to an Item Granter or Trigger.
# Note: Verse does not currently expose a direct SetClothing() API for
# MetaHumans. The pattern below uses an item_granter_device to trigger
# a cosmetic swap — the closest real runtime hook available in UEFN.
stealth_hoodie_granter := class(creative_device):

    # 1. Wire this item_granter_device in the UEFN editor to the device
    #    that holds your migrated MyCoolSweater skeletal mesh swap logic.
    @editable
    HoodieGranter : item_granter_device = item_granter_device{}

    # 2. Wire a trigger_device in the editor; this fires when the
    #    player interacts with your pick-up prop.
    @editable
    PickupTrigger : trigger_device = trigger_device{}

    OnBegin<override>()<suspends> : void =
        # Subscribe to the trigger so we react every time it fires.
        PickupTrigger.TriggeredEvent.Subscribe(OnPlayerPickedUp)

    # 3. The Event: Trigger activates (player "picks up" the item).
    OnPlayerPickedUp(Agent : ?agent) : void =
        # 4. Grant the hoodie item to the agent.
        #    item_granter_device.GrantItem() is the real UEFN API for
        #    delivering an inventory item (or cosmetic-swap item) to a player.
        if (A := Agent?):

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