So I’m trying to track how many items have been collected and stop spawning them if too many have been collected. The following works fine, each time the player collects one it increments the number spawned variable, even after the character respawns at a checkpoint.
However, this one reports the number spawned variable as being 0 whenever the player respawns to bring the items back, and never reaches the maximum to stop spawning them.
I don’t understand, they should both be getting the variable from the same place so why is it different? I can only think that it’s because the second one loads up first, as everything is spawning in, but the Attempt to Spawn function is set to have a (currently) 0.2 second delay before it runs so that should already be delaying it enough for all the save functions to work properly.
Just to be clear, I’m not actually trying to do anything online or multiplayer lol. Edit: I put it in the gamemode so that everything can access it, putting it in the player kind of does the opposite of what I want
No, not talking about multiplayer. But there is only one gamemode, so only one copy of your variable. If you want a separate variable for each player ( or spawned AI ), you need to put it in the player.
yeah, Number Spawned is just an old name for the variable from when I was trying to use it to detect whether specific ones had been collected, which didn’t work even as well as this is now. The item spawner is the one from this video tutorial: https://www.youtube.com/watch?v=dbLFHflVleg and the Attempt to Spawn is part of that, it’s quite a large system so that’s probably the best I can explain it for now