This will always create 1 more PowerCell than the PowerCellCount Variable. For example if the PowerCellCount is 3 it will create 4 PowerCell Objects. This isn’t a big problem since I can adjust the math as needed I’m just curious why this happens. If PowerCellCount is 3 and each time a PowerCell is created it reduces PowerCellCount by 1 it seems like it should only create 3 PowerCells, not 4.
I think the reason is in the order. To achieve the effect you want you could try -= PowerCellCount before you create one. Since you create the object before you reduce the counter, you always have 1 more than the counter value at the end of the events.
I think you might be doing something wrong - I’ve tried the same thing using a counter starting at 10, and get 10 objects being created. Do you have any other “create object PowerCell” actions in any other event? Or do you have one already placed in the scene?
@fitkoh, no, that’s wrong. It doesn’t matter if the decrease is before or after the create, the order it gets done in the subevent won’t influence the condition of the while statement. If the decrease is before or after the create, it won’t prevent the create from happening.
Thanks for the help, I did track it down and find that I already had one of the objects in the scene. What a silly mistake but thanks again for helping me troubleshoot it. And I’m glad it works like I expected it to!
Hi again, I’m just curious about this. Does the order of the Actions matter in general then? I guess I’m asking do they actually happen from the top of the list down? Just trying to understand things more clearly. Thanks!
You misunderstood the quote - it points out that the decrease is only used by the condition, and not by other actions in the group of actions. Placement of the decrease within the group of actions (as had been suggested) won’t affect the condition.
If PowerCellCounter had a dependency within the group of actions, then would make a difference to those actions, but not to the condition.