Fortnite freeze gun only works if health is damaged.

I have some code:

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 ).

I believe there is a FortCharacter.DamagedShieldEvent() so you might need to subscribe to both events.

I figured it out by myself after posting this post, but thanks anyways.

hello, would you be so kind annd posstt the full code or tell me where i should addd the FortCharacter.DamagedShieldEvent()

I’m having the same difficulty, can you help me make the damage to the shield cause it to freeze? My script is identical to yours.

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 = 3.0

    OnPlayerDamaged(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()

    OnBegin<override>()<suspends> : void :=
        for (Player : GetPlayspace().GetPlayers(), FortCharacter := Player.GetFortCharacter[]):
            FortCharacter.DamagedEvent().Subscribe(OnPlayerDamaged)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.