Verse Library verse

01 Example Granting Items To Test Players With Verse

Grants an item to every player in the playspace when an associated trigger activates.

extracted-snippets/documentation/en-us/fortnite/multiplayer-previewing-in-unreal-editor-for-fortnite/01-example-granting-items-to-test-players-with-verse.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/multiplayer-previewing-in-unreal-editor-for-fortnite
# Local doc:  epic-docs/documentation/en-us/fortnite/multiplayer-previewing-in-unreal-editor-for-fortnite.md
# Section:    Example: Granting Items to Test Players with Verse
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
teleporter_test := class(creative_device):
@editable
Trigger:trigger_device = trigger_device{}
@editable
ItemGranter:item_granter_device = item_granter_device{}
OnBegin<override>()<suspends>:void=
Trigger.TriggeredEvent.Subscribe(GiftToEveryone)
ItemGranter.ItemGrantedEvent.Subscribe(ItemReceivedEvent)
GiftToEveryone(Instigator:?agent):void=
Print("Incoming gifting.")
Participants := GetPlayspace().GetParticipants()
for (Participant : Participants):
Print("Attempting grant item...")
ItemGranter.GrantItem(Participant)
ItemReceivedEvent(Agent:agent):void=
Print("Item granted!")

Comments

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