I want to add a timed feature for color-changing devices that set the team back and forth using the SetTeam function. I got the player’s agent using the below code, but I want to get the other team’s Agent to switch dynamically. Any idea on how to implement this?
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.
# A Verse-authored creative device that can be placed in a level
ReactiveColorFloor_device := class(creative_device):
@editable var ColorFloorTiles : []color_changing_tiles_device = array{}
# Runs when the device is started in a running game
var Team : []team = array{}
var Alternate : logic = false
OnBegin<override>()<suspends>:void=
# TODO: Replace this with your code
for (Row := 0..ColorFloorTiles.Length - 1):
if (Tile := ColorFloorTiles[Row]):
if:
FirstPlayer := Self.GetPlayspace().GetPlayers()[0]
MyAgent := FirstPlayer.GetFortCharacter[].GetAgent[]
then:
Tile.SetTeam(MyAgent)
Hi Thomas,
Thanks for your reply. This takes care of setting the agent, but how would I get the second team’s agent?
For example, this code gets the Agent of the first player. Similarly I need to get the Agent of Team 2,3,etc…
I guess I’m sort of confused by the actual progression of this game mechanic, but basically you’re able to store any amount of agents you want that way, and if you need you could do it in an array where it keeps track of them in a specific order, etc.