Is there any way to set default values for the map? For example:
MyMap : [player]int = map{DefaultValue := 0}
Is there any way to set default values for the map? For example:
MyMap : [player]int = map{DefaultValue := 0}
You can’t (define a single value that will automatically be the default value if none is defined for a given key, you’d need a function to do that)
Hey @2GHSamburskoy ,
In your example you can assign an instance of player
to any int
you want when you declare your map.
For example, this code shows how to get the first player
in the Playspace and assign them 0
in the map.
var MyMap: [player]int = map{}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
if (MyPlayer := GetPlayspace().GetPlayers()[0], set MyMap[MyPlayer] = 0) {}
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.