Get Position of triggering Player

This code make a Prop follow the Player 0 but how do I make him follow the person who triggered the PrimarySignal?:

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



spawncloud := class(creative_device):

    @editable
    CloudProp : creative_prop = creative_prop{}

    @editable
    SignalRemoteBlue : signal_remote_manager_device = signal_remote_manager_device{}
    

    @editable
    MaxDistanceToPlayer<private> : float = 5.0

    HandlePrimaryButton( P : agent) : void =
        if(F := P.GetFortCharacter[]):
            spawn {DoFollowPlayer()}


    DoFollowPlayer()<suspends> : void = 
        loop:
            vector5 := vector3 {X:= 0.0, Y:= 0.0, Z:= 350.0}
            if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[0].GetFortCharacter[]):
                PlayerPosition : vector3 = FortniteCharacter.GetTransform().Translation
                CloudProp.MoveTo(PlayerPosition + vector5, rotation{}, 0.1)
            else:
                break
    

    OnBegin<override>()<suspends>:void=
        SignalRemoteBlue.PrimarySignalEvent.Subscribe(HandlePrimaryButton)
1 Like

HandlePrimaryButton has the agent you are looking for, do what you need in that function or pass the parameter through to DoFollowPlayer().
Here is an example for HandlePrimaryButton to get you started

HandlePrimaryButton( P : agent) : void =
    vector5 := vector3 {X:= 0.0, Y:= 0.0, Z:= 350.0}
    if(F := P.GetFortCharacter[]):
        PlayerPosition : vector3 = F.GetTransform().Translation
            CloudProp.MoveTo(PlayerPosition + vector5, rotation{}, 0.1)
1 Like

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