How can I make a powerup increase a player's speed incrementally?

I’m trying to make a game where you pick up objects to go faster and faster. I’ve been trying to make it so that every tiem you pick the object up, it adds to your Max Fly Speed, but I’m not entirely sure how to do this. I assume I have to store MaxFlySpeed somewhere and then make the code add, say, 500 to it every time I pick up an object. So far I’ve only been able to reference Max Fly Speed + 500, and all that does it change the default speed to 1500.

This is surprisingly difficult!

Yes. Currently when I pick it up, it add 500 to the character component’s speed, but there’s no way for me to make it continue to add 500 to it.

If you need a screenshot I’ll happily provide one.

How is Max Fly Speed currently set up? Are you referring to the Max Fly Speed of the Character Component?

Try something like this. Drag the CharacterMovement component out of the list on the left (Under Character), Drag the output node into a blank spot of the blueprint, then have it call Get Max Fly Speed and Set Max Fly Speed. Have it triggered by the event youre using (I just used the 0 key command for the example)

The solution below should add 500 to MaxFlySpeed, as each time the event is called it grabs the current MaxFlySpeed, then adds 500, then sets.

This is set up in the Character class. If you want the powerup itself to be responsible for setting the character speed, you can do it there instead. You’ll have to cast the to your character class and grab it’s attributes like this -

Should probably have mentioned I want the speed upgrades to stack instead of being just a one-off effect.

Okay, and that goes into the powerup graph, not the player character’s, correct?

Sorry, that doesn’t work. It may be that I have this whole thing set up wrong. I’m still trying to learn Blueprints and the documentation is extremely sparse.

The Answer is in my MyCharacter class. I added a comment to the answer that shows how you’d do it from the powerup.

Post some screens of what you’re working with? Maybe we can get you Rollin :slight_smile:

Right-o. So I’ve followed your script exactly, with an added event to destroy the pickup – Imgur: The magic of the Internet. The game I’m working on is based on the 2D template, and the character is controlled with the mouse in the x and y axes – Imgur: The magic of the Internet. And just for posterity, this is a sample of the type of level design I’m trying to accomplish, although I may remove the obstacles. (The flaming spheres are the powerups) – Imgur: The magic of the Internet.

Got it. Here’s how I set a “pickup” in Blueprints before, maybe replace the Event and heck the collision of your pickup

On the object with Collision (my case, a static mesh), I set the physics like this

5299-screen+shot+2014-05-01+at+9.32.00+am.png

And used OnComponentDidBeginOverlap Event to trigger the logic

5300-screen+shot+2014-05-01+at+9.32.25+am.png

Nope, didn’t work either. The graph shows the data is going through and it is definitely casting to the character and setting the speed, but no matter what I do my character does not go faster.

Interestingly, similar code works in another game template to set walk speed, so it likely has to do with the way the player character is handled in my game, and because of that I believe I’m going to temporarily abandon this project to work on another one. Thanks for your help though! I learned something today.

I think you need to change MaxSpeedWalk character parameter