Turn visible on/off for an item/prop

Is there a way to turn visible on/off in verse for an item/prop? I am wanting to use the prop manipulator, but it seems to have issues.

Hello Johnn, Welcome to the Forums.

This is a Snippet that I have:

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

hideaprop := class(creative_device):

    @editable 
    MyHidableProp : creative_prop = creative_prop{}
    
    @editable 
    MyButtonRef : button_device = button_device{}


    OnBegin<override>()<suspends>:void=
        MyButtonRef.InteractedWithEvent.Subscribe(ButtonExecuteFunction)
        

    ButtonExecuteFunction(Agent:agent):void=
        MyHidableProp.Hide()

Let us know if you have any questions about it.

1 Like

Thanks so much. This works perfectly with a ‘standard’ button. And I have already used it in my island.
Can it be edited to also include conditional buttons…and with character devices.
I guess to clarify, I was looking for a conditional button to make a character device (NPC) disappear once the conditional button was activated.
I’m new to UEFN and Unreal Engine.
I have worked in Unity and some C#. Verse is a little different.
Again, thanks so much for the code you provided…greatly appreciated.

For the Character_device it’s as simple as calling .Hide() on the device

As for the “npc_spawner” you would need to store the agent of that npc somewhere from the “spawned event”

Then assuming the agent variable is “MYNPC” you can modify the function provided above by astrotronic to something like this

ButtonExecuteFunction(Agent:agent):void=
   if(FortCharacter:=MYNPC.GetFortCharacter[]):
         FortCharacter.Hide()

I haven’t used npc spawners for this in the past but I assume they work similarly to players and have a fort_character

1 Like

Thanks for the suggestions, I will have to give them a try.

1 Like

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