How to open portal when coins = 0?

For every coin you spawn you give the coin a reference to the spawning object. I would recommend spawning them in the game mode. Also remember to add one to a counting variable every time you spawn a coin.

In the coin actor you simply use the reference to the game mode and call a function that deducts one from the counting variable when a player picks the coin up.

Then, every time a coin is picked up and you call that deduct function you also check if the variable has reached 0 after the deduction. If so, spawn the portal.

Hope this helps.

So I’m creating a basic multiplayer game where the goal is to collect the largest amount of coins. There will be five levels. However, I don’t want the portal for the next level to appear until all of the coins are gone. How can I achieve this? The main thing I’m stumped over is how I’d be able to keep track of the total number of coins remaining in the current level. Once that value reaches zero, a function would be triggered. Thoughts?

That seems like a logical solution. I’ll give it a shot…

When you begin the game, you can call a node to get all the actors of a class and you’ll get an array of the coins. The array length is the number of coins. This is an initial value you can store inside of your game state. When a player picks up a coin, you can call a function which reduces the number of coins remaining. Every time a coin is picked up, you can try to fire an event which opens up a portal.