Hi guys!
I have tried something and I’d like to know if the behaviour is normal/intended or if I’m being stupid!
I’ve created a “dummy” object called LEVEL1 in which I wanted to put a couple a variables. For example, the number of times I wanted an object to be created at the start of the level.
I tried to use a for loop using the variable in the LEVEL1 “dummy” object but it doesn’t work. When I replace that variable by a number, it works.
Any variable should work in a repeat. The object would have to be in the scene not just defined. Without a live object it would most likely return the value zero.
If there were more than 1 object then without any conditions it would choose the oldest object.
Why not just use a scene or global variable?
Tip, it’s usually best not to put a trigger once inside a loop. It rarely works as expected. It’s better to have the loop event be a subevent of some other trigger like at the beginning.
at the beginning
… Repeat x times
…
Even if it works as expected the first time, it will continue to repeat x times on every frame using unnecessary process time just to evaluate the trigger once condition x times.
@Keith_1357 Thanks for your reply!
Oh! Yeah! My dummy Object LEVEL1 isn’t in the scene! So that’s why it doesn’t work! I’ll give it a try!
Well, I thought about the Global or Scene variable solution but I have more variables planned for each Level and I thought it would be more handy this way, having all the specific variables for Level1 centralise. But I guess I could have used a structure global/scene variable? I’ve never used them so I don’t really know how they work just yet…Although I could give that a try as well!
Gotcha for the for loop! That’s definitely good advice that I’ll follow
EDIT : Yeah! I made the changes and as expected, it works perfectly! Thanks again!