Verse Library verse

13 Manage Heartbeat Effects

Triggers heartbeat visual effects and registers player audio for spatial sound.

extracted-snippets/documentation/en-us/fortnite/prop-hunt-02-playing-visual-effects-on-players-in-unreal-editor-for-fortnite/13-manage-heartbeat-effects.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/prop-hunt-02-playing-visual-effects-on-players-in-unreal-editor-for-fortnite
# Local doc:  epic-docs/documentation/en-us/fortnite/prop-hunt-02-playing-visual-effects-on-players-in-unreal-editor-for-fortnite.md
# Section:    Manage Heartbeat Effects
# Activates the heartbeat VFX and SFX for the specified player.
Enable(PropAgent:agent, HeartBeatVFXData:heartbeat_vfx):void =
if:
# Get the character, which is used to find the prop agent's position in the scene.
Character := PropAgent.GetFortCharacter[]
then:
# Set the heartbeat VFX's position to the prop agent's position.
HeartBeatVFXData.Activate(Character.GetTransform())
# Increment the heartbeat count, and if this is the first heartbeat playing, we need to play the audio to get it started.
set NumberOfHeartBeats += 1
if (NumberOfHeartBeats = 1) then SFXPlayer.Play()
# Register the prop agent to the audio player device so the heartbeat audio will play from that position.
SFXPlayer.Register(PropAgent)
else:
Logger.Print("Character, Index, or HeartBeatVFXData not found. Cannot start the heartbeat")

Comments

    Sign in to vote, comment, or suggest an edit. Sign in