I can’t for the life of me figure out how to set certain weapons (pistols, shotties, snipers etc) to use a line trace function and others ('nade launchers, rocket launchers etc) to use a projectile function. I tried setting up a parent weapon Actor (which I would then create child Actors from) and then attaching it to my character but the weapon won’t function, I then tried using an Actor Component instead but I can’t place input event nodes in the event graph D: Can someone help me, please?
Sorry, I’m confused. So I create the function in the Actor Component then call it in the Weapon Actor? Or do I call it to the character Blueprint? Then what? I want to be able to pick up weapons too, so I can swap out a bullet (LineTrace) weapon with an explosive (Projectile) weapon. I figured to acheive that I’d need to build the weapon’s LineTrace and Projectile functionality inside the Actor Component itself and then create child Actors from the parent and call one of the two functions depending on the weapon. Idk, I’m relatively new to UE4 lol ._. Thanks for replying, btw!!
The fire logic is a component of WeaponBase,
WeaponInHand is a var the type WeaponBase, they can hold any weapon child, So the fire event is the same
WeaponBase hold weapon stats, and each child weapon can have different values.
we had every weapon built into the character blueprint lmao. this was just for prototyping. I thought in a shipping project it was best practice to use classes and children of a master class. whats the difference in using components?
Sorry, I still don’t understand. Why would I call the Input Event inside the Character Blueprint if the weapon function is determined by the WeaponActor I’m currently holding? Could you perhaps add me on Skype (username is on my profile) and talk me through this, please? Thanks for all your help, btw!
you need to pass it from the player character or controller to the weapon actor. the weapon will not know when the trigger is pulled unless it is called from the character blueprint via fire input action. there is actually two things happening. the character/player pulling the trigger then the actor that represents the weapon is also got its own fire. you have to connect them some way. the character blueprint probably has the input in it. some people do all input inside the controller and pass it to the character blueprint. depending on where the input action for fire is you will need to pass it from there to what ever actor is doing the bang bang bang.