How To Spawn Actor at Specific Time?

I created a pickup item that destroys itself once the player touches it. Now, I want to know how can I make it so it spawns at specific time. The whole blueprints start with On Component Begin Overlap and that’s how I make the item disappear once the player touches it.

The problem is that it always spawn when I click play. I want that item to spawn every 30-60 seconds as soon as I begin playing.

Well the obvious solution is to use a delay. Create a custom event that’s fired on Begin Play (or on Begin Overlap).

You can manually enter any delay time you need, or use a randomizer like in the example.

@Tuerer Where am I supposed to connect the spawn a pickup to? Also what do you mean with fired on Begin Play? Sorry, I’m not used to using UE4.

That SpawnActor nod on the screenshot, you select your pickup blueprint there. Is you don’t have a blueprint, but only a model of your pickup, add a blueprint to it.
You can split the Spawn Transform pin to only set the location and/or rotation of your pickup.
To create a custom event, right click anywhere in your blueprint and type in Custom, it must be there. You can name it anything you want. When it’s created, you can activate it anywhere in your blueprint by its name. And you connect your delay and spawn nodes to the custom event you created.
You can connect the delay node to your BeginPlay or BeginOverlap directly, but in this case you’ll have to connect it at the end of the chain, otherwise your Delay would affect everything that follows it. So for cases like this I always create custom events.
Hope this helps.

Oh, it doesn’t matter. You call the Spawn Pickup and you can have anything you want afterwards. The Spawn Pickup has activated, that’s what you need.
You may have a lot of various events on BeginPlay.
What you have should work as well, but you shouldn’t connect the Destroy Actor nod to the Spawn nod, the actor should be destroyed on that actor’s BeginOverlap, as I understand.

That’s what I have. You mentioned connecting to the end which is the spawn node?
Also, I meant to say where do I have to connect the “Event BeginPlay” and the “Spawn A Pickup”? I see that you have them connected to something, but I can’t see what.

Also, this isn’t working because the item keeps spawning once I start playing. I don’t want the item to spawn until the time reaches 30-60 seconds.

You have something else connected to your Spawn nod. Try removing that connection and keep it connected to the Delay nod only.

The destroy is for when I touch the item, so it can disappear. Also, the other things are a series of connections to make the item spawn. Like I said before, it won’t work because the item spawns as soon as I start the game. Here is the whole blueprint so you can see what they do.

I been trying to get this to work for the past three days. It won’t work. I placed the delay in between get all actors and spawn. What it does now doesn’t destroy and keeps spawning in the same spot when the player touches it.

Maybe you should place the Delay between the Get all actors in class and Spawn, without any custom events.
And as for Destroy, you want to destroy an actor when you overlap that actor, not right after it’s spawned, right?

I’ll be home in about 7 hours and I’ll try to make it work as I see it.

No problem, thank you.

Okay, here’s what I made.
First, you create a blueprint for the object you want to pick up. I made it like a coin, made it rotate, and added a sound component.

248730-coin.gif

Make sure you set all the collision parameters in the coin blueprint.

In the coin event graph you create a simple sequence.

I added the Item Picked Up event so that your other blueprints would be able to see if the coin is picked up.
In the level blueprint I made almost what you had in yours, it selects a random target point, and spawns a coin there in 30 to 60 seconds.

And then you want to know when your coin is picked up, so you promote the spawned coin to a variable and bind to its Item Picked Up event, thus you can do anything happen in the level or to the character upon picking up the coin.

And here you go, everything goes as planned. I can’t attach another gif, 5 is the limit, but everything works. Coin disappears, sound is played, +25 appears on the screen for every coin I collect.

You should set the item collision preset to Custom and select Overlap pawn, like in my second screenshot.
And having everything in the level blueprint is not a good idea, actually. You may have more levels, and you don’t want to do it all over again in each of them. You should really try and put all the item functions into the item blueprint. It will make it easier for you to work with it in future.

Thank you for the reply and help. Before you replied I managed to get it working. I moved all of the blueprints from the item into the level. The item now is spawning at the specific time. However, now there is another problem. When the player touches the item it doesn’t disappears. It collides with it.

It’s not working. The player and item are still colliding. Also, moving the blueprints to the level actually solved the issue with the item not spawning at the right time. If I move it back to its own blueprints it will do the same thing as before.

  1. Is player’s collision preset set to pawn?
  2. How do you spawn the item and its collision, if you don’t use it’s blueprint?
  1. Not the static mesh, but rather the collision capsule.
  2. Well that should work if everything in the blueprint Class Details is set right.

Can you expand the Collision block?
My character capsule collision looks like this: