I’m trying too find the nearest player, then spawn a cloud above him that follows him, now I got the cloud thing to work but I can’t find the nearest player position, when I try to find him I want to use && but it says “vErr:S60: Precedence doesn’t allow “&” following “&”(3100)”. I would appreciate any help, here’s my code so far:
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
DoFollowPlayer()<suspends> : void =
loop:
vector5 := vector3 {X:= 0.0, Y:= 0.0, Z:= 350.0}
if(F := P.GetFortCharacter[]):
PlayerPositiont : vector3 = F.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[0].GetFortCharacter[]):
PlayerPosition : vector3 = FortniteCharacter.GetTransform().Translation
CloudProp.MoveTo(PlayerPosition + vector5, rotation{}, 0.1)
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[1].GetFortCharacter[]):
PlayerPosition1 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[2].GetFortCharacter[]):
PlayerPosition2 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[3].GetFortCharacter[]):
PlayerPosition3 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[4].GetFortCharacter[]):
PlayerPosition4 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[5].GetFortCharacter[]):
PlayerPosition5 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[6].GetFortCharacter[]):
PlayerPosition6 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[7].GetFortCharacter[]):
PlayerPosition7 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[8].GetFortCharacter[]):
PlayerPosition8 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[9].GetFortCharacter[]):
PlayerPosition9 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[10].GetFortCharacter[]):
PlayerPosition10 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[11].GetFortCharacter[]):
PlayerPosition11 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[12].GetFortCharacter[]):
PlayerPosition12 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[13].GetFortCharacter[]):
PlayerPosition13 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[14].GetFortCharacter[]):
PlayerPosition14 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[15].GetFortCharacter[]):
PlayerPosition15 : vector3 = FortniteCharacter.GetTransform().Translation
if(PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[16].GetFortCharacter[]):
PlayerPosition16 : vector3 = FortniteCharacter.GetTransform().Translation
Distance1 : float = (PlayerPositiont - PlayerPosition).Size()
Distance2 : float = (PlayerPositiont - PlayerPosition1).Size()
Distance3 : float = (PlayerPositiont - PlayerPosition2).Size()
Distance4 : float = (PlayerPositiont - PlayerPosition3).Size()
Distance5 : float = (PlayerPositiont - PlayerPosition4).Size()
Distance6 : float = (PlayerPositiont - PlayerPosition5).Size()
Distance7 : float = (PlayerPositiont - PlayerPosition6).Size()
Distance8 : float = (PlayerPositiont - PlayerPosition7).Size()
Distance9 : float = (PlayerPositiont - PlayerPosition8).Size()
Distance10 : float = (PlayerPositiont - PlayerPosition9).Size()
Distance11 : float = (PlayerPositiont - PlayerPosition10).Size()
Distance12 : float = (PlayerPositiont - PlayerPosition11).Size()
Distance13 : float = (PlayerPositiont - PlayerPosition12).Size()
Distance14 : float = (PlayerPositiont - PlayerPosition13).Size()
Distance15 : float = (PlayerPositiont - PlayerPosition14).Size()
Distance16 : float = (PlayerPositiont - PlayerPosition15).Size()
Distance17 : float = (PlayerPositiont - PlayerPosition16).Size()
if (Distance1 < Distance2 && Distance1 < Distance3 && Distance1 < Distance4 && Distance1 < Distance5 &&
Distance1 < Distance6 && Distance1 < Distance7 && Distance1 < Distance8 && Distance1 < Distance9 &&
Distance1 < Distance10 && Distance1 < Distance11 && Distance1 < Distance12 && Distance1 < Distance13 &&
Distance1 < Distance14 && Distance1 < Distance15 && Distance1 < Distance16 && Distance1 < Distance17)
{
CloudProp.MoveTo(PlayerPosition, rotation{}, 0.1)
}
else if (Distance2 < Distance3 && Distance2 < Distance4 && Distance2 < Distance5 &&
Distance2 < Distance6 && Distance2 < Distance7 && Distance2 < Distance8 && Distance2 < Distance9 &&
Distance2 < Distance10 && Distance2 < Distance11 && Distance2 < Distance12 && Distance2 < Distance13 &&
Distance2 < Distance14 && Distance2 < Distance15 && Distance2 < Distance16 && Distance2 < Distance17)
{
CloudProp.MoveTo(PlayerPosition1, rotation{}, 0.1)
}
HandlePrimaryButton( P : agent) : void =
DoFollowPlayer()
OnBegin<override>()<suspends>:void=
SignalRemoteBlue.PrimarySignalEvent.Subscribe(HandlePrimaryButton)