I’m trying to make a cactus respawn 10 seconds after being destroyed, but I’m getting an error in the code. Do you have any idea what might be causing it?
I’m using UEFN 5.6.
CODE:
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
hello_world_device := class(creative_device):
@editable
cactus : eliminable_creative_prop
OnBegin<override>()<suspends>: void =
Print("Respawn system initialized.")
loop:
_ = await cactus.DamageEvent
Print("Cactus destroyed. It will respawn in 10 seconds...")
Sleep(10.0)
arvore.Respawn()
Print("cactus respaw!")
The error seems to be on this line:
_ = await cactus.DamageEvent
But the idea is for the player to collect the material associated with the actor, causing it to disappear with the default destruction effects (as normally happens in Fortnite), and then respawn after 10 sec.
Simply making the actor vanish without the visual destruction effects would look odd during gameplay.
I ran a test where, upon stepping on a trigger, the actor (a cactus from the Fortnite library) appears in the scene. That part works fine, but I’m unable to apply damage to the actor, and it seems there’s no way to configure it since there’s no option to edit its details.
Because of that, I tried creating a Blueprint using this cactus as a static mesh component, but that didn’t work either, as the available items are limited.
So, what would be the ideal way to insert an actor from the Fortnite library into the scene, allow it to be destroyed, and then have it reappear afterward?