How can I create an array within a GSC script? I keep getting syntax errors.
-
self.MileStoneRound_1 = 5; // First Milestone Round (default round 5)
self.MileStoneRound_2 = 10; // Second Milestone Round (default round 10)
self.MileStoneRound_3 = 15; // Third Milestone Round (default round 15)
self.MileStoneRound_4 = 20; // Fourth Milestone Round (default round 20)
self.MileStoneRound_5 = 25; // Fifth Milestone ROund (default round 25)
self.MileStoneRound_6 = 30; // Sixth Milestone Round (default round 30)
self.MileStoneRound_7 = 35; // Seventh Milestone Round (default round 35)
self.MileStoneRound_8 = 40; // Eighth Milestone Round (default round 40)I want to create an array that contains integers between 1 and 255 representing rounds.
array<int> myArrayMilestoneRound0 = [1, 2, 3, 4, 6, 7, 8, 9];
self.MileStoneRound_0 = myArrayMilestoneRound0[0];I know this will only cast the first element of the array to the variable ill add a for loop later that cycles through the array but I cant figure out what's wrong with the array syntax to begin with.
-
Its just
ArrayName = [];
. -
DylanBeast777 The best way to learn GSC syntax is to read the stock scripts for the game you want to make mods for.
-
On BO2:
- Empty array:
myArray = [];
- Populated array:
myArray = array(1,2,3);
- Empty array: