Page 1 of 1

Possible to hide sniper shells ?

Posted: Sun Jan 24, 2016 3:16 pm
by esnesi
Hi all!

I just switched from instagib to freestyle sniping.
And i was wondering if you can hide the shells that fall from your gun as you shoot.

Instagibbers offcourse got everything hidden and switched off haha!

Thanks in advance!

Re: Possible to hide sniper shells ?

Posted: Sun Jan 24, 2016 3:27 pm
by JackGriffin
Sure but you'll need to either code a server mod or a custom rifle to do it. See this part of the code in the sniper rifle:

Code: Select all

function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
{
    local UT_Shellcase s;

    s = Spawn(class'UT_ShellCase',, '', Owner.Location + CalcDrawOffset() + 30 * X + (2.8 * FireOffset.Y+5.0) * Y - Z * 1);
    if ( s != None ) 
    {
        s.DrawScale = 2.0;
        s.Eject(((FRand()*0.3+0.4)*X + (FRand()*0.2+0.2)*Y + (FRand()*0.3+1.0) * Z)*160);              
    }
Just remove that from your new rifle.

Re: Possible to hide sniper shells ?

Posted: Sun Jan 24, 2016 4:38 pm
by Spectra
Why not use SpawnNotify rather than coding a new rifle??

Re: Possible to hide sniper shells ?

Posted: Sun Jan 24, 2016 5:30 pm
by JackGriffin
You def could, I just wanted him to understand the why and how the shells come into being. SpawnNotify is esoteric and way harder to grasp, especially if you don't yet understand the way things are spawned.

Re: Possible to hide sniper shells ?

Posted: Sun Jan 24, 2016 6:17 pm
by sektor2111
I think AlwaysKeep can turn them off as well if wants, right ?

Re: Possible to hide sniper shells ?

Posted: Sun Jan 24, 2016 8:11 pm
by EvilGrins
If i may offer an alternative solution?

You said you started with instagibs... so are you familiar with the Sniper-Instagib??

Re: Possible to hide sniper shells ?

Posted: Sun Jan 24, 2016 8:40 pm
by MrLoathsome
That ZoomShockRifle is good. Think that is the same one I use on a couple of my servers.

However it is not a sniper rifle with no shells.

Although screwing around with AlwaysKeep or SpawnNotify would do it, that will still require some code
in a mutator or some place would it not?
And then you have extra processing going on to deal with hiding the shells anyway in real time.

Probably not a huge performance hit or anything, but I still don't like it. Not efficient. Bad. Horrible. Etc. :loool:

Jacks first suggestion is the best. And it only takes 5 minutes to create from scratch, with another 5 to test
and zip it up.

Here is the entire source:

Code: Select all

//=============================================================================
// LNSRifle - by MrLoathsome
// A default SniperRifle with no shells
//=============================================================================
class LNSRifle extends SniperRifle;

function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
{
	if (Other == Level) 
		Spawn(class'UT_HeavyWallHitEffect',,, HitLocation+HitNormal, Rotator(HitNormal));
	else if ( (Other != self) && (Other != Owner) && (Other != None) ) 
	{
		if ( Other.bIsPawn )
			Other.PlaySound(Sound 'ChunkHit',, 4.0,,100);
		if ( Other.bIsPawn && (HitLocation.Z - Other.Location.Z > 0.62 * Other.CollisionHeight) 
			&& (instigator.IsA('PlayerPawn') || (instigator.IsA('Bot') && !Bot(Instigator).bNovice)) )
			Other.TakeDamage(100, Pawn(Owner), HitLocation, 35000 * X, AltDamageType);
		else
			Other.TakeDamage(45,  Pawn(Owner), HitLocation, 30000.0*X, MyDamageType);	
		if ( !Other.bIsPawn && !Other.IsA('Carcass') )
			spawn(class'UT_SpriteSmokePuff',,,HitLocation+HitNormal*9);	
	}
}

defaultproperties
{
}
Summon or add the thing via class "LNSRifle.LNSRifle".
I even included an int file. *Edit: Not sure the int file does what I want it too..... :( Int files all suck. :wth:
This is the final version. :tongue:

See attached.

Re: Possible to hide sniper shells ?

Posted: Sun Jan 24, 2016 11:43 pm
by UTX
There are several ways to do things in Unreal, you could make a mutator with a Tick that destroyed all shellcase that spawned as well, I'm sure there may even be other things to do the same thing.

Re: Possible to hide sniper shells ?

Posted: Mon Jan 25, 2016 12:28 am
by MrLoathsome
UTX wrote:There are several ways to do things in Unreal, you could make a mutator with a Tick that destroyed all shellcase that spawned as well, I'm sure there may even be other things to do the same thing.
But why?

Then you got an extra mutator loading, with a Tick function running all the time that is destroying something you don't want to be there that only shows up
when a sniperrifle is fired.

That quicky Rifle I posted, eliminates the need for any of that.
By not spawning the shells in the first place, every other suggestion so far is just not needed, and would slow things down, with unneeded code.

K.I.S.S.

*Edit. This post is EVIL. Post number 666 for me. :satan: :mad2: :mad2: :satan:

Re: Possible to hide sniper shells ?

Posted: Mon Jan 25, 2016 12:35 am
by JackGriffin
As soon as someone says "Tick" I automatically know there's a better way and they are guessing at a fix (no offense UTX). Tick should
NEVER
get used unless you specifically know what you are doing with it.

I've seen tick used to update location of lights. On moving things. With multiple copies running on the server.

(((((((shudder)))))))

Re: Possible to hide sniper shells ?

Posted: Mon Jan 25, 2016 7:39 am
by sektor2111
Idea is that if you want a tick I'm guessing you'll need a foreach inside each tick. Now I figured that you did not read threads where I was talking about clocking and optimizing code because chained lists let's say in normal default matches it's cute, iterators used aren't so friendly as supposed.
They help heavy loaded games but not so much. I will except you from seeking forum. Just a note for a Level type MH with more than 1400 actors (pawns, items, ect.) doing a foreach takes some time increasing interval between ticks, especially if something is tested there, leading in LAGS for a stupid shell-case. Only powerful machines will handle that but still cycles are devastated and A.I. won't be so nice (I'm talking from a lot of tests with maps, creatures and mods, not from stories).
Such lousy things, developing a mutator for a tiny fart might do a slow-down leading in a wacky game-play which no one wants. This thing combined with other default actors doing iterations you only can imagine the result.
If you get such ideas I warmly give you an advice to learn using XC_Core or clock stuff different and MIND performance.

Re: Possible to hide sniper shells ?

Posted: Mon Jan 25, 2016 8:27 am
by Chamberly
I agree with having no tick and setting up the code to not spawn the shells. :)

It would take a bit less resource to not spawn the shells.

Re: Possible to hide sniper shells ?

Posted: Mon Jan 25, 2016 6:28 pm
by esnesi
Wow allot of people are interested and want to help thnx! haha

I don't know much about unrealscript or coding a new mutator unfortunatly.
And i guess our serveradmin wont put this on the server :(

I had my hopes on a line in the UT.ini or something haha, like for example flashes you see when you get hit by a sniperrifle (screenflashes=false)

Thanks for the code though!

Re: Possible to hide sniper shells ?

Posted: Mon Jan 25, 2016 11:47 pm
by UTX
Chill, all I said is that there are many ways to do something here.

Re: Possible to hide sniper shells ?

Posted: Sat Feb 13, 2016 6:07 pm
by Hitman
iSenSe wrote:Wow allot of people are interested and want to help thnx! haha

I don't know much about unrealscript or coding a new mutator unfortunatly.
And i guess our serveradmin wont put this on the server :(

I had my hopes on a line in the UT.ini or something haha, like for example flashes you see when you get hit by a sniperrifle (screenflashes=false)

Thanks for the code though!
Hey isense, no I wont put it on since we use a zeroping-rifle and I doubt that will work together :sniper3: