Finished the course and I’ve been wanting to add a pickup that increases the timer by 30 seconds. Haven’t able to pull it off and I’ve tried all kinds of approaches. Anyone got any idea how to do this?
What’s the approach you’ve tried so far?
I feel like the solution is far simpler than what I’m trying and I’m just overcomplicating things a lot. But I’ve tried casting from fps character to FPSGameMode and a function I made in FPSGameMode as opposed to a function made in FPS character since I’m adding to the GameMode HUD instead of the CharacterHUD. I’ve tried numerous renditions of this, and this is my latest attempt. The TimePickup BP
Function made in FPS GameMode
Pulling my hair out trying to get this to work. Been using floats for the time variables on both the Pickup and the FPS Gamemode Function. Should I try doing this from the FPS Character BP like the other pickups? I’m just gonna keep throwing stuff at the wall to see what sticks. Any help would be appreciated.
I see what you’re attempting to do and you are definitely overcomplicating the problem. A few questions/notes:
- I’m assuming the Time variable in TimePickupBP is the time you wish to add?
- Why did you name the input for the MoreTime function delta time? Would make more sense to call it “additional time” or “time to add”
- You don’t need to cast to or get the FPS_Character in MoreTime, especially if you aren’t planning on doing anything with it (the cast in TimePickup BP is correct, good job!)
- What’s the AdditionalTime variable for? Seems redundant. Though I think you meant to add the value of MoreTime’s input to TimeRemaining, then set TimeRemaining to the result of that addition.
- Everything after the node to Set TimeRemaining would be taken care of on the next tick when time remaining is updated.
If I were to go about adding this, here’s what I’d do.
First, here’s my setup for the Overlap Event in BP_TimePickup (I didn’t add the sound in mine as it was necessary for the demonstration)
Next, here’s the AddMoreTime function in FPSGameMode.
Thanks! It worked! I knew I was overdoing it. I actually had something similar setup in one of my earlier attempts but the thing that I missed was the Get Game Mode node. I think that was literally all I was missing for what I was trying to do, so I just started trying all sorts of roundabout ways to get it done.
Yes the Time variable in the TimePickup BP is the Time I wanted to add.
Named the input for the MoreTime function Delta Time out of habit. Didn’t really put thought into it in the moment.
I did the cast/get to FPS Character because at this point I was just throwing anything at it to see what would work. I already had a feeling in the back of my head that this wasn’t correct but I tried it anyway.
The AdditionalTime variable exists for the same reason I tried the FPS cast. No real good reason.
Appreciate everything! Got a better understanding of this now!
Now I’m off to make additional text appear that shows how much time was added from the specific TimePickups e.g., +00:30 shows up for this Timepickup, +00:15 for another, etc.