To repro, use the following code and set up the relevant devices. Mutator Zone Device
and Switch Device
using { /Fortnite.com/Devices };using { /Verse.org/Native };using { /Verse.org/Simulation}
using { /EpicGames.com/Temporary/Diagnostics }; using{ /Verse.org/Simulation/Tags}
using { /EpicGames.com/Temporary/SpatialMath}
using { /EpicGames.com/Temporary/UI }
using { /Fortnite.com/UI }
CrashTag:=class(tag){}
NetworkCrash:= class<concrete>(creative_device):
#By AxelCapek
@editable ActionMenu:mutator_zone_device = mutator_zone_device{}
var Canvas:?canvas = false
OnBegin<override>()<suspends>:void=
ActionMenu.PlayerExitsEvent.Subscribe(LeaveMenu)
ActionMenu.PlayerEntersEvent.Subscribe(OpenCanvas)
InitiateCrash(Player:player):void={
SwitchIndex := GetDevicesWithTag(CrashTag{})
for (X->TaggedDevice : SwitchIndex, CrashSwitch:= switch_device[TaggedDevice]) {CrashSwitch.TurnOn(Player)}
}
InitiateAnotherCrash(Player:player):void={
SwitchIndex := GetDevicesWithTag(CrashTag{})
for (X->TaggedDevice : SwitchIndex, CrashSwitch:= switch_device[TaggedDevice]) {CrashSwitch.TurnOff(Player)}
}
LeaveMenu(Player:player):void = {
InitiateAnotherCrash(Player)
Print("Exiting Menu")
}
ResponseSelected(Message:widget_message):void = {
if (TmpPlayerUI := GetPlayerUI[Message.Player], TmpCanvas := Canvas?) {
TmpPlayerUI.RemoveWidget(TmpCanvas)
set Canvas = false
LeaveMenu(Message.Player)
}
}
LeaveSelected(Message:widget_message):void = {
if (TmpPlayerUI := GetPlayerUI[Message.Player], TmpCanvas := Canvas?) {
TmpPlayerUI.RemoveWidget(TmpCanvas)
set Canvas = false
LeaveMenu(Message.Player)
}
}
OpenCanvas(Player:player):void = {
InitiateCrash(Player)
if (PlayerUI := GetPlayerUI[Player]) {
if (TmpCanvas := Canvas?) {
Print("Removing Canvas")
PlayerUI.RemoveWidget(TmpCanvas)
set Canvas = false
} else {
Print("Create New Canvas")
NewCanvas := MakeCanvas()
PlayerUI.AddWidget(NewCanvas, player_ui_slot{ InputMode := ui_input_mode.All })
set Canvas = option{NewCanvas}
}
}
}
MakeCanvas():canvas = {
Response:button_quiet=button_quiet{ DefaultText := "Send Help" }
Leave:button_quiet=button_quiet{ DefaultText := "Please.." }
Response.OnClick.Subscribe(ResponseSelected)
Leave.OnClick.Subscribe(LeaveSelected)
NewCanvas := canvas:
Slots := array:
canvas_slot:
Anchors := anchors{ Maximum:= vector2{X:=1.0, Y:=1.0} }
Offsets := margin{ Top:=100.0, Left:=300.0, Right:=300.0, Bottom := 100.0 }
Widget := stack_box:
Orientation := orientation.Horizontal
Slots := array:
stack_box_slot:
HorizontalAlignment := horizontal_alignment.Center
VerticalAlignment := vertical_alignment.Center
Distribution := option{-0.5}
Widget := text_block{DefaultText:= "I will crash, for sure.\n\nSorry.\n\n - Axel"}
stack_box_slot:
HorizontalAlignment := horizontal_alignment.Center
VerticalAlignment := vertical_alignment.Bottom
Distribution := option{0.25}
Widget := stack_box:
Orientation := orientation.Horizontal
Slots := array:
stack_box_slot:
HorizontalAlignment := horizontal_alignment.Center
Widget := Response
stack_box_slot:
Widget := Leave
HorizontalAlignment := horizontal_alignment.Center
return NewCanvas
}