using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Fortnite.com/UI }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /Verse.org/Colors }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary/Diagnostics }
freezegun := class(creative_device):
@editable ConditionalButton : conditional_button_device = conditional_button_device{}
@editable FreezeTime : float = 1.0
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{})
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)
Using this verse code a player should get frozen if the player is damaged using a specific weapon. for some reason this only works when damaging health ( doesnt work on shield ).