I need help to fix this invisibility code

using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Playspaces}
using { /Verse.org/Simulation }
using { /Verse.org/Random }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Verse }

# A Verse-authored creative device that can be placed in a level
WolfDevice := class(creative_device):

    @editable
    WildLifeSpawn: wildlife_spawner_device = wildlife_spawner_device{}
    
    OnBegin<override>()<suspends>:void=
        WildLifeSpawn.RiddenEvent.Subscribe(OnMounted)
        WildLifeSpawn.DismountedEvent.Subscribe(OnDismounted)

    OnMounted(EventResult:device_ai_interaction_result):void=
        if(ThisSource:=EventResult.Source?):
               HidePlayer(ThisSource)
    #Source is the agent; target is the AI.
    OnDismounted(EventResult:device_ai_interaction_result):void=
               if(ThisSource1:=EventResult.Source?):
            ShowPlayer(ThisSource1)

# Call it to enable invisibility
ShowPlayer(Agents:agent):void=
    if(FC := Agents.GetFortCharacter[]):
        FC.Show()

# Call it to disable invisibility
HidePlayer(Agents:agent):void=
    if(FC := Agents.GetFortCharacter[]):
        FC.Hide()

Does this give you any ideas? The device_ai_interaction_result is a struct, so you can get to the agent by the Source, and using the query operator to access it. I am not able to test this at the moment.

1 Like