What's the best way to respawn a pickup in blueprint?
I've got my pickups working well in blueprints, however I'm unsure about the best way to spawn them. I've been trying to make a class that spawns pickups at the start of the game and when they've been collected a wait time occurs before they next spawn again. (sort of like an MMO's spawn time).
I was thinking that it would be like respawning a player, but I remembered players require pawns and playercontrollers. Has anyone achieved respawning pickups?
PS: This is for a local splitscreen multiplayer game.
asked Sep 12 '14 at 08:53 PM in Blueprint Scripting
I just so happen to be working on this for a personal project and it's actually pretty similar to veggiesaurus' idea. Here is how I am doing it:
I have a Spawner class that I built with a Sphere component (PickupCheck) and a Scene component (Spawn Point):
Then I hooked it up like so:
The "IsBatterySpawned" bool is default True. Essentially I am spawning in the pickup blueprint, then when the player overlaps the area it would will do a check to see if the pickup is no longer there (My pickups will not destroy if you have full ammo/battery, so players could come back later). After that, it just does a simple delay and respawn. Let me know if you have any questions.
answered Sep 12 '14 at 10:59 PM
I've recently implemented a system that does exactly what you want, I think.
I have a pickupSpawner blueprint class that has two variables: respawnTime (float) and pickupClass ( class [not instance] that inherits from my Pickup blueprint class. On beginplay, the pickup spawner spawns an actor of the pickupClass type. When the pickup is collected by the player, it triggers a custom event in the pickupSpawner that spawned it, which lets the spawned know that the pickup has been collected. The pickupSpawner then respawns the pickup after a delay specified by the respawnTime parameter.
One other addition that I've also implemented is a counter, which checks to see if the pickupSpawner has "stock" of the pickup before spawning. Each time the pickup is spawned, the counter is decremented, and once the counter reaches zero, spawning is prohibited
answered Sep 12 '14 at 09:08 PM
Depending how you item class is designed. If you got pick up and inventory item seperate you can do what Sand write, if single class is used for pickup and inventory, you can spawn new item in place of pick up and hide component (by some call on pickup) until specific time pass.
answered Sep 12 '14 at 09:14 PM
What i would do if i was you: When the player collects de item i put a "DO ONCE", hid the pickup mesh and do what the pickup do to player when is collected....then put a delay to respawn....after this show the hidden mesh and reset de DO ONCE....
answered Sep 12 '14 at 09:04 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here