Implementing Aiming-Error in a custom weapon.

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Wuumaster

Perseverant newb
Apr 24, 2004
16
0
0
39
First off, left me explain what I'm trying to do.

I'm trying to get the spider mines from Onslaught to act like little turrets. I plan on having them fire kinda like a sniper rifle (decent range, instant hit, slow fire rate) but with less damage.

The part I have trouble with now is that I can't figure out how to get them to miss a certain percentage of the time. As it stands, they always hit.

I've looked at the MinigunFire (etc) class and got really confused for a bit (the class itself has no way to actually fire. All the firing code has been inherited. Makes for a really wierd looking class :) ), then saw this thing along the lines of...

Code:
AdjustAim(StartTrace, AimError)

So I track down this function and find it eventually in the Controller class. But it has a comment indicating that the PlayerController & AIController classes are supposed to overwrite the function. Ok, fine. Go to the PlayerController class.

It has a comment around the AdjustAim function that says that the PlayerController doesn't actually use the AimError part.

Off to the AIController...

Not even there.

So I'm now totally confused. Are they even using the AimError variable? Certainly doesn't look like it.

I think that I'll try using 4 random numbers (within a range, say a,b,c, and d) and then do something like a-b = left/right offset, and c-d=up/down offset. That should do for now.

However, is there a better way? Seems likely, the Minigun uses it. And in the InstantFire class, there's this...

Code:
R = rotator(vector(Aim) + VRand()*FRand()*Spread);
DoTrace(StartTrace, R);

As always, any advice/pointers/etc is greatly appreciated!