top of page
Search

Dev Log#21: Creating Power up System

Also known as pick ups. These are items that will be scattered across the map. These include; ammo pickups so that players that are popping off are able to replenish their ammo to keep the killstreak going, grenade pickups which will replenish the player's grenade supply with a potential of 9 grenades being able to be held at once. The final type of pick ups are buff related to the player's properties. These include a health pickup, shield pickup, speed pickup and jump pickup.


I've created another actor component class to handle the functionality making the changes to the character after they pick up a buff power up called buffcomponent. For the health and shield pick up they both serve as a healing pad and armour pad. Now I've always been able to just add more health to a character. But something I learned how to do is make the healing take a certain amount of time. Best example on the top of my head is like how sage heals in Valorant. How I'm doing it is by having these heal over time functions called in the tick function because I need delta time to prevent fps having an affect on the rate of healing.

So in this case shield will provide 100 hp over 4 secs so the regen rate is 25secs. This is multiplied by delta time so that each tick the appropriate amount is given to the player.

Regen this frame is being added to the shield. Amount to regen is being recorded as that 100 hp needed to be given and regen this frame will be subtracted from amount to regen. Once amount to regen is 0 that means the correct amount of shield has been given to the player.

This formula is the same for the health pickup.


The speed and jump pickups use a different formula.

The buff speed function is what is being called in the overlap event found in the speed pickup class and causing the change in the character's speed.

The set initial speed function is being used to record the default movement speed of the character which is being called in the post initialise component function in the character class.

The initial speeds are also being used the reset speed timer function so that the character returns to normal speed after about 5 seconds.

I've created a multicast function because its important that all players notice this change in movement straight away. Its calling a function call set speeds which ensures that aiming doesn't stop the speed boost before the speed timer does.


This formula is the same for the jump pickup however instead of changing the speed its changing the jump z velocity variable on the character.


I also created a spawn pickup class which serves as a way for powers up to respawn after being picked up. It has a lot of versatility because you can use it for ammo grenades health speed and buff pickups. Spawn pickup has an array of pickup classes that you can assign in the editor. The spawn pickup will spawn one of these assigned pick up classes at random every time. So if you want power ups to be randomly scattered around the map you can assign multiple of them in the array for one blueprint. If you want a power up to always be spawned in a fix spot then only add that one class to the array in a different blueprint.

 
 
 

Comments


bottom of page