I’m trying to create a function that operates when a specific player enters the mutator zone. Is there a way to check which players have entered?
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Verse }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Fortnite.com/Characters }
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/UI }
using { /UnrealEngine.com/Temporary/SpatialMath }
# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.
# A Verse-authored creative device that can be placed in a level
save_check_device<public> := class(creative_device):
@editable
CheckPointZone : mutator_zone_device = mutator_zone_device{}
PlayerNameToMessage<localizes>(Agent:agent) : message = "Trigger Player Name : {Agent}"
var MaybeMyUIPerPlayer : [player]?canvas = map{}
OnBegin<override>()<suspends> : void =
CheckPointZone.AgentEntersEvent.Subscribe(PlayerEnteredWith)
PlayerEnteredWith(InPlayer : agent) : void =
Print("1")
CurrentPlayerName : message = PlayerNameToMessage(InPlayer)
if (ItPlayer := player[InPlayer], PlayerUI := GetPlayerUI[ItPlayer]):
if (MyUI := MaybeMyUIPerPlayer[InPlayer]?):
PlayerUI.RemoveWidget(MyUI)
if (set MaybeMyUIPerPlayer[ItPlayer] = false) {}
else:
NewUI := CreateMyUI(CurrentPlayerName)
PlayerUI.AddWidget(NewUI)
if (set MaybeMyUIPerPlayer[ItPlayer] = option{NewUI}) {}
CreateMyUI(UIText : message) : canvas =
MyCanvas : canvas = canvas:
Slots := array:
canvas_slot:
Anchors := anchors{Minimum := vector2{X := 0.5, Y := 0.5}, Maximum := vector2{X := 0.5, Y := 0.5}}
Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
Alignment := vector2{X := 0.5, Y := 0.5}
SizeToContent := true
Widget := button_loud{DefaultText := UIText}
return MyCanvas
Referring to the tutorial document, I created a UI that displays the name of the player entering the mutator zone.
1 Like