I’m working in a system where if the player has the item in inventory, he will become invisible while crouching. But i can’t make the “power” disable after dropping the item!
Here is the code. Someone please help me ;´(
using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /Verse.org/Random }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Verse }
# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.
# A Verse-authored creative device that can be placed in a level
invisibility_manager := class(creative_device):
@editable
ItemDetector: conditional_button_device = conditional_button_device{}
OnBegin<override>()<suspends>:void=
spawn:
CheckForItem()
GoInvisibleOnCrouche(FortniteCharacter:fort_character, IsCrouched : logic) : void =
if(IsCrouched?):
FortniteCharacter.Hide()
else:
FortniteCharacter.Show()
CheckForItem()<suspends>:void=
loop:
Sleep(1.0)
AllPlayers:=GetPlayspace().GetPlayers()
for(Player:AllPlayers):
if(IsAgent:agent = agent[Player]):
if(ItemDetector.HasAllItems[IsAgent]):
Print("has item")
if(FortCharacter := IsAgent.GetFortCharacter[]):
FortCharacter.CrouchedEvent().Subscribe(GoInvisibleOnCrouche)
else:
Print("dont have items")
I’m new at Verse and programming! How to make it work?