Hello!
I am fairly new on UEFN (loving it so far) and I can’t find a way to make my CrouchedEvent work in my code.
I want the following: I want the player to turn invisible while crouching BUT only if that player has the Class 03 activated/ enabled (one of the class designers in my level). I have 2 triggers in my level to activate 2 different classes (Class 03 and Class 04).
I’ve tried everything and nothing seems to work. Could I get someone’s eyes please?
Thank you so much!
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Fortnite.com/Game }
using { /Fortnite.com/Characters }
using { /Verse.org/Random }
class03_trigger_device := class(creative_device):
@editable
Class03TriggerObject : trigger_device = trigger_device{}
@editable
Class04TriggerObject : trigger_device = trigger_device{}
var IsClass03Active: logic = false;
var IsClass03Ongoing: logic = false;
var IsClass04Active: logic = false;
var IsClass04Ongoing: logic = false;
OnBegin<override>()<suspends>:void=
Class03TriggerObject.TriggeredEvent.Subscribe(OnClass03TriggerEvent);
Class03TriggerObject.TriggeredEvent.Subscribe(CrouchSpawnEvent);
Class04TriggerObject.TriggeredEvent.Subscribe(OnClass04TriggerEvent)
CrouchSpawnEvent (Agent:?agent) : void =
if (PlayerCharacter := fort_character [Agent?]):
PlayerCharacter.CrouchedEvent().Subscribe (CrouchEvent)
CrouchEvent (PlayerCharacter : fort_character, IsCrouched :logic) : void=
if (IsCrouched?):
if (IsClass03Active = true):
Print ("I'm hidden!")
PlayerCharacter.Hide()
OnClass03TriggerEvent (Agent : ?agent): void =
if (PossibleAgent:agent = Agent?):
if (IsClass03Active = false):
set IsClass04Active = false
set IsClass03Active = true
Print ("Class 03 is true")
spawn:
SelectPlayer(PossibleAgent)
Print ("Let's select a player for Class 03")
SelectPlayer (Agent:agent)<suspends>:void=
if (PlayerCharacter:= Agent.GetFortCharacter[]):
set IsClass03Ongoing = true;
OnClass04TriggerEvent (Agent : ?agent): void =
if (PossibleAgent:agent = Agent?):
if (IsClass04Active = false):
set IsClass03Active = false
set IsClass04Active = true
Print ("Class 04 is true")