Announcement

Collapse
No announcement yet.

Noticed something weird with loop index

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Noticed something weird with loop index

    Hey there, I noticed something really strange today with loop index or maybe I'm don't really follow how loops and their index work. But anyway, in the first image, I set my loop index from 0 - 1 to create 2 players and i am setting the return value to a playercontroller array and later with 2 gets, I set my playercontroller1 and playercontroller2. (This is for local multiplayer game). The "Get" with index 0 doesn't return anything, whereas the "Get" with index 1, returns one of the 2 playercontroller spawned.

    In the 2nd image, I changed my loop index to 1-2 and its returns value for both "Get". Is there a reason why it doesn't return anything on my "Get" with index 0, when I have my loop index set from 0-1?Click image for larger version

Name:	Img1.jpg
Views:	1
Size:	98.6 KB
ID:	1175329Click image for larger version

Name:	img2.jpg
Views:	1
Size:	103.7 KB
ID:	1175330

    #2
    It really depends on the array that you are looping on and at what indexes the controllers were assigned. It should start at zero, not 1 or that would be really confusing.

    Comment


      #3
      Originally posted by mikepurvis View Post
      It really depends on the array that you are looping on and at what indexes the controllers were assigned. It should start at zero, not 1 or that would be really confusing.
      In my case when I start my loop index from 0, it returns "none", sadly.

      Comment


        #4
        Yes, but that has everything to do with the array you are looping. It is valid for something to be set to none.

        Comment


          #5
          I figured it out. The first player controller is spawned by default, which is assigned the id 0. The 'Create Player' node fails to return a valid player controller for loop index 0.

          Comment

          Working...
          X