I am making a summoning system where the player uses a spell to summon an AI to help them in combat, I got that part working.
My issue is I cant seem to set a limit to how many they can spawn, I only want 2 max. I am using the following code in the pictures to achieve this.
The array is not going higher than 0, every time the players casts the spell and its successful, it should +1 to the array so I can limit the amount they can spawn.
I have tried addunique and add array but neither work as intended. Not sure what to do, any help is appreicated!
I should also mention it is adding a BLUEPRINT to the array, e.g. my AI. Not sure if that affects anything
Each one of the AI will have a distinct actor reference. So add unique will always add, because all the references are different. The array will be growing in size, I assume your code for checking that is a bit buggy somewhere.
The AddUnique node does not return the array length, it returns the index of the newly added element.
So if it prints 0 after the first summon, that’s expected.
Does it always print 0 even after several consecutive summons?
Neither of these work, add or add unqiue prints 0 non stop (so infinite spawn)
Increment adds 1 then stops counting, meaning if I want two max minions, it will be infinite spawn too
Basically I only want 1 or 2 max, I want to be able to change that number in the future. But for now I will be thrilled to only be able to spawn in 1 AI. No more. Just for testing purposes
Sorry I mean, every time I cast my spell 1 spawns. Only 1. But I can recast and spawn another 1. Even though my interger is set to only spawning 1 max. Every new cast will always spawn additional AI, one at a time