Verse Library verse

01 Creating A Verse Script For Player Spawning

Manages dynamic team spawn points near capture points based on ownership and ally proximity weights.

extracted-snippets/documentation/en-us/fortnite/deserted-domination-template-in-unreal-editor-for-fortnite/01-creating-a-verse-script-for-player-spawning.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/deserted-domination-template-in-unreal-editor-for-fortnite
# Local doc:  epic-docs/documentation/en-us/fortnite/deserted-domination-template-in-unreal-editor-for-fortnite.md
# Section:    Creating a Verse Script for Player Spawning
# Copyright Epic Games, Inc. All Rights Reserved.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Teams }
using { /Verse.org/Simulation }
using { /Verse.org/Simulation/Tags }
## This device manages the player spawners
## An intial set of spawners starts enabled
## After a short time, the initial spawners are disabled
## From there, team spawns associated with each capture point are enabled/disabled based off a weighting score
##     Owning the point adds 1 to the weighting score (or -1 if team 2)
##     Each ally in the area adds 1 to the weighting score (or -1 if team 2)
##     If the weighting score is > 0, team 1 can spawn near the point.
##     If the weighting score is < 0, team 2 can spawn near the point
##################################################################
## Event Handler Class - We'll spawn one of these per capture point and bind events through it
##################################################################
capture_point_event_handler := class:
CapturePointIndex:int
DominationSpawnManagerRef:domination_spawn_manager
TeamCollectionRef:fort_team_collection
var CaptureWeightOfThisPoint:int = 0
var PlayerWeightOfThisPoint:float = 0.0
WeightForEachPlayer:float = 0.5
# If Team 1, we return 1.  If Team 2, we return -1.
GetTeamDirectionOfAgent<private>(MyAgent:agent)<transacts>:int=
if (FirstTeam := TeamCollectionRef.GetTeams()[0]):
if (TeamCollectionRef.IsOnTeam[MyAgent, FirstTeam]):

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