If a screen appears after a player is killed and your team occupies an area, you want to select a spawnable location (including the initial spawn) and spawn there.
I have written the code and I would like you to judge whether it is correct or not.
Please let me know if I’m missing something or if I’m doing something wrong.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Teams }
using { /Verse.org/Simulation }
using { /Verse.org/Simulation/Tags }
using { /UnrealEngine.com/Temporary/UI }
spawn_selection_device := class(creative_device):
# Spawner device
@editable
var InitialSpawners:[]player_spawner_device = array{}
@editable
var AreaASpawners:[]player_spawner_device = array{}
@editable
var AreaBSpawners:[]player_spawner_device = array{}
@editable
var AreaCSpawners:[]player_spawner_device = array{}
# Capture area device
@editable
CapturePoints:[]capture_area_device = array{}
# Button device
@editable
SelectAreaAButton:button_device = button_device{}
@editable
SelectAreaBButton:button_device = button_device{}
@editable
SelectAreaCButton:button_device = button_device{}
OnBegin<override>()<suspends>:void=
# Initial setup
EnableInitialSpawners()
SetupButtonEvents()
# Setup button events
SetupButtonEvents():void=
SelectAreaAButton.InteractedWithEvent.Subscribe(OnSelectAreaA)
SelectAreaBButton.InteractedWithEvent.Subscribe(OnSelectAreaB)
SelectAreaCButton.InteractedWithEvent.Subscribe(OnSelectAreaC)
# Processing when Area A is selected
OnSelectAreaA(Agent:agent):void=
EnableAreaSpawn(AreaASpawners)
# Processing when Area B is selected
OnSelectAreaB(Agent:agent):void=
EnableAreaSpawn(AreaBSpawners)
# Processing when Area C is selected
OnSelectAreaC(Agent:agent):void=
EnableAreaSpawn(AreaCSpawners)
# Enable initial spawn points
EnableInitialSpawners():void=
for (Spawner : InitialSpawners):
Spawner.Enable()
# Enable area spawns
EnableAreaSpawn(AreaSpawners:[]player_spawner_device):void=
# Disable all current spawns
DisableAllSpawners()
# Enable spawns for the selected area
for (Spawner : AreaSpawners):
Spawner.Enable()
# Disable all spawns
DisableAllSpawners():void=
for (Spawner : InitialSpawners):
Spawner.Disable()
for (Spawner : AreaASpawners):
Spawner.Disable()
for (Spawner : AreaBSpawners):
Spawner.Disable()
for (Spawner : AreaCSpawners):
Spawner.Disable()