Mod to sniping: Questions

  • 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.

Kel-Boi

New Member
Oct 26, 2001
4
0
0
Visit site
Greetings, folks.

I'm still just getting my feet wet and was hoping for some tips. I'd like to create what I think would be a particularly useful mutator, but I don't know the code base well enough to start work on it.

The mutator affects sniping -- when one is not crouching, and the sniper scope is zoomed, the player's view should wander randomly. Depending on the state of the player -- crouched, standing, walking, running -- one's view would wander/shake/waver a different ammount.

I took a look at the sniper mod here, and I suspect it's not too hard of a mutator to make, but I'm not certain where to start. Is there a "Crouched" state? If not, I'll need to add one. Is there actually a "Zoomed" state? I noticed there seems to be a "Zooming" state, at the very least. I think I can work my way through the logic of activating and deactivating the cursor-wandering state after lots detective work, though any tips and pointers would be appreciated.

The place where I need the most help is in causing the player's view to wander. Once I know the mechanics of causing it to change on x/y planes, I can play with different "random waver" algorhithms, but where should I start looking to affect the player's view?

Thanks much for any help,
Kel
 

Postal

I apear to have lost my pin.
Nov 14, 1999
1,388
0
0
WoD.BeyondUnreal.com
It could be done, I could do it, and have been considering something similar for one of my mods.

I doupt it would be popular unless it was built in to a rl mod
 

Smoke39

whatever
Jun 2, 2001
1,793
0
0
You can check if they're crouching by checking if bCrouch or bDuck (something like that) is 1 and checking if the player isn't falling (bFalling, I think?). You can make their view wobble with ViewRotation or something.
 

Papapishu

我是康
Jun 18, 2001
2,043
0
0
43
void
www.vovoid.com
bCrouching is it.
If you check out the ducker mutator you'll see a nice way to alter things that happens with the pawns...

it has a mutator that gives each spawned pawn an inventory item
class Ducker expands Mutator;
Code:
function ModifyPlayer(Pawn Other) {
  local DuckInventory TheDuck;

  TheDuck=spawn(class'Ducker.DuckInventory', Other);
  TheDuck.GiveTo(Other);
}
and this inventory item is responsible to make its owner "crouch" so that your collissionheight is lowered...
quite nice...

Your inventory item could make the viewrotation wave around a bit...

make it go up and down like the person's breathing, Use a sin wave to simulate it, and make it go left-right a bit randomly.
The last part can be done by having a variable that represents the left-right movement, increase or decrease randomly, not wildly tho.
The up-down movement should be slightly faster than the side movement and it should also fluxuate in height with a couple of pixels...
That would cause a natural effect to it.
Maybe even play a low breating sound that holds the same sync as the up-down movement...

Then you check if the bCrouching is set to true, and if so, you lower all the movement values by a half or so.
Remember to keep the original movement vars.
(Movement variables suggested:
xd = x-speed, keep it low
bh = breath height, how high you'd allow the aim to go in y axis
keep it to max 2 inches or so and make it wander up and down a bit
yd = y speed = sinus of clock times bh e.t.c. experiment!

Also keep the default values for theese before using them like:
dxd=xd;
dyd=yd;
dbh=bh;
if (bCrouching)
{
xd/=2;
yd/=2;
bh/=2;
}
(apply variables to viewrotation)
xd=dxd;
yd=dyd;
bh=dbh;

...
)
 

Smoke39

whatever
Jun 2, 2001
1,793
0
0
You should check if their not falling, though, because you can be holding down the duck key in mid air, and thusly wouldn't actually be crouching. Checking that they're not falling ensures that they're on the ground.