I do not understand why this is not working as it should. I am trying to create a jump pick up so whenever the player (which is a vehicle pawn/Sedan blueprint) runs over said pick up they obtain the ability to jump permanently. I am having a problem with casting the USB pick up blueprint to the Sedan blueprint. IMG_A is the Sedan blueprint. If integer Pickedup (part of the cast) is more than or equal to 1 the branch will carry out the process.
In IMG_B Pickedup IS set to one. I did a test in which if Pickedup was 1 a text would print. When I run over the pick up in game, the text appears clarifying that the integer is set to one but the jumping does not work.
My question here is why isn’t the Sedan blueprint not recognizing that Pickedup has been set to one but the USB blueprint does?? WITHOUT the cast, the jump function works PERFECTLY FINE. With the cast it does not. Is my object wild card wrong? (I am a bit confused when it comes to the referencing of things)
Do both the USB and the sedan have a Jump enabled variable? Casting doesnt give variables it just tells the blueprint to treat that actor as that class. If the actor is not a child or parent of that class type then the cast will fail.
Sedan is the only one with a jump variable. If I Set the jump inside the USB, then sedan will refuse to jump with a simple press. I really do not understand how to create a simple power up that will last permanently.
I FIGURED IT OUT YES! I scratched the INT and set a Boolean called IsUSBPicked as untrue as its default inside the sedan. In USB blueprint I did a cast to sedan and set Boolean as to true. THIS fixed my problem. I needed to set the variable inside the sedan rather than the USB blueprint. Also your comment gave me advice to further help me on this. Thank you so much for helping me!
They both need to have a way to check if they have jump enabled. You can do that by having them both be child classes of a class that has that variable or you can give each their own (but you’ll have to cast and check both classes if you do that).