UEFN - Verse - How do I make something happen but only if you're a certain class?

96 Views Asked by At

So, I'm making a game where there's an invisibility function, and when you crouch, you go invisible, and that works perfectly, but I want it to only happen if you're class 3.

I have tried the following code: my code that I have used, and it worked, but now I need to get it to work only as class 3, which I have no idea how to do. Help please?

EDIT: I got told to upload the code as text, so ta-da:

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Fortnite.com/Characters }
go_invisible_device := class(creative_device):
     @editable
     Spawner :player_spawner_device = player_spawner_device{}
     
     HandleSpawnEvent ( Agent : Agent) : void =
         if (FortCharacter :+ Agent.GetFortCharacter[]):
             FortCharacter.CrouchedEvent().Subscribe(GoInvisibleOnCrouch)
     GoInvisibleOnCrouch( FortniteCharacter : fort_character, IsCrouched : Logic): void =
        if (IsCrouched?):
            FortniteCharacter.Hide()
        else:
            FortniteCharacter.Show()

     OnBegin<Override>()<suspends>:void=
         Spawner.SpawnedEvent.Subscribe(HandleSpawnEvent)
0

There are 0 best solutions below