Weapon System for FPS game

So, I’m making an FPS game where I want the character to be able to carry multiple weapons. Every tutorial I found shows a way for a character to carry 2 weapons at the most. I want my character to be able to carry any and all weapons at the same time without limitations.

I want it so that I can either use my scroll wheel or press one button to be able to cycle through my weapons.

Is there any way I can do this?

Hey @TheOneWithAHat!

You can absolutely do that! There are a lot of ways to go about it. If it’s DOOM style where once you have a weapon unlocked, you have it forever, I’d prefer integers. Assign each weapon to an integer (on paper for reference), then make an “On mouse wheel up” event (or better yet make it an input in your Edit>Project Settings). You’ll then want to make a weapon Integer variable.

From there, you’ll save your ammo for that gun to a variable, then DestroyActor your gun. Then GET your current Weapon Int and +1 to it. Then do a switch on Int node, and have an output for each weapon’s individual integer. You should probably do a Branch where if you have the highest integer, SET Weapon Int = 1 so it will loop.

Then make one for mouse wheel down and do it in reverse, so -1 instead of +1.

Then simple enough from here, you spawn the weapon, set the ammo, and parent it to the player attaching it to the appropriate socket! Which I think you’ve got if you’ve done the 2 weapons :slight_smile:

3 Likes