Verse Library verse

01 Snippet

Automatically respawns players at a set location when a player counter device detects them.

extracted-snippets/community/snippets/eYv/fortnite-quick-simple-script-bring-back-spectators/01-snippet.verse

# Source URL: https://dev.epicgames.com/community/snippets/eYv/fortnite-quick-simple-script-bring-back-spectators
# Local doc:  epic-docs/community/snippets/eYv/fortnite-quick-simple-script-bring-back-spectators.md
  using { /Fortnite.com/Devices }
  using { /Verse.org/Simulation }
  using { /UnrealEngine.com/Temporary/Diagnostics }
  using { /Fortnite.com/FortPlayerUtilities }
  using { /UnrealEngine.com/Temporary/SpatialMath }
  RespawnDevice := class(creative_device):
  varvector :vector3= vector3{X := 0.0, Y := 0.0 ,Z := 0.0}
  @editable
  PlayerCounter : player_counter_device = player_counter_device{}
  OnBegin<override>()<suspends>:void=
  PlayerCounter.CountedEvent.Subscribe(PlayerCounted)
  PlayerCounted(Agent : agent) : void =
  if(InPlayer := player[Agent]):
  Agent.Respawn(varvector,rotation{})

  Expand code  Copy full snippet(20 lines long)
* ```
  |  |  |
  | --- | --- |
  |  | Compare Player Count: "Do Not Compare" |
  |  | Transmit on Player Counted/Removed: "Signal Only" |

Comments

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