I don’t understand how this interaction between functions works.
I’ve isolated this interaction from a much complex system of functions but the way it works on the original is:
I add items to an array with a function but it can only add 1 kind of item at a time. So when I want to add multiple types of items I call for multiple functions with different parameters. At the end of this function calls an “Update” function that creates the objects in game to display on the correspondent slot. And it worked great until I started polishing the number of actions per tick, etc.
Then I realised that functions executed from a trigger start at the same time or that’s what I think… So they end up overlapping conditions and duplicating the number of objects to create.
I realise I can fix this by adding a Wait action between “Add” functions. But I don’t quite understand triggers, functions, and wait when they all work together.
For example sometimes a function that’s at the end of the action list after a condition, triggers before other actions even tho it’s placed at the very end, I usually fix this by using wait. But this generate other kind of problems that I haven’t tested yet but it appears that using wait on some functions erase the parameters so following event on that function won’t be able to use them.
(but I’m not sure that is what it’s happening.)
So my question is: What’s the best way to go about using this functions all at once? Should I place wait actions after every function call? Or Is there a better way?
Here’s the capx and a screenshot:
dropbox.com/s/4668ibs6wdgs3kt/Debugging_Update_Problem.capx