Simple Custom Streaming Guide
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.
my_debug_draw := class(debug_draw_channel) {}
# A Verse-authored creative device that can be placed in a level
Prop_Manager := class(creative_device):
DebugDraw:debug_draw = debug_draw{Channel := my_debug_draw}
@editable Props : []PropClass = array{}
@editable SpawnRange : float = 500.0
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
loop:
Sleep(1.0)
AllPlayers := GetPlayspace().GetPlayers()
for (Agent : AllPlayers):
if:
FortChar := Agent.GetFortCharacter[]
FortCharLoc : vector3 = FortChar.GetTransform().Translation
then:
DebugDraw.DrawSphere(Center := FortCharLoc, ?DrawDurationPolicy := debug_draw_duration_policy.FiniteDuration, ?Duration := 1.0, ?Radius := SpawnRange)
for(X:= 0..Props.Length):
if:
PropStruct := Props[X]
PropLocation : vector3 = PropStruct.Location
then:
Dist : float = Distance(FortCharLoc, PropLocation)
if(Dist < SpawnRange and PropStruct.ExistsInWorld = false):
PropProp : creative_prop_asset = PropStruct.Prop
SpawnedProp := SpawnProp(PropProp, PropLocation, PropStruct.Rotation)
if (CreativeProp := SpawnedProp(0)?):
if(set Props[X].WorldProp = CreativeProp):
if(set Props[X].ExistsInWorld = true):
Print("Added")
else if(Dist > SpawnRange and PropStruct.ExistsInWorld = true):
if(Prop : creative_prop = Props[X].WorldProp):
Prop.Dispose()
if(set Props[X].ExistsInWorld = false):
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.