Skip to content

Releases: DarkThymes/UEFN

v1.0 Timer Component

02 Jun 18:23
7556534

Choose a tag to compare

I made my own on screen timer as the built in timer device is currently broken

using { /Verse.org }
using { /Verse.org/Native }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
using { /Verse.org/Input }
using { /Verse.org/Input/UI }
using { /Fortnite.com/Devices }
using { /Verse.org/Assets }
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/Characters }

StringToMessage<localizes>(value:string) : message = "{value}"   

PlayerTimer := class():
    var Time : float = 0.0
    var Running : logic = false
    Widget : wTimer = wTimer{}

timer_component<public> := class<final_super>(component):

    @editable TeamSettings : team_settings_and_inventory_device = team_settings_and_inventory_device{}
    @editable Trigger : trigger_device = trigger_device{}
    @editable TimeTarget : float = 0.0
    @editable Countdown : logic = true
    @editable Sound : logic = true
    var TimerMap : [agent]PlayerTimer = map{} 
    
    TeamAwait()<suspends>:void=
        loop:
            Agent:=TeamSettings.TeamMemberSpawnedEvent.Await()
            if (not Entity.GetComponent[MSS_Sound]):
                Entity.AddComponents(array{MSS_Sound{Entity:=Entity, AutoPlay:=false}})
            if. not TimerMap[Agent] then spawn. PlayerActive(Agent)
    
    PlayerActive(Agent:agent)<suspends>:void=
        var LoopTimer : int = 0
        loop:
            if:
                FC:=Agent.GetFortCharacter[]
                FC.IsActive[]
                NewTimerPlayer:PlayerTimer=PlayerTimer:
                    Time := 0.0
                    Running := false
                set TimerMap[Agent] = NewTimerPlayer
            then: 
                break
            set LoopTimer += 1
            Sleep(1.0)
            if (LoopTimer = 30):
                break         

    TriggerAwait()<suspends>:void=
        loop:
            mAgent:=Trigger.TriggeredEvent.Await()
            if (Agent:=mAgent?, TimerAgent:=TimerMap[Agent]):
                if(not TimerAgent.Running?):
                    set TimerAgent.Running = true
                    if(Countdown?):
                        set TimerAgent.Time = TimeTarget
                        spawn. TimeLoop(Agent, true)
                    else:
                        spawn. TimeLoop(Agent, false)
                 

    TimeLoop(Agent:agent, Down:logic)<suspends>:void=
            if (PlayerUI := GetPlayerUI[player[Agent]], TimerAgent := TimerMap[Agent], SFX:=Entity.GetComponent[MSS_Sound]):
                PlayerUI.AddWidget(TimerAgent.Widget)
                
                loop:
                    Sleep(0.1)

                    if (Down? and TimerAgent.Time < 0.0):
                        break
                    if (not Down? and TimerAgent.Time > TimeTarget):
                        break

                    if:
                        MinutesRemaining := Floor[TimerAgent.Time / 60.0]
                        SecondsOnly := Floor[TimerAgent.Time - (MinutesRemaining * 60.0)]
                    then:
                        var MinStr : string = "{MinutesRemaining}"
                        if (MinutesRemaining < 10):
                            set MinStr = "0{MinutesRemaining}"
                            
                        var SecStr : string = "{SecondsOnly}"
                        if (SecondsOnly < 10):
                            set SecStr = "0{SecondsOnly}"

                        set TimerAgent.Widget.vTimer = StringToMessage("{MinStr}:{SecStr}")

                        if (Down?):
                            set TimerAgent.Time -= 1.0
                            if (TimerAgent.Time < 5.0):
                                set TimerAgent.Widget.vAnim = true
                        else:
                            set TimerAgent.Time += 1.0
                            if (TimeTarget - TimerAgent.Time < 4.0):
                                set TimerAgent.Widget.vAnim = true
        
                        set SFX.Sounds = array{tick_asset}
                        if. Sound? then SFX.Play()

                    Sleep(0.9)
                    set TimerAgent.Widget.vAnim = false
                       
                    
                # This is what happens when timer is finished - put your logic under here :)
                set SFX.Sounds = array{alarm_asset}
                if. Sound? then SFX.Play()                
                Sleep(2.0)
                PlayerUI.RemoveWidget(TimerAgent.Widget)
                set TimerAgent.Running = false



    OnBeginSimulation<override>():void =
        (super:)OnBeginSimulation()

    OnSimulate<override>()<suspends>:void =
        spawn. TeamAwait()
        spawn. TriggerAwait()
        

