Announcement

Collapse
No announcement yet.

True for loop

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

    True for loop

    The standard blueprint UE4 for loop has some features missing from it, I fixed this with this simple edit
    from this
    Click image for larger version

Name:	standard bp for loop.png
Views:	1
Size:	255.5 KB
ID:	1160622
    to this
    Click image for larger version

Name:	True For Loop.png
Views:	1
Size:	290.1 KB
ID:	1160625
    make sure that the ref variable is passed by reference btw or else it wont work, simply hit the pass by reference button.
    Please tell me if someone else found this fix
    Edit:
    Oops please forgive me I forgot to plug in the ref to the less than or equal to side of the branch
    Edit:
    Oops please forgive me again I forgot in my original edit to plug the ref to the incrementer this time facepaws really hard at own stupidity
    Attached Files
    Last edited by leviathandragonflyer; 09-02-2015, 11:11 PM.

    #2
    I don't understand why you'd ever want to use the ref, it looks like the loop is just setting the ref value, which IMO is something that you'd generally not want. Oh, you should update your screenshots, it is hard to tell what fixes need to be made.
    Marketplace Assets

    Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
    Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
    Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

    Comment


      #3
      Not really sure why you'd really need to make this change, but I guess it might help someone out there. I prefer to add checks in the loop itself for blueprint scripting.
      Movable Widgets

      Comment


        #4
        Yeah sorry about that, the point of the true for loop is basically to make it more like a C++ For loop where you have a variable you have access to throughout the entire loop. Basically the normal for loop sets the local variable which dies when that scope ends and is impossible to set outside of the loop. This means that if you ever want to change the value of the variable when you do the loop you can't unless you do something like this. The only real problem that could be created is the need for a variable inside the original function for the for loop.

        Comment

        Working...
        X