I have a script that should activate a vfx_spawner that would follow the Pos/Rot of the player who was walking, thus making the effect follow him. But when I put Pos/Rot inside a loop it gives me this error.
Error: To prevent infinite immediate iteration, loop
must have one or more subexpressions that are either async (such as a coroutine) or a jump out (such as break
or return
).
Does anyone know how to solve it?
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Fortnite.com/UI }
using { /Verse.org/Simulation }
using { /Verse.org/Colors }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary/Diagnostics }
effect_neon := class(creative_device):
@editable VFXLightning: vfx_spawner_device = vfx_spawner_device{}
SprintState: logic = false # Use logic para representar estados lógicos
OnSprintedStateChanged(Character : fort_character, SprintingResult: logic): void := # Método chamado quando o estado de sprint é alterado
if:
Sprinting := SprintingResult? # Use '?' para tratar a condição de falha
then:
ActivateVFX(Character) # O personagem começou a correr, ativar o efeito
ActivateVFX(Character : fort_character) : void :=
loop:
Pos := Character.GetTransform().Translation
Rot := Character.GetTransform().Rotation
if:
VFXLightning.TeleportTo[Pos, Rot] # Teleporta o efeito para a posição do personagem
OnBegin<override>()<suspends> : void :=
for (Player : GetPlayspace().GetPlayers(), FortCharacter := Player.GetFortCharacter[]):
FortCharacter.SprintedEvent().Subscribe(OnSprintedStateChanged) # Inscreva-se para rastrear mudanças de sprint