Yvan-Siva
(Yvan-Siva)
March 14, 2024, 10:53am
1
hello,
I don’t see a doc implement interface fort_character for /Fortnite.com/Characters
But I need a fort_character to compare the player’s position with a vector3.
@editable positionAgentLimitRotation: vector3 = vector3{}
Player: fort_character = fort_character{}
MakeRotation()<suspends>:void=
loop:
PropTransform := Platform_Elem.GetTransform()
if. Agent := Player.GetAgent[]
then:
ExceedsLimitResult: logic = ExceedsLimit(PositionPlayer(Agent), positionAgentLimitRotation)
if(ExceedsLimitResult = false):
if(isRotationY = true):
Platform_Elem.MoveTo(PropTransform.Translation, PropTransform.Rotation.ApplyLocalRotationY(360.0), RotationCompleteSecond)
else if(isRotationY = false):
Platform_Elem.MoveTo(PropTransform.Translation, PropTransform.Rotation.ApplyLocalRotationZ(360.0), RotationCompleteSecond)
PositionPlayer(Agent: agent):vector3=
if. FortCharacter := Agent.GetFortCharacter[]
then:
CharacterTranslation := FortCharacter.GetTransform().Translation
return CharacterTranslation
return vector3{}
ExceedsLimit(PlayerPosition: vector3, Limit: vector3): logic =
if(PlayerPosition.X > Limit.X or PlayerPosition.Y > Limit.Y or PlayerPosition.Z > Limit.Z):
return true
return false
Can you help me please ?
you could just use the distance or distancexy functions to return a float which is the distance in centimeters that the two vectors are from eachother
here’s an example
@editable Prop :creative_prop = creative_prop{}
GetDistance(Prop:creative_prop, FortCharacter:fort_character):logic=
PropLoc := Prop.GetTransform().Translation
FCharLoc := FortCharacter.GetTransform().Translation
Threshold := 1200.0
Dist := Distance(PropLoc, FCharLoc)
if(Dist >= threshold):
return true
return false
Yvan-Siva
(Yvan-Siva)
March 15, 2024, 1:23pm
4
I’ll check, an update a code, but I don’t see GetAgents in session class for create a loop for calculate distance. Can you help me ?
are you trying to make a loop that is always checking each players distance from that location?
if so you could do something like this
Player_Ref := class:
_Player : player
Test_Class := class(creative_device):
@editable Prop : creative_prop = creative_prop{}
Player_Distance_Event : event(Player_Ref) = event(Player_Ref){}
OnBegin<override>()<suspends>:void=
AllPlayers := GetPlayspace().GetPlayers()
for(Player:AllPlayers):
Player_Distance_Loop(Player, Prop)
Player_Distance_Loop(Player:player, Prop:creative_prop)<suspends>:void=
Sleep_Time := 1.0
loop:
Sleep(Sleep_Time)
if(FortCharacter := Player.GetFortCharacter[]):
FCharLoc := FortCharacter.GetTransform().Translation
Prop_Loc := Prop.GetTransform().Translation
Theshold := 1200.0
Dist := Distance(FCharLoc, Prop_Loc)
if(Dist >= Threshold):
Player_Distance_Event.Signal(Player_Ref{_Player = Player})
Await_Distance_Event()<suspends>:void=
loop:
Player := Player_Distance_Event.Await()
#Do something with Player here
if(Player.TeleportTo[#some location here or something]):
Yvan-Siva
(Yvan-Siva)
March 15, 2024, 2:18pm
6
No, I’ll check a current position Player, if distance > Threadold paused a rotation, I passe my actual code.
Player_Ref := class:
_Player : player
Rotation_Platform := class(creative_device):
@editable RotationCompleteSecond: float = 1.0
@editable Platform_Elem: creative_prop = creative_prop{}
# Default is Rotation on Z axis, if you want to rotate on Y axis, check this box
@editable isRotationY: logic = false
@editable positionAgentLimitRotation: vector3 = vector3{}
Player_Distance_Event : event(Player_Ref) = event(Player_Ref){}
@editable Threshold: float = 1200.0
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
if(RotationCompleteSecond = 0.0):
return
MakeRotation()
MakeRotation()<suspends>:void=
loop:
PropTransform := Platform_Elem
AllPlayers := GetPlayspace().GetPlayers()
for(Player:AllPlayers):
Player_Distance_Loop(Player, PropTransform)
Index := 0
loop:
if(Index >= AllPlayers.Length):
break
if. FortCharacter := Agent.GetFortCharacter[]
then:
ExceedsLimitResult := GetDistance(Platform_Elem, FortCharacter)
if(ExceedsLimitResult = false):
break
if(isRotationY = true):
Platform_Elem.MoveTo(PropTransform.GetTransform().Translation, PropTransform.GetTransform().Rotation.ApplyLocalRotationY(360.0), RotationCompleteSecond)
else if(isRotationY = false):
Platform_Elem.MoveTo(PropTransform.GetTransform().Translation, PropTransform.GetTransform().Rotation.ApplyLocalRotationZ(360.0), RotationCompleteSecond)
Index + 1
GetDistance(Prop: creative_prop, FortCharacter: fort_character): logic=
PropLoc := Prop.GetTransform().Translation
FCharLoc := FortCharacter.GetTransform().Translation
Dist := Distance(PropLoc, FCharLoc)
if(Dist >= Threshold):
return true
return false
Player_Distance_Loop(Player:player, Prop:creative_prop)<suspends>:void=
Sleep_Time := 1.0
loop:
Sleep(Sleep_Time)
if(FortCharacter := Player.GetFortCharacter[]):
FCharLoc := FortCharacter.GetTransform().Translation
Prop_Loc := Prop.GetTransform().Translation
Dist := Distance(FCharLoc, Prop_Loc)
if(Dist >= Threshold):
Player_Distance_Event.Signal(Player_Ref{_Player = Player})
Await_Distance_Event()<suspends>:void=
loop:
Player := Player_Distance_Event.Await()
#Do something with Player here
if(Player.TeleportTo[vector3{X = 0.0, Y = 0.0, Z = 0.0}]):
break
else:
Player.TeleportTo[vector3{X = 0.0, Y = 0.0, Z = 0.0}]