I’m building a map where there is a freeze gun (this part of the code is already working) that freezes the player who takes damage from a specific weapon. The problem is: I wanted the player who is frozen to have a block of ice on his body. The way I thought of doing this was using a Visual Effect Powerup Device with a custom niagara effect (a custom 3d mesh). The duration of the effect would be simple to resolve by simply syncing it with the duration of the freeze.
But I don’t know how to trigger this Visual Effect Powerup Device specifically on the player that is frozen. If not directly, perhaps with an intermediary trigger or switch. But I’m still too new to Verse to know how to do this. Can anyone please help me?
Here is the code so far for my freeze gun:
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 }
freeze_device := class(creative_device):
@editable ConditionalButton : conditional_button_device = conditional_button_device{}
@editable FreezeTime : float = 1.5
OnPlayerDamage(DamageResult : damage_result) : void =
if:
Instigator := DamageResult.Instigator?
Agent := Instigator.GetInstigatorAgent[]
ConditionalButton.IsHoldingItem[Agent]
Target := fort_character[DamageResult.Target]
then:
spawn:
FreezePlayer(Target)
FreezePlayer(Target : fort_character)<suspends> : void =
Target.PutInStasis(stasis_args{})
Print("frozen")
Sleep(FreezeTime)
Target.ReleaseFromStasis()
OnPlayerAdded(Player : player) : void =
if (FortCharacter := Player.GetFortCharacter[]):
FortCharacter.DamagedEvent().Subscribe(OnPlayerDamage)
OnBegin<override>()<suspends>:void=
GetPlayspace().PlayerAddedEvent().Subscribe(OnPlayerAdded)
for (Player : GetPlayspace().GetPlayers(), FortCharacter := Player.GetFortCharacter[]):
FortCharacter.DamagedEvent().Subscribe(OnPlayerDamage)