v1.0 Super Component

08 Jun 21:41
7556534

Choose a tag to compare

using { /Fortnite.com }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Fortnite.com/AI }
using { /Fortnite.com/Devices/CreativeAnimation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/SceneGraph }
using { /Verse.org }
using { /Verse.org/Assets }
using { /Verse.org/Colors }
using { /Verse.org/Concurrency }
using { /Verse.org/Native }
using { /Verse.org/Random }
using { /Verse.org/Simulation }
using { /Verse.org/Colors/NamedColors }
using { /Verse.org/SceneGraph/KeyframedMovement }
using { /Verse.org/SpatialMath }
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/Playspaces }
using { /UnrealEngine.com/Temporary/SpatialMath }


super_component<public> := class<final_super>(component):
    
    EasingFunc : easing_function = ease_in_out_cubic_bezier_easing_function{}  
    PlaybackMode<public>:keyframed_movement_playback_mode = oneshot_keyframed_movement_playback_mode{}      
    var mCPlayerComp : ?cplayer_component = false
    DeadEvent:event()=event(){}

    AwaitFire()<suspends>:void=
        if:
            CPlayerComp := mCPlayerComp?
            SFX:=Entity.GetComponent[MSS_Loop]
            VFX:=(for(Comp:Entity.FindDescendantComponents(NS_Beam)) do Comp)[0]
        then:
            loop:
                Agent:=CPlayerComp.AimInput.PressedEvent.Await()
                SFX.Play()
                VFX.Play()
                race:
                    loop:
                        if:
                            FC:=Agent.GetFortCharacter[]
                            FCViewRot:=FC.GetViewRotation()
                            FCFwd:=FCViewRot.GetLocalForward()*1500.0
                            Carryable:=CPlayerComp.Carryable
                        then:     
                            if(SweepHits:=Entity.FindSweepHits(FromVector3(FCFwd)).ToArray()[0]):
                                if. Carryable.TeleportTo[FromVector3(SweepHits.ContactPosition), (/UnrealEngine.com/Temporary/SpatialMath:)rotation{}]
                                Carryable.Spawn()
                                Sleep(0.0)
                                Carryable.Explode()
                            else:
                                Print("No hits found")
                        Sleep(0.5)
                    loop:
                        if(FC:=Agent.GetFortCharacter[],FCViewRot:=FC.GetViewRotation(), ViewPitch:=FCViewRot.GetYawPitchRollDegrees()[1]):
                            LocalPitch:=(/UnrealEngine.com/Temporary/SpatialMath:)MakeRotationFromYawPitchRollDegrees(0.0,ViewPitch,0.0)
                            VFX.Entity.SetLocalTransform((/Verse.org/SpatialMath:)transform{Translation:=VFX.Entity.GetLocalTransform().Translation, Rotation:=FromRotation(LocalPitch)})#FCViewRot)})               
                        Sleep(0.0)                    
                    block:
                        CPlayerComp.AimInput.ReleasedEvent.Await()
                        SFX.Stop()
                        VFX.Stop()
                    block:
                        DeadEvent.Await()
                        SFX.Stop()
                        VFX.Stop()
                    
    OnBeginSimulation<override>():void =
        (super:)OnBeginSimulation()
    
    OnSimulate<override>()<suspends>:void =
        Entity.RoundAwait(true)
        if:
            CPlayerComp:=(for(Comp:Entity.GetSimulationEntity[].FindDescendantComponents(cplayer_component)) do Comp)[0]
        then:
            set mCPlayerComp = option. CPlayerComp

        Sleep(0.1)
        spawn. AwaitFire()

    OnEndSimulation<override>():void=
        DeadEvent.Signal()
        


        

            
        

