Download

Collecting all of a certain type of item pickup to make something happen?

Hey again, so recently I’ve been trying to create a setup wherein if the player collects all of the special pickups (in this case, Purple Star Gems) within the level, then a reward will be spawned from a invisible item spawner.

’Purple Star Gem’ item pickup blueprint:

Reward spawn point blueprint:

At least that’s the idea anyway, in practice though, I haven’t been able to get it to work properly with a couple of problems that need to be addressed.

#1.) The first problem is that the special item pickups are no longer being destroyed upon being touched. This isn’t a collision issue as the pickup counter still ticks upwards upon collision. I’ve also noticed that the sound effect that’s suppose to play before the actor is destroyed is also not working anymore as well. I’ve tried a variety of different things to see if I could get the Destroy Actor node to properly destroy the special item pickup but nothing I’ve tried so far has worked.

#2.) The item respawner isn’t working as intended as the reward that’s suppose to appear when the player collects the right amount of the special pickup items isn’t appearing. The item spawner shouldn’t be affected by the special item pickups not being destroyed, so I’m not sure what’s going on here.

#3.) And finally, something’s screwy going on with the way that the number of special item pickups are being counted when the player touches one. Normally the print string number should be going up sequentially (i.e. 1, 2, 3 4, 5, 6, etc.], but instead I’m getting some strange numbers:

print_item_count

As you can see if this screenshot, instead of the numbers appearing in sequential order, I’m getting seemingly random numbers [55, 52, 51, 50, 49, 36, 37, 52]. The numbers are increasing as my player touches the special item pickup, albeit in a rather chaotic manner.

Can anyone help me out with this?

Hi! Few Suggestions: avoid casting too much.
Casts are expensive. Use tags instead: Add tag to the actors like: pickup item and things like that and then instead of 'get all of class 'you can do ‘get all with tag’…same instead of cast you can do ‘actor has tag’ and in the case you must access the class you cast only if hast tag succeeds :slight_smile:

for the failing respawn check in the dropdown option for collision handling. change to ALWAYS SPAWN.

Hope it helps :slight_smile: