Download

Not sure I understand For Loops

Last night I put some more work into a dialogue system. I did this tutorial and it taught me the concept of making blueprints into components and how it might apply to a dialogue system.

I then tried to make a ‘talker’ component.

img6.png

Don’t worry about the pink > pink converter with no label. That just turns the string into the ‘localizable text’ type.
I have this component applied to a cube in the template level I’m working in.

8b031ed37028c70cf02d770679d6001e7d082ef4.jpeg

I get the results above from the object shown below (note the entries in the dialogue section, this section is there because of the public (eye open icon) string array in the blueprint component Talker_Component. I had simply dragged it into the place where it appears below.

7b1a4d27edf5c78f85e880d0d83b3065cc4fbfec.jpeg

8b031ed37028c70cf02d770679d6001e7d082ef4.jpeg

So, as you can see, something is wrong with my logic. I didn’t know how to tell the computer to just say all the dialogue and then be done. I still don’t :slight_smile:
I think this is probably basic logic 101 stuff. Hopefully, I will get these basics figured out.

You are doing the loop inside the Event Tick. The Event Tick is called every frame.

If you want the loop to run only once you have to put a gate in front of the loop or put the loop outside the Event Tick.

Oh, right! I didn’t realize it just kept sending impulses to the for loop every frame (so it was running every frame). Thank you.