Verse Library verse

24 Complete Script

Handles trigger enter events to pause movement, enable abduction beams, and detect entities using sweep hits.

extracted-snippets/documentation/en-us/fortnite/sample-tutorial-03-flexible-gameplay-in-fortnite/24-complete-script.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/sample-tutorial-03-flexible-gameplay-in-fortnite
# Local doc:  epic-docs/documentation/en-us/fortnite/sample-tutorial-03-flexible-gameplay-in-fortnite.md
# Section:    Complete Script
using { /Verse.org }
using { /Verse.org/Native }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
using { /Verse.org/Colors }
using { /Verse.org/SceneGraph/KeyframedMovement }
using { /Verse.org/SpatialMath }
using { /Fortnite.com/Game }
using { /Fortnite.com/Devices }
find_sweephits_example_component<public> := class<final_super>(component):
@editable
Trigger:volume_device = volume_device{}
var IsAbducting:logic = false
OnBeginSimulation<override>():void =
(super:)OnBeginSimulation()
if:
FortRoundManager := Entity.GetFortRoundManager[]
then:
FortRoundManager.SubscribeRoundStarted(OnRoundStarted)
OnRoundStarted():void=
Trigger.AgentEntersEvent.Subscribe(OnTriggerEntered)
Trigger.AgentExitsEvent.Subscribe(OnTriggerExited)
OnTriggerEntered(Agent:agent):void=
# When a cow is inside the abduction area, stop the ship moving and start the abduction beam.
if:
not IsAbducting?
MovementComponent := Entity.GetComponent[keyframed_movement_component]

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

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