Weapon component gets information about the current weapon from the equipment component. You fire using this component. In this component you can set up the length of the trace that decides if you can damage the actor or shoot a casual bullet. Muzzle and shell sockets are used to spawn particles when you shoot. Damage melee is damage of the knife. Impact data table is used to spawn particles on the surface you hit.
Picture 47 - Setup weapon component
To fire you need to use “ShootingEventStart” and “ShootingReleased” functions (Picture 48).
Picture 48 - Shoot functions
If you have implemented new types of weapon you need to add them to these functions too (Picture 49).
Picture 49 - Important functions
In the weapon component the logic is switched on the type of fire mode. You can change and modify the logic in the shooting events node (Picture 50).
Picture 50 - Fire modes
From the weapon component you can also fire the “Melee” function to hit the enemy melee with your weapon (Picture 51). He will get damage from melee attack. And you can switch fire mode if your weapon has more than one. You can add new firemodes in the DT_Weapon. fire mode array variable.
Picture 51 - Melee attack and fire modes switch