View Full Version : Mod to sniping: Questions

26th Oct 2001, 12:20 PM
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,

26th Oct 2001, 04:15 PM
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

26th Oct 2001, 07:41 PM
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.

27th Oct 2001, 12:50 PM
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;

function ModifyPlayer(Pawn Other) {
local DuckInventory TheDuck;

TheDuck=spawn(class'Ducker.DuckInventory', 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:
if (bCrouching)
(apply variables to viewrotation)


27th Oct 2001, 02:47 PM
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.

27th Oct 2001, 07:19 PM
yup and check if they exist at all (pawn==none)...

I'd like to help out more on this one since it seems like a worthy adversary to mock :D har, har...

28th Oct 2001, 08:27 PM
Oh, by the way, to check if the player is falling, it's if (PlayerPawn(Owner).Physics == PHYS_Falling)