I want a barrier to be right infront of me and follow me when I left click on a remote button then for it to deactivate when i right click. (kind of like the guardian shield item but created with verse and UEFN)
I have tried constantly teleporting a invisible prop that has a barrier device attached to it with a offset, but when I left click, it freezes my character and doesn’t let me do anything.
i feel like there’s a simpler way to do this.
code:
player_shield := class(creative_device):
var LoopActive : weak_map(session, int) = map{}
@editable
Button : signal_remote_manager_device = signal_remote_manager_device{}
@editable
Prop : creative_prop = creative_prop{}
@editable
Barrier : barrier_device = barrier_device{}
OnBegin<override>()<suspends>:void=
Button.PrimarySignalEvent.Subscribe(FirstButton)
Button.SecondarySignalEvent.Subscribe(SecondButton)
# Prop.Hide()
Barrier.Disable()
Print("Shield Device Loaded!")
FirstButton(plr : agent):void =
Barrier.Enable()
if:
set LoopActive[GetSession()] = 0
loop:
if:
Char := plr.GetFortCharacter[]
Transform : transform = Char.GetTransform()
Prop.TeleportTo[Transform.Translation,Transform.Rotation]
if (LoopActive[GetSession()] = 1):
break
SecondButton(plr : agent):void =
Barrier.Disable()
if:
set LoopActive[GetSession()] = 1