This is the object being collected by the player.
This is the player character
Im trying to make it so when the player picks one up it counts it until the player collects all three.
Right now it counts if the player presses “E” instead. How could I resolve this?
1 Like
Only have the count in the player. When an item is picked up, it increments the count in the player.
This still makes it so it keeps counting evertime the player hits “E” and not just for when one item is picked up
1 Like
No, when the item is actually picked up, it’s increments the count in the player before destroying itself
( You need that destroy node on the end of the process, btw )
I think the problem im having now is the counter I have set up counts any “E” input to count as picking up an item even when the player isnt actually picking it up. How could I make I so the counter only updates on actual interactions with the item.
1 Like
Hey @Bloxygator!
Can you show us what your new code looks like? You’re probably very close if you followed Clockwork’s directions!
Get back to us soon!
This is what is what it looks like now but if doesnt work and on input counts as collecting the item no matter what. I need it so the counter only goes up when when the player directly inputs the interaction on the item. For example if I stand at the beginning of my level away from items and press “E” the counter still increases.
Well, it looks like you need to move this code to the pickup, and on the pickup have it get player character, cast to the player_bp, and add to the count there. You will want to do something to limit distance, touch would be the easiest because on the item you can have it use “On Event Start Overlap” to do it, increment your count on the player, and finally destroy the actor at the end.
Another problem is that it looks like you’re adding to “Crates left” on the closest “Long Crate” to the player, and then deleting that crate, meaning the change of that variable doesn’t matter. If you want to keep count of things you should store them on your player, game instance, or game mode because those will be persistent.
This worked perfectly thanks a lot!
1 Like