For my level, I have a set of 4 volumes and an NPC Spawner corresponding to each one. What should be happening is while you’re in the volume NPCs will spawn from that corresponding spawner, but when you leave it will disable it. Instead, NPCs spawn out of only 1 spawner regardless of which volume you’re in. The easiest solution is to break these into 4 separate classes but for my sanity I’d rather not, I know I can do this without verse but I’m using verse as I’m adding a mechanic later on. Below is my script showing my issue.
Heres my Code:
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
SpawnManager := class(creative_device):
# Volume Devices
@editable
VolumeN:volume_device = volume_device{}
@editable
VolumeE:volume_device = volume_device{}
@editable
VolumeS:volume_device = volume_device{}
@editable
VolumeW:volume_device = volume_device{}
@editable
NPCSpawnerN:npc_spawner_device = npc_spawner_device{}
@editable
NPCSpawnerE:npc_spawner_device = npc_spawner_device{}
@editable
NPCSpawnerS:npc_spawner_device = npc_spawner_device{}
@editable
NPCSpawnerW:npc_spawner_device = npc_spawner_device{}
@editable
MySwitchDevice:switch_device = switch_device{}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
VolumeN.AgentEntersEvent.Subscribe(OnAgentEntered)
VolumeE.AgentEntersEvent.Subscribe(OnAgentEntered)
VolumeS.AgentEntersEvent.Subscribe(OnAgentEntered)
VolumeW.AgentEntersEvent.Subscribe(OnAgentEntered)
VolumeN.AgentExitsEvent.Subscribe(OnAgentExit)
VolumeE.AgentExitsEvent.Subscribe(OnAgentExit)
VolumeS.AgentExitsEvent.Subscribe(OnAgentExit)
VolumeW.AgentExitsEvent.Subscribe(OnAgentExit)
OnAgentEntered(Agent:agent):void=
if (MySwitchDevice.GetCurrentState[] and VolumeN.AgentEntersEvent):
NPCSpawnerN.Enable()
else if (MySwitchDevice.GetCurrentState[] and VolumeE.AgentEntersEvent):
NPCSpawnerE.Enable()
else if (MySwitchDevice.GetCurrentState[] and VolumeS.AgentEntersEvent):
NPCSpawnerS.Enable()
else if (MySwitchDevice.GetCurrentState[] and VolumeW.AgentEntersEvent):
NPCSpawnerW.Enable()
OnAgentExit(Agent:agent):void=
if (MySwitchDevice.GetCurrentState[] and VolumeN.AgentExitsEvent):
NPCSpawnerN.Disable()
else if (MySwitchDevice.GetCurrentState[] and VolumeE.AgentExitsEvent):
NPCSpawnerE.Disable()
else if (MySwitchDevice.GetCurrentState[] and VolumeS.AgentExitsEvent):
NPCSpawnerS.Disable()
else if (MySwitchDevice.GetCurrentState[] and VolumeW.AgentExitsEvent):
NPCSpawnerW.Disable()`Preformatted text`