v1.0 Raycast Component

08 Jun 21:00
7556534

Choose a tag to compare

using { /Fortnite.com }
using { /Fortnite.com/Devices }
using { /Verse.org }
using { /Verse.org/SceneGraph }
using { /Verse.org/Assets }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/Characters }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/SpatialMath }
using { /Verse.org/Colors }


XYZ:= import(/UnrealEngine.com/Temporary/SpatialMath)
my_debug_draw := class(debug_draw_channel) {}

raycast_component<public> := class<final_super>(component):

    @editable
    Trigger: trigger_device = trigger_device{}

    @editable
    Trigger2 : trigger_device = trigger_device{}

    @editable
    InputTrig : input_trigger_device = input_trigger_device{}

    @editable
    Carryable : carryable_spawner_device = carryable_spawner_device{}

    DebugDraw:debug_draw = debug_draw{Channel := my_debug_draw}

    var Bomb : logic = false

    InputAwait()<suspends>:void=
        loop:
            Agent:=InputTrig.PressedEvent.Await()
            if(FC:=Agent.GetFortCharacter[]):
                ViewRot := XYZ.FromRotation(FC.GetViewRotation())
                ViewXform := transform:
                    Translation := XYZ.FromVector3(FC.GetViewLocation())
                    Rotation:= ViewRot
                HitsGen := Entity.FindSweepHits(ViewXform.Rotation.GetForwardAxis() * 3000.0, ViewXform, collision_point{})
                HitsArray:= for(Hit:HitsGen) do Hit

                if(FirstHit := HitsArray[0]):
                    DebugDraw.DrawLine(ViewXform.Translation, FirstHit.ContactPosition)
                    if(Box:=Meshes.MaterialBox[FirstHit.TargetComponent]):
                        Mat:MaterialStuff.MI_Box=MaterialStuff.MI_Box{}
                        set Box.Material_0 = Mat
                        set Mat.Colour = NamedColors.Red
                    if(Bomb?):
                        Carryable.SetGlobalTransform of transform: 
                            Translation:=FirstHit.ContactPosition
                        Carryable.Spawn()
                        Carryable.Explode()

    TriggerAwait()<suspends>:void=
        mAgent:=Trigger.TriggeredEvent.Await()
        if(Agent:=mAgent?):
            InputTrig.Register(Agent)
            spawn. InputAwait()

    SetBomb(mAgent:?agent):void=
        set Bomb = true
                       
    OnBeginSimulation<override>():void =
        (super:)OnBeginSimulation()
    
    OnSimulate<override>()<suspends>:void =
        spawn. TriggerAwait()
        Trigger2.TriggeredEvent.Subscribe(SetBomb)

PathManager

12 Jun 10:17
7556534

Choose a tag to compare

Extract everything to your content folder, compile verse and then add an entity to the scene and add the path manager component

using { /Fortnite.com }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Fortnite.com/AI }
using { /Fortnite.com/Devices/CreativeAnimation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/SceneGraph }
using { /Verse.org }
using { /Verse.org/Assets }
using { /Verse.org/Colors }
using { /Verse.org/Concurrency }
using { /Verse.org/Native }
using { /Verse.org/Random }
using { /Verse.org/Simulation }
using { /Verse.org/Colors/NamedColors }
using { /Verse.org/SceneGraph/KeyframedMovement }
using { /Verse.org/SpatialMath }
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/Playspaces }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Fortnite.com/Game }

ePath := enum{Entity, Prop, Location}

path :=class:
    @editable EndType : ePath = ePath.Entity
    @editable EntityEnd : entity = entity{}
    @editable PropEnd : creative_prop = creative_prop{}
    @editable VectorEnd : vector3 = vector3{}
    @editable ActivateTrigger : trigger_device = trigger_device{}
    @editable NextTrigger : ?trigger_device = false

path_manager_component<public> := class<final_super>(component):
    @editable Paths : []path = array{}
    RoundStart : event() = event(){}

    TriggerAwait(Path:path)<suspends>:void=
        loop:
            mAgent:=Path.ActivateTrigger.TriggeredEvent.Await()
            if:
                FC:=mAgent?.GetFortCharacter[]
                FCEnt:=FC.GetEntity[]
            then:
                DoPath(Path, FC, FCEnt)
            Sleep(0.0)

    DoPath(Path:path, FC:fort_character, FCEnt:entity):void=
        NewPath:entity=entity{}
        VFXComp:NS_Path=NS_Path{Entity:=NewPath}
        NewPath.AddComponents(array{VFXComp})
        FCEnt.AddEntities(array{NewPath})
        NewPath.SetLocalTransform(transform{Translation:=vector3{Up:=-50.0}})
        if. Player:= player[FC.GetAgent[]] then NewPath.SetPresentableToPlayers(option. array{Player})
        case(Path.EndType):
            ePath.Entity=>
                EntLoc:=Path.EntityEnd.GetGlobalTransform().Translation
                set VFXComp.vEnd = EntLoc
                spawn. EndCheck (Path, FC, FCEnt, EntLoc, VFXComp)
            ePath.Prop=>
                PropLoc := Path.PropEnd.GetGlobalTransform().Translation
                set VFXComp.vEnd = PropLoc
                spawn. EndCheck (Path, FC, FCEnt, PropLoc, VFXComp)
            ePath.Location=>
                set VFXComp.vEnd = Path.VectorEnd
                spawn. EndCheck (Path, FC, FCEnt, Path.VectorEnd, VFXComp)


    EndCheck(Path:path, FC:fort_character, FCEnt:entity, EndLoc:vector3, VFXComp:NS_Path)<suspends>:void=
        loop:
            CurrentDistSq:=DistanceSquared(FCEnt.GetGlobalTransform().Translation, EndLoc)
            if:
                CurrentDistSq < 75000.0
                Agent:=FC.GetAgent[]
            then:
                VFXComp.Stop()
                VFXComp.Entity.RemoveFromParent()
                if. Next:=Path.NextTrigger? then Next.Trigger(Agent)
            Sleep(0.0)

    StartRound():void=
        RoundStart.Signal()

    OnBeginSimulation<override>():void =
        (super:)OnBeginSimulation()
    
    OnSimulate<override>()<suspends>:void =
        if(Rounder := Entity.GetFortRoundManager[]):
            Rounder.SubscribeRoundStarted(StartRound)
        RoundStart.Await()
        for (Path:Paths):
            spawn. TriggerAwait(Path)

v1.0 Basic Persona Behaviour

22 May 21:00
d2772fd

Choose a tag to compare

Simply add this to your NPC and they'll be able to talk to you in game

using { /Fortnite.com/AI }
using { /Fortnite.com/Playspaces }
using { /UnrealEngine.com/Conversations }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Chat }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
using { /Fortnite.com/Characters }



