How to Respawn a Prop After Destruction in UEFN

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

what is arvore.Respawn() ?

You can just hide it for 10 sec

1 Like

Hello,

Sorry, the correct one isn’t arvore.Respawn() but rather cactus.Respawn(). It was just a typing mistake for the forum.

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.

You can’t respawn but you CAN just spawn a new one using SpawnProp function correctly

Hello Mineblo,

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?

Thank you in advance!

If you destroy the prop it will be gone. Don’t destroy it. Use a prop manip and hide it. Use VFX for the destruction. Then make it reappear when you want it again.

3 Likes

Hi there!

I’ve tried everything I can, but I still can’t get a tree to respawn after it’s been destroyed.

The only solution I found was using a Prop Manipulator to detect when the tree is destroyed and then make another hidden one appear. However, this doesn’t create a copy or place a new tree in the exact same spot — it just changes its state from Hidden to Shown.

I’ve seen maps where you can collect materials from trees and rocks, and after some time, they reappear — so I know there’s a way to do this, I just haven’t figured it out yet.

If anyone can help, I’d really appreciate it!

You don’t actually damage the prop. Use the prop manip to detect hits. When it gets to the amount of “damage” you want, hide it by moving it away. Then move it back when you want it to reappear.

2 Likes

I did it!
Below is what was done:
It requires a Prop Manipulator attached to the Actor, which must then be referenced in the Verse Device.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

targetDevice := class(creative_device):

@editable
target : prop_manipulator_device = prop_manipulator_device{}

@editable
timeResurge : float = 5.00 # Time to respawn

@editable
damageMax : int = 200 # Maximum health of the object

var damageHit : int = 0 # Damage received counter

OnBegin<override>()<suspends>: void =

    # Executes when the target receives damage
    target.DamagedEvent.Subscribe(onDamagedTarget)        

onDamagedTarget(Agent: agent): void =

    # Restores the object's health to avoid being destroyed
    target.RestoreHealth() 
    # Damage applied per hit
    set damageHit += 50

    # When applied damage is >= max allowed damage
    if (damageHit >= damageMax) {

        # Hides the object
        target.HideProps()

        spawn:                
            respawnObj(Agent)
    }

# Respawns the object
respawnObj(agente: agent)<suspends>: void =
    Sleep(timeResurge)
    target.ShowProps()
    set damageHit = 0

Thx!

2 Likes