Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. How can I create an array within a GSC script? I keep getting syntax errors.

How can I create an array within a GSC script? I keep getting syntax errors.

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
4 Posts 4 Posters 910 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • DylanBeast777undefined Offline
    DylanBeast777undefined Offline
    DylanBeast777
    wrote on last edited by
    #1

    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.

    JezuzLizardundefined 1 Reply Last reply
    0
    • Xerxesundefined Offline
      Xerxesundefined Offline
      Xerxes
      Plutonium Staff
      wrote on last edited by
      #2

      Its just ArrayName = [];.

      1 Reply Last reply
      0
      • DylanBeast777undefined DylanBeast777

        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.

        JezuzLizardundefined Offline
        JezuzLizardundefined Offline
        JezuzLizard
        Plutonium Staff
        wrote on last edited by
        #3

        DylanBeast777 The best way to learn GSC syntax is to read the stock scripts for the game you want to make mods for.

        https://github.com/plutoniummod/t6-scripts

        1 Reply Last reply
        0
        • Resxtundefined Online
          Resxtundefined Online
          Resxt
          Plutonium Staff
          wrote on last edited by
          #4

          On BO2:

          • Empty array: myArray = [];
          • Populated array: myArray = array(1,2,3);
          1 Reply Last reply
          0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Donate