basic_persona := class(npc_behavior):
    BreakEvent : event() = event(){}
    
    AddPlayerAsConversationTarget(Player:player):void=
        if:
            NPCEntity := GetEntity[]
            Playspace := NPCEntity.GetPlayspaceForEntity[]
            TeamCollection := Playspace.GetTeamCollection()
            Team := TeamCollection.GetTeam[Player]
            NPCAgent := GetAgent[]
            TeamCollection.AddToTeam[NPCAgent, Team]
            SimEntity := Player.GetSimulationEntity[]
            PersonaComponent := NPCEntity.GetComponent[persona_component]
      
        then:           
            VoiceChannels := SimEntity.GetVoiceChannels()
            for (VoiceChannel : VoiceChannels):
                AgentVoiceGroup := VoiceChannel.Group.GetMemberMap()
                if (AgentVoiceGroup[NPCAgent]):
                    Player.SetConversationTarget(PersonaComponent,VoiceChannel)


    RemovePlayerAsConversationTarget(Player:player):void=
        Player.ClearConversationTarget()

    OnBegin<override>()<suspends>:void=
        for (Player : GetEntity[].GetPlayspaceForEntity[].GetPlayers()):
            AddPlayerAsConversationTarget(Player)

    OnEnd<override>():void=
        for (Player : GetEntity[].GetPlayspaceForEntity[].GetPlayers()):
            RemovePlayerAsConversationTarget(Player)

v.1.0 Advanced NPC Persona

22 May 21:41
d2772fd

Choose a tag to compare

This one will error if you use it as is, you need a MSS_Sound Preset first, you can make it from the Epic folder, search for MSS and then Generate New Preset

It also needs animations - I got them from mixamo, so you can do that too :)

using { /Fortnite.com/AI }
using { /Fortnite.com/Playspaces }
using { /UnrealEngine.com/Conversations }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Chat }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Animation/PlayAnimation }
using { /Fortnite.com/Game }
using { /Verse.org/Assets }
using { /Verse.org/Random }

responses := struct:
    Dance:logic

ResponseInstructions:string = "Structured Output Rules:responses - if the player asks you if you know any dances, then output true in the Dance field.  This should not signal true at any other time. You should also respond positively and tell them you want to show them."

new_persona := class(npc_behavior):
    BreakEvent : event() = event(){}
    var mSound : ?MSS_Sound = false
    var I:int = 0
    AddPlayerAsConversationTarget(Player:player):void=
        if:
            NPCEntity := GetEntity[]
            Playspace := NPCEntity.GetPlayspaceForEntity[]
            TeamCollection := Playspace.GetTeamCollection()
            Team := TeamCollection.GetTeam[Player]
            NPCAgent := GetAgent[]
            TeamCollection.AddToTeam[NPCAgent, Team]
            SimEntity := Player.GetSimulationEntity[]
            PersonaComponent := NPCEntity.GetComponent[persona_component]
            ExistingKnowledge := PersonaComponent.PersonaDefinition.KnowledgeSlot.GetSlotContents()
            set PersonaComponent.PersonaDefinition.KnowledgeSlot = basic_prompt_slot:
                Contents := ExistingKnowledge + ResponseInstructions                   
      
        then:           
            VoiceChannels := SimEntity.GetVoiceChannels()
            for (VoiceChannel : VoiceChannels):
                AgentVoiceGroup := VoiceChannel.Group.GetMemberMap()
                if (AgentVoiceGroup[NPCAgent]):
                    Player.SetConversationTarget(PersonaComponent,VoiceChannel)
            PersonaComponent.SubscribeToResponseType(responses, true, OnInteractionsResponse)                    

    OnInteractionsResponse(mAgent:?agent, Response:responses):void=
        if:
            Agent:=mAgent?
            NPCFC:=GetAgent[].GetFortCharacter[]
            AC:=NPCFC.GetPlayAnimationController[]
            NPCEntity := GetEntity[]
            PC := NPCEntity.GetComponent[persona_component]
            Response.Dance = true
        then:
            spawn. WaitAndPlay(AC, PC)

    WaitAndPlay(AC:play_animation_controller, PC:persona_component)<suspends>:void=
        if (Sound:=mSound?):
            PC.StopSayEvent.Await()
            Anim:=AC.Play(GetDance())
            set I+=1
            Sound.Play()
            Anim.CompletedEvent.Await()
            Sound.Stop()

    GetDance():animation_sequence=
        case(I):
            0=> NewAnim
            1=> House_Dancing1
            2=> Macarena_Dance1
            3=> Silly_Dancing1
            _=> NewAnim

    OnDamaged(Result:damage_result):void=
        NewPrompt:basic_prompt_slot=basic_prompt_slot{Contents:="The player just hit you.  Tell them you don't like it and not to do it again"}
        if:
            PersonaComponent := GetEntity[].GetComponent[persona_component]    
            PersonaComponent.RequestToTalk[NewPrompt]
        
    RemovePlayerAsConversationTarget(Player:player):void=
        Player.ClearConversationTarget()

    OnBegin<override>()<suspends>:void=
        for (Player : GetEntity[].GetPlayspaceForEntity[].GetPlayers()):
            AddPlayerAsConversationTarget(Player)
        
        if(FC:=GetAgent[].GetFortCharacter[]):
            FC.DamagedEvent().Subscribe(OnDamaged)
        
        NewSound:entity=entity{}
        Sound:MSS_Sound=MSS_Sound{Entity:=NewSound, Sounds:=array{dancemusic_asset}}         
        NewSound.AddComponents(array{Sound})

        if (Sim:=GetEntity[].GetSimulationEntity[]):
            Sim.AddEntities(array{NewSound})
            Sound.Stop()
            set mSound = option. Sound

    OnEnd<override>():void=
        for (Player : GetEntity[].GetPlayspaceForEntity[].GetPlayers()):
            RemovePlayerAsConversationTarget(Player)

