[Question] Spawning Object/Actor after goal reached

Hello,

I’ve been having a hard time getting an object to spawn after reaching a certain goal. I’m working on the Endless Runner tutorial, and I wanted to add extra functionality to it. I wanted to make an actor spawn behind the player after you collect a certain amount of coins.

I created a function that determines the total coins needed for the goal to be reached (so I thought anyways)

And then I made it reference the Enemy Spawning blueprint I created

When I reach the goal that I set, it’s not spawning my object. As a place older I made a Cube that has projectile functionality and projects forward. I’m not sure if perhaps it is firing, but at a location where I can’t see it happening. How would I make it so it spawns directly behind the player? I had set up 3 spawn points where I thought they would spawn from, but it’s not happening.

Not to be rude but I have no idea what that script is.

What it should be though is you should use IF node to check if no of coins equals no of goal and then spawn the enemy directly, you don’t need a spawner

I am going to assume Add Coin increased your total coins. Right now your ReachCoin() isn’t doing anything, all it is doing it sending a 0 or 1 Int? value if Total Coins == 5. It is also unnecessary IMO

In your AddCoin() do +1 TotalCoins, +1 CoinGoal then put a Branch

If CoinGoal == 5 then Spawn Enemy -> Set CoinGoal = 0 return else do nothing Return

Awesome, thanks guys.