# Source URL: https://dev.epicgames.com/community/snippets/DeNg/fortnite-double-pump-verse-device
# Local doc: epic-docs/community/snippets/DeNg/fortnite-double-pump-verse-device.md
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
Double_Pump := class(creative_device):
@editable
PlayerMarker:player_marker_device = player_marker_device{} #Tracks the selected weapon when you shoot
@editable
ItemGranter:item_granter_device = item_granter_device{} #Grants the item you have selected in the device
@editable
ItemRemover:item_remover_device = item_remover_device{} #Removes the weapon you have selected in the device
@editable
PlayerSpawners:[]player_spawner_device = array{} #An array of PlayerSpawners for attaching PlayerMarker to multiple people
OnBegin<override>()<suspends>:void=
for(PlayerSpawner:PlayerSpawners):
PlayerSpawner.SpawnedEvent.Subscribe(OnPlayerSpawned) #Subscribe to the SpawnedEvent on the PlayerSpawners
PlayerMarker.FirstItemValueChangedEvent.Subscribe(OnItemChanged) #Subsctibe to the FirstItemValueChangedEvent on the PlayerMarker
OnItemChanged(Agent : agent):void=
ItemRemover.Remove(Agent) #Remove the weapon from inventory of the Agent
ItemGranter.GrantItem(Agent) #Grant the weapon to inventory of the Agent
OnPlayerSpawned(Agent : agent):void=
PlayerMarker.Attach(Agent) #Attach the PlayerMarker on OnPlayerSpawned
Expand code Copy full snippet(29 lines long)
* ```
Player Marker
- Show Marker - False
- Visible For Tracked Player - False
- Item List - (Weapon of your choice)
Verse Library
verse
01 Snippet
Manages weapon swapping and inventory updates for a double pump mechanic using player markers and device events.
extracted-snippets/community/snippets/DeNg/fortnite-double-pump-verse-device/01-snippet.verse
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.