PDA

View Full Version : Mod to sniping: Questions


Kel-Boi
26th Oct 2001, 11:20 AM
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
26th Oct 2001, 03: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

Smoke39
26th Oct 2001, 06: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.

Papapishu
27th Oct 2001, 11:50 AM
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);
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
27th Oct 2001, 01: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.

Papapishu
27th Oct 2001, 06: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...

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

Eater.