i’m trying to make a custom character instead of the fortnite character, but i want that every one have a custom character for their self (idk if it’s understandable) and when someone die the prop disappear but when you wanna take it again, youre invisible, so what i should add or change to my code to make it perfect `using { /Fortnite.com/Game }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
model3d := class(creative_device):
@editable
FreddyProp : creative_prop = creative_prop{}
@editable
RunAnim : cinematic_sequence_device = cinematic_sequence_device{}
@editable IdleAnim : cinematic_sequence_device = cinematic_sequence_device{}
@editable JumpAnim : cinematic_sequence_device = cinematic_sequence_device{}
@editable CrouchAnim : cinematic_sequence_device = cinematic_sequence_device{}
@editable Button : button_device = button_device{} # Bouton
var IsCinematicPlaying : logic = false
UpdateModel(Agent : agent) <suspends> : void =
if (Fort := Agent.GetFortCharacter[]):
Fort.Hide()
IdleAnim.Play(Agent)
Fort.CrouchedEvent().Subscribe(OnCrouched)
Fort.JumpedEvent().Subscribe(OnJumped)
Fort.SprintedEvent().Subscribe(OnMoved)
Fort.EliminatedEvent().Subscribe(PlayerKilled)
loop:
if (Fort.IsActive[]):
PlayerPos := Fort.GetTransform().Translation
FreddyPos := FreddyProp.GetTransform().Translation
DistanceFromPlayer := Distance(PlayerPos, FreddyPos)
DirectionFreddyToPlayer := PlayerPos - FreddyPos
Angle := ArcTan(DirectionFreddyToPlayer.X, DirectionFreddyToPlayer.Y) - 3.14 / 2.0
NewRotation := MakeRotation(vector3{X := 0.0, Y := 0.0, Z := -1.0}, Angle)
FreddyProp.MoveTo(PlayerPos, NewRotation, 0.1)
if (not Fort.IsActive[]):
break
OnMoved(MoveData : tuple(fort_character, logic)):void=
if (Agent := MoveData(0).GetAgent[]):
if (MoveData(1)?):
IdleAnim.Stop(Agent)
RunAnim.Play(Agent)
else:
RunAnim.Stop(Agent)
IdleAnim.Play(Agent)
OnCrouched(CrouchData : tuple(fort_character, logic)) : void =
if (Agent := CrouchData(0).GetAgent[]):
if (CrouchData(1)?):
IdleAnim.Stop(Agent)
CrouchAnim.Play(Agent)
else:
CrouchAnim.Stop(Agent)
IdleAnim.Play(Agent)
OnJumpFinished(Player : fort_character) : void =
if (Agent := Player.GetAgent[]):
JumpAnim.Stop(Agent)
IdleAnim.Play(Agent)
OnJumped(Player : fort_character) : void =
if (Agent := Player.GetAgent[]):
JumpAnim.Play(Agent)
PlayerKilled(Player : elimination_result) : void =
Print("Player Eliminated")
FreddyProp.Dispose() # Cacher le modèle lorsque le joueur est éliminé
HandleAgentTrigger(Agent : agent) : void =
spawn:
UpdateModel(Agent)
HandlePlayerSprint(Agent : agent) : void =
{}
OnBegin<override>() <suspends> : void =
Button.InteractedWithEvent.Subscribe(HandleAgentTrigger)`