Using this verse code a player should become frozen if damaged by a specific weapon, for some reason this only works when damaging health (does not work on shield).
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)
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 }
Your script has incorrect logic and is poorly indented. I assume you copied the fix above. Follow the correction I made.
I will post the scripts I correct on my Twitter: https://twitter.com/galinhe1080
But If I’m holding the freezeweapon, I get freezed while taking stormdamage.
I guess it has something to do with Instigator := DamageResult.Instigator?
Any tips?
I’ve been testing the code all night, I haven’t been able to find a solution. It seems like the logic of the script makes the storm an “Agent.” I’ll do more testing, I’ll let you know if anything happens.
DamagedEvent will be called by any damage done to the player. Even if you do fort_character.Damage(1.0) from script. So you would have to make some logic var
Something like if Instigator = True then do script. If false do nothing.
The storm is not an agent so it would turn out false.