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!