v1.0 Elim Feed

20 May 13:18
7de57f4

Choose a tag to compare

First release of elim_feed_component for SceneGraph in UEFN

v1.0 Item Granter Component

22 May 12:10
164a271

Choose a tag to compare

Item Granter component - simply add it to an entity in the scene and make sure custom items are enabled in project settings - you can then add the weapons you want as editables

using { /Verse.org }
using { /Verse.org/Native }
using { /Verse.org/SceneGraph }
using { /Verse.org/SpatialMath }
using { /Verse.org/Simulation }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Itemization }
using { /UnrealEngine.com/Itemization }
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/Weapons }
using { /Fortnite.com/Characters }

items_to_grant<public>:=class:
    @editable Item : subtype(entity) = false
    @editable Amount : int = 1
    
item_granter_component<public> := class<final_super>(component):

    @editable Trig : trigger_device = trigger_device{}
    @editable Items : []items_to_grant = array{}
    @editable ClearInventory : logic = false
    @editable EquipGranted : logic = true

    TriggerAwait()<suspends>:void=
        loop:
            mAgent:=Trig.TriggeredEvent.Await()
            if:
                Agent:=mAgent?
                PlayerUI:=GetPlayerUI[player[Agent]]
                InvGen:=Agent.FindDescendantComponents(inventory_component)
                Inventory:=(for(InvComp:InvGen) do InvComp)[0]
                Hotbar:=(for(InvComp:InvGen, fort_inventory_weapon_hotbar_component[InvComp]) do InvComp)[0]
                SimEnt:=Entity.GetSimulationEntity[]
            then:
                if(ClearInventory?):
                    for (Inv:InvGen, not fort_inventory_harvest_tool_component[Inv]):
                        InvItems:=Inv.GetItems()
                        for (InvItem:InvItems):
                            Inv.RemoveItem(InvItem)

                for (Item:Items):
                    ItemConcrete: concrete_subtype(entity) = Item.Item
                    ItemToGrant := ItemConcrete{}
                    
                    if(Stack:=ItemToGrant.GetComponent[stackable_component]):
                        if (MaxStack:=Stack.MaxStackSize?, Item.Amount>MaxStack):
                            Stack.SetStackSize(MaxStack)
                        else:
                            Stack.SetStackSize(Item.Amount)
                        Result:=Inventory.AddItemDistribute(ItemToGrant)
                        if. Result.GetError[] then spawn. GrantFailed(Hotbar, Inventory, SimEnt, Agent, ItemToGrant)
                        Sleep(0.1)
                        if(EquipGranted?, ItemComp:=ItemToGrant.GetComponent[item_component]) then ItemComp.Equip()
                    else:
                        for (I:=0..Item.Amount-1):
                            LoopItem := ItemConcrete{}
                            Result:=Inventory.AddItemDistribute(LoopItem)
                            if. Result.GetError[] then spawn. GrantFailed(Hotbar, Inventory, SimEnt, Agent, ItemToGrant)
                            Sleep(0.1)
                            if(EquipGranted?, ItemComp:=LoopItem.GetComponent[item_component]) then ItemComp.Equip()
            Sleep(0.0)
                                
    GrantFailed(Hotbar:inventory_component, Inventory:inventory_component, SimEnt:entity, Agent:agent, ItemToGrant:entity)<suspends>:void=
        EquippedItems:=Hotbar.GetEquippedItems()
        if(EquippedItem:=EquippedItems[0], not ItemToGrant.GetComponent[stackable_component]):
            Inventory.RemoveItem(EquippedItem)
            SimEnt.AddEntities(array{EquippedItem})
            EquippedItem.SetGlobalTransform(GetPlayerLoc(Agent,100.0))
            Inventory.AddItemDistribute(ItemToGrant)
            Sleep(0.0)
            if(EquipGranted?, ItemComp:=ItemToGrant.GetComponent[item_component]) then ItemComp.Equip()
        else:
            SimEnt.AddEntities(array{ItemToGrant})
            ItemToGrant.SetGlobalTransform(GetPlayerLoc(Agent,100.0))

    GetPlayerLoc(Agent:agent, Dist:float):transform=
        if:
            FCEnt:=Agent.GetFortCharacter[].GetEntity[]
        then:
            XForm:=FCEnt.GetGlobalTransform()
            LocalForward:=XForm.Rotation.GetForwardAxis()*Dist
            NewXForm:=transform:
                Translation:=XForm.Translation+LocalForward
            NewXForm
        else:
            transform{}
                   
    OnBeginSimulation<override>():void =
        (super:)OnBeginSimulation()

    OnSimulate<override>()<suspends>:void =
        spawn. TriggerAwait()

v1.0 Back Component

22 May 13:14
164a271

Choose a tag to compare

This allows you to use the back input action in verse inputs - i've included the basic widget so the verse doesn't error

using { /Verse.org }
using { /Verse.org/Native }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
using { /Verse.org/Input }
using { /Verse.org/Input/UI }
using { /Fortnite.com/Devices }
using { /Verse.org/Assets }
using { /UnrealEngine.com/Temporary/UI }

back_component<public> := class<final_super>(component):

    @editable Trigger : trigger_device = trigger_device{}
    Widget:wBackTest = wBackTest{}

    TriggerAwait()<suspends>:void=
        loop:
            mAgent:=Trigger.TriggeredEvent.Await()
            if:
                Agent:=mAgent?
                Player:=player[Agent]
                PlayerInput:=GetPlayerInput[Player]
                PlayerUI:=GetPlayerUI[Player]
            then:
                PlayerUI.AddWidget(Widget, player_ui_slot{InputMode := ui_input_mode.All})
                PlayerInput.AddInputMapping(UI.MenuNavigationMapping);
                InputEvents := PlayerInput.GetInputEvents(UI.Back)
                spawn. DetectInputs(Player,InputEvents)

    DetectInputs(Player:player,InputEvents:input_events(logic))<suspends>:void=    
        InputEvents.TriggerActivationEvent.Await()
        if(PlayerUI:=GetPlayerUI[Player], PlayerInput:=GetPlayerInput[Player]):
            PlayerUI.RemoveWidget(Widget)
            PlayerInput.RemoveInputMapping(UI.MenuNavigationMapping)
        Sleep(0.0)

    OnBeginSimulation<override>():void =
        (super:)OnBeginSimulation()

    OnSimulate<override>()<suspends>:void =
        spawn. TriggerAwait()
        

wBackTest.zip

Full Changelog: SceneGraph...BackComponent