Hi,
Let me question how to set “trigger device” type Array’s element into new array.
Regarding to the official document,
Array | Epic Developer Community (epicgames.com)
I implemented the following verse code.
However, I confirm on Fortnite, the sentence “if(set “NewArray”[TriggerArrayIndex] = TriggeredCard):” fails to be executed. What is the cause of this problem?
Regards,
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Random }
using { /Verse.org/Verse }
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/UI }
using { /Verse.org/Colors }
using { /Verse.org/Simulation/Tags }
using { /Fortnite.com/Playspaces }
using { /Fortnite.com/Characters }
using { /UnrealEngine.com/Temporary/SpatialMath }
prop_teleport := class(creative_device):
@editable
TriggerCard : []trigger_device = array{}
OnBegin<override>()<suspends>:void=
# Prepare New Arrays
var SelectedCards : []trigger_device = array{}
var NonSelectedCards : []trigger_device = array{}
# Set the original array element into new ones
var TriggerArrayIndex : int = 0
for(Index -> TriggeredCard : TriggerCard):
if(ToString(Index) = CardNo):
Print("Test")
# This sentence fails to be executed
if(set SelectedCards[TriggerArrayIndex] = TriggeredCard):
Print("Selected!")
set TriggerArrayIndex += 1
else:
Print("Test2")
# This sentence fails to be executed
if(set NonSelectedCards[TriggerArrayIndex] = TriggeredCard):
Print("Out!")