Download

help coding beginner!

hi there!i’m trying to make a bullet pick up so when you touch the bullet it is picked up and equips the bullet this is what i have so far with what i think is happening in the comment boxes:

https://forums.unrealengine.com/filedata/fetch?filedataid=124603&type=thumb

Ok so that can be done quite easily.

You want to create a Blueprint Actor and name it MasterBullet, inside MasterBullet add: Sphere Collision(Root component), sphere (Connecting to the sphere collision) and a projectile movement.

Inside the projectile movement you can add some default values, i used the default values from the yellow ball. You also want to add you Event hit logic here as well.

Then right click the MasterBullet blueprint and click Create child blueprint class. This child class if where you create you bullet, I have made two child actors one call FastBullet and one called SlowBullet. All you want to do is change the speed of the bullet in the projectile movement. My fast bullet is 5000 speed and the slow bullet is 1000 speed.

Then go to your character class and create a variable (MasterBullet as a class reference) assign the variable your default bullet, and connect that variable into the spawn actor where you fire the bullet.

Then to switch between the bullets i used two keys 1 and 2 when 1 is pressed it will set the variable to FastBullet and when 2 was pressed it set the variable to SlowBullet.

**** We use MasterBullet to allow us to make as many bullets as we want, all the child actors contain the code of MasterBullet so you dont have to keep coding the same thing into every bullet.
You can obviously change all the variables like speed etc to your own ****

You can use the pickup method from my other reply and integrate that so when you pickup a new bullet type it will equip that. I used 1 and 2 just to make it easier to see whats happening.

I will add a few screen shots in case you get confused.

GIF: Screen capture - 27b67b64227639b644f56e2bb4da97d7 - Gyazo

I hope this helps with your problem.