Dropping items into a collision box to add score

I am confused about the pickup base class, sorry that screenshot does really help though thank you.

Hey I am currently attempting to make a vr shopping sim kind of game for my uni course and I was just wondering how would I go about adding score when you drop an item into a collision box, I have everything set up for the score but it doesn’t seem to work.

i really shouldn’t do this but below is a picture of how i would do it on a basic level. the picture is the blueprint for the actual overlap actor. i also had a pickup base class with the variable score to give so that i could have different items worth different amounts. i was also using the third person character and had a variable on the character for the total score. so basically on overlap we see if the overlapping item is one of the pickups, if it is we get the player. then we get the players score and the score to add from the pickup and add them together. then we just need to set the player score and destroy the pickup item.

beyond the basics here you could add a widget that displays the player score on screen.

by base class i just mean i made a actor for the pickup item with the variable in it. the base part i just meant that i could create children of this item that would have say a different mesh. so i could have apple item and a banana item that both inherit from the basic pickup class. this way both the apple and banana would have the score variable since its parent did. this would also allow both the banana and the apple to cast to the pickup class and return true.

if you copied the blueprint that i provided i would say if your still having an issue then it would be either that the casts arnt setup properly (casting to wrong class) or your collision isnt setup right (have generate overlap events checked, have collision presets that allow overlap).

the first step i would use for debug is to make sure that the overlap is firing. to do this simple put a print string directly after the on overlap node.

it the overlap is occurring then you need to move to the next piece. is the first cast working? so is the volume overlapping with your specific pickup object. if its is then move on down the line. if not then your object and your cast do not inherit from the same class.

just repeat the process until you find where the script fails. thats basic troubleshooting.

I have recreated this with a master BP for the items having the variable ScoreToAdd inside this bp, it still isnt adding score or destroying the actor.

I do have generate overlap event on, still not working.

The print string shows that it collides but doesn’t set the score or delete the actor for some reason

For some reason the cast is failing?

UPDATE: Non of the casts to the motioncontrollerpawn work, they all fail

Is that yhe pawn that your player is? I would check the dafaults for the vr template for you if i could right now but my computer is down due to a windows update gone wrong. Basically the cast is failing because the pawn your inputtin isnt of the same type as the one your casting to