I am trying to use an array in a function without directly referring to it so I can reuse the function for other arrays, but I don’t know how to do that. Any easy fix / solution for this?
weighteditemgrant := class<concrete>(): # The class that stores the item granter and weight
@editable Granter : item_granter_device = item_granter_device{}
@editable Weight : int = 0
# A Verse-authored creative device that can be placed in a level
verse_weaponrandomiser := class(creative_device):
@editable TriggerInput : trigger_device = trigger_device{}
@editable ShotgunArray : []weighteditemgrant = array {}
@editable RangedArray : []weighteditemgrant = array {}
@editable HealingArray : []weighteditemgrant = array {}
@editable MobilityArray : []weighteditemgrant = array {}
@editable DefenseArray : []weighteditemgrant = array {}
@editable MiscArray : []weighteditemgrant = array {}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
# TODO: Replace this with your code
TriggerInput.TriggeredEvent.Subscribe(DeviceActivated) # At game start, subscribe the device to the corrosponding trigger
DeviceActivated(MaybeAgent : ?agent) : void= # MaybeAgent is the instigator? Will have to check
Print("WeaponRandomiser Activated")
PickFromArray(ShotgunArray)
PickFromArray(UsedArray : array {} , MaybeAgent : ?agent) : void= #Expected a type, got array value instead
var TotalWeight : int = 0