I have begun working on an third person open world story game, i have made the most mechanics and began working on the levels. But now (as stupid as i am) i want to add an gun. And i am to lazy to make the gun mechanics from the start. is there anyway i can incorporate the First Person gun into my game. I though maybe adding an invisible first person character that follows my character.(but thats probably really stupid. Sorry for my bad english
You can add the first person template to your project by clicking on add feature pack or something like that. Simply right click on an empty area in the content browser and you’ll see the option.
Thanks for the answear, but i’ve already done that. I just wonder if i can use both the first person character and the third person. Like if i could switch between them. I’ve done it with camera, but i want to have the gun already connected to the First person character. I’m too lazy to do a new script for the third person.
What you want: Use the Gun from First Person Template in your third person game.
Of course you can use that weapon with your game, you are going to have to do some work to make it look like it belongs (i.e. it’s being held, aimed by your character). I gather that you don’t want to change to first person mode, just use the gun, so we’ll do just that.
I’ll use the third person template to get things going. We’ll want to add the feature pack to the project first:
select the First Person content pack:
If I drag the weapon into the viewport and attempt to pick it up I’m going to get an error:
this error is related to the weapons blueprint, so let’s take a look:
a quick check will show us it’s referencing a class that isn’t in our game, so we’ll have to change that so it does. perform a cast from the “Other Actor” pin of the “OnComponentBeginOverlap()” to your characters blueprint and set a reference to that class as an object variable.
Oh no!! now we have a reference to something we don’t have! It’s looking for a “BP_WeaponComponent” found on the first person character. No problem, if we look carefully we see that it’s being checked for validity before adding one anyway, so let’s just check the player character and see if it has that component at all, add a “GetComponentbyClass” node and swap out the direct reference:
now we can at least pick-up the gun:
but want to both orient it and fire it! so let’s start by getting the darn thing to fire, remember that weapon component? it contains the sauce you want to build from:
right away, with the BeginPlay event we see the direct references to the FirstPersonCharacter blueprint, you’ll want to swap that out, anywhere you see it in this blueprint:
Some components of this blueprint component can be removed entirely, such as anything refering to the characters animation blueprint as well as any reference to a “Weapon” that your character doesn’t have. Finally, there’s one little variable that we’ll have to change to ensure that the weapon appears in the corrct space:
with that, you’ve got a projectile firing from the weapon provided by the good people at Epic:
From here you could add additional sockets to the weapon/character for holding the weapon in hand, which of course would then come with ADS animations/logic and such. I hope this helps!
Thank you so much. I never expected a full tutorial. It was really amazing.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.