Verse Library verse

02 As Long As The Disguise Device Is Enabled

Handles forcing players to carry items, triggering explosions, and displaying HUD feedback.

extracted-snippets/documentation/en-us/fortnite/36-10-fortnite-ecosystem-updates-and-release-notes/02-as-long-as-the-disguise-device-is-enabled.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/36-10-fortnite-ecosystem-updates-and-release-notes
# Local doc:  epic-docs/documentation/en-us/fortnite/36-10-fortnite-ecosystem-updates-and-release-notes.md
# Section:    ...as long as the Disguise Device is enabled
@editable
Carryable : carryable_spawner_device = carryable_spawner_device{}
@editable
ExplodeAgent : button_device = button_device{}
@editable
ForceCarry : button_device = button_device{}
ExplodeAgent.InteractedWithEvent.Subscribe(OnExplodeAgent)
ForceCarry.InteractedWithEvent.Subscribe(OnForceCarry)
Carryable.ExplodeEvent.Subscribe(OnExplode)
# Forces instigating player to carry the Carryable...
# ... and gets the carrying agent and location of the carryable
OnForceCarry(Agent:agent):void=
if(Player := player[Agent]):
Carryable.ForcePlayerToCarry(Player)
MaybeAgent := Carryable.CarryingAgent
MaybeTransform := Carryable.CarryableObjectTransform
if (CarryAgent := MaybeAgent?):
if (CarryTransform := MaybeTransform?):
HUDMessageDevice.Show(Message(Agent, "has the Carryable at {CarryTransform.Translation}!"))
# Explodes the Carryble and assigns the passed agent as the instigator
OnExplodeAgent(Agent:agent):void=
Carryable.Explode(Agent)
# Listening for Carryable explosion
OnExplode(MaybeAgent:?agent, AgentArray:[]agent):void=
if(Agent := MaybeAgent?):
HUDMessageDevice.Show(Message(Agent, "exploded the Carryable! {AgentArray.Length} player(s) caught in the explosion!"))

Comments

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