Verse Library verse

01 Fragment

Listens for player interaction with an item granter to grant specific ammunition types.

verse-library/using-ammo-consumables-in-fortnite-creative/01-fragment.verse

// This is a simple Verse script to manage ammo pickups.

using { /Fortnite.com/Devices }
using { /Fortnite.com/Items }
using { /Verse.org/Simulation }

# Create a new "Ammo Manager" script
ammo_manager := script()

# This function is called when the script starts.
# Think of it as "Pressing Start" on your island.
on_start := func() {
    # We need to find the Item Granter device in our island.
    # Imagine looking through your inventory to find the "Item Granter" device.
    granter := GetDevice("AmmoBoxGranter")

    # Check if the device exists. If not, the script stops (or warns you).
    if (granter != nil) {
        # Set up the "Trigger" (Event)
        # We want to know when a player interacts with this granter.
        granter.InteractedWith.Subscribe(on_player_picks_up)
        
        # Print a message to the debug log (like the in-game chat)
        Print("Ammo Box is ready! Go grab it.")
    }
}

# This is the function that runs when the event happens.
# "InteractedWith" is the event. This function is the reaction.
on_player_picks_up := func(event : InteractedWithEvent) {

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