Im struggling to move my prop that follows the player?
Every time I change the X value within my script, weather its a float or with a variable, if its larger than 0.0 it breaks and no longer raises and lowers my prop on the Z axis.
UpMovementKeyFrame: keyframe_delta = keyframe_delta
{
DeltaLocation := vector3{ X := 0.0, Y := 0.0, Z := 30.0 }
DeltaRotation := IdentityRotation()
DeltaScale := vector3{ X := 1.0, Y := 1.0, Z := 1.0 }
Time := 0.85
Interpolation := Ease
}
DownMovementKeyFrame: keyframe_delta = keyframe_delta
{
DeltaLocation := vector3{ X := 0.0, Y := 0.0, Z := -30.0 }
DeltaRotation := IdentityRotation()
DeltaScale := vector3{ X := 1.0, Y := 1.0, Z := 1.0 }
Time := 0.85
Interpolation := Ease
}
set IdleAnimationKeyFrames = array{ UpMovementKeyFrame, DownMovementKeyFrame }
GetPlayspace().PlayerRemovedEvent().Subscribe(OnPlayerLeft)
loop:
Sleep(SleepTime)
for (Player : GetPlayspace().GetPlayers(), AgentData := AgentMap[Player],
PetPropTuple := AgentData.OwnedPets[AgentData.ActivePetIndex], FortCharacter := Player.GetFortCharacter):
PetProp: creative_prop = PetPropTuple(0)
PetLoc: vector3 = PetProp.GetTransform().Translation
PlayerLoc: vector3 = FortCharacter.GetTransform().Translation
DistanceToPlayer: float = Distance (PetLoc, PlayerLoc)
if (DistanceToPlayer > FollowDistance):
if (Direction := (PlayerLoc - PetLoc).MakeUnitVector[]):
DistanceToTravel: float = DistanceToPlayer - WaitDistance
var LocationToTravel : vector3 = PetLoc + (Direction * DistanceToTravel)
set AgentData.bPetPlayingAnim = false
if (PropAnimController := PetProp.GetAnimationController[]):
PropAnimController.Stop()
PlayerRotation := FortCharacter.GetTransform().Rotation
spawn{PetProp.MoveTo(LocationToTravel, PlayerRotation, SleepTime)}
else:
if (AgentData.bPetPlayingAnim = false):
set AgentData.bPetPlayingAnim = true
if (PropAnimController := PetProp.GetAnimationController[]):
PropAnimController.SetAnimation (IdleAnimationKeyFrames, ?Mode := animation_mode.Loop)
PropAnimController.Play()