Go to the BP_MasterRangeWeapon then to the Screen Trace function. Then create 4 new variables and 1 new local variable.

Float variable called Distance Spread Increase and tick the Instance Editable box and set the default value to 0.25

NOTESThe above variable is the amount that the spread will be increased per 1 meter past the Start Distance Spread value. This means that if you are shooting the weapon at a far target the spread will be increased.

Float variable called Start Distance Spread Increase and tick the Instance Editable box and set the default value to 1000.

NOTESThe variable above is the distance the shot will not be effected by the increase of spread by default this is 10 meters or 1000 unreal units, you can increase this to what ever you like.

Float variable called Distance Spread Max and tick the Instance Editable box and set the default value to 90.

NOTESThe above variable is to stop the distance spread at a max amount for long distance shots. You can change this to what ever you like but i recommend keeping it below 400.

Bool Variable called Use Distance Spread Increase and tick the Instance Editable box and set the default value to true.

NOTESIf true the weapon will use this spread increase system, if false it will not.

Next create a new local variable called Distance L, with all your new variables it should look like this.

Next you will need to make alot of changes in the Screen Trace function and move the existing code to give yourself space for adding the new code.

Below are images of the new Screen Trace function. I have split them up in to different images as there are alot of changes, I have highlighted all the new and edited nodes and given close up image of the function.

Advertisements