How to make weapon 'Shoot' animation faster

A refuge for those migrating from the fallen DXEditing.com and a place for general discussion relating to Deus Ex editing (coding, mapping, etc).
SkrillaX
NSF
Posts: 86
Joined: Sun Oct 02, 2016 4:43 am

How to make weapon 'Shoot' animation faster

Post by SkrillaX »

Greetings. I have a custom weapon pack. 2027's weapon models. So, I'm decreasing the shot time, but nothing works. So, my theory lies with the 'Shoot' animation. The shorter the animation, the faster the weapon will fire. Can there be any way that I can decrease the Shot Time of these models. Also the weapons. Many thanks for help.http://www.offtopicproductions.com/foru ... =post&f=36#
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: How to make weapon 'Shoot' animation faster

Post by Cybernetic pig »

Check PlaySelectiveFire() in DeusExWeapon.uc. In there you'll find a PlayAnim() call. Its second parameter is the anim rate.
SkrillaX
NSF
Posts: 86
Joined: Sun Oct 02, 2016 4:43 am

Re: How to make weapon 'Shoot' animation faster

Post by SkrillaX »

What am i supposed to edit
If I do slomo 2, I got my desired fast firing weapon.But I want them at normal game speed.
Pls can you tell me how and what to edit
Thank u for the reply though =)
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: How to make weapon 'Shoot' animation faster

Post by Cybernetic pig »

Oh, you're not modifying DeusEx.u.

In the weapon classes of your package, override PlaySelectiveFire().

Export DeusEx.u so that you can fetch PlaySelectiveFire() to copy/paste to your weapon classes.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: How to make weapon 'Shoot' animation faster

Post by Hanfling »

I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: How to make weapon 'Shoot' animation faster

Post by Cybernetic pig »

The fuck is that god awful music and why is it relevant?

:P

Try this: https://www.youtube.com/watch?v=4QsJ9pA-SQA
SkrillaX
NSF
Posts: 86
Joined: Sun Oct 02, 2016 4:43 am

Re: How to make weapon 'Shoot' animation faster

Post by SkrillaX »

How exactly am i supposed to override it. How shall I make the weapon fire faster ?
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: How to make weapon 'Shoot' animation faster

Post by Cybernetic pig »

1. Open UnrealEd
2. Click ExportAll in the actor browser (on the right).

This will export DeusEx.u classes to your Deus Ex Directory.

3. Open DeusExWeapon.uc found among those exported classes.
4. ctrl+f "function playselectivefire"
5. copy that function and its contents, and paste it into your 2027 package weapon classes.

Once you've done that, report back for further instructions.
SkrillaX
NSF
Posts: 86
Joined: Sun Oct 02, 2016 4:43 am

Re: How to make weapon 'Shoot' animation faster

Post by SkrillaX »

There is only playselectivefiring. Not any playselectivefire. There are many strings of codes. Do you want me to copy them all
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: How to make weapon 'Shoot' animation faster

Post by Cybernetic pig »

Copy that whole function.
SkrillaX
NSF
Posts: 86
Joined: Sun Oct 02, 2016 4:43 am

Re: How to make weapon 'Shoot' animation faster

Post by SkrillaX »

OK.Done. I've copied it till function weapon.uc. now what sould i do ?
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: How to make weapon 'Shoot' animation faster

Post by Cybernetic pig »

Hmm, are you sure?

To clarify:

Code: Select all

//Copy this function from DeusExWeapon.uc

Simulated Function PlaySelectiveFiring()
{
    //approximately 60 lines of code 
    //makes up this function
    //everything between the first opening bracket
    //and it's matching closing bracket
    //along with the function declaration itself
}  

//Copy end

//The next function and everything after it should NOT be copied.

function PlayFiringSound()
{
}
If you're still confused, paste one of your weapon classes that you intend to modify here.
SkrillaX
NSF
Posts: 86
Joined: Sun Oct 02, 2016 4:43 am

Re: How to make weapon 'Shoot' animation faster

Post by SkrillaX »

//=============================================================================
// WeaponFiveSeven.
//=============================================================================
class WeaponFiveSeven extends DeusExWeapon;

simulated function FiveSevenSelectSound()
{
Owner.PlaySound(Sound'MP5S.FiveSevenSelect', SLOT_None,,, 1024);
}

simulated function FiveSevenClipOut()
{
Owner.PlaySound(Sound'MP5S.FiveSevenReloadBegin', SLOT_None,,, 1024);
}

simulated function FiveSevenClipIn()
{
Owner.PlaySound(Sound'MP5S.FiveSevenReloadEnd', SLOT_None,,, 1024);
}

simulated function FiveSevenRelease()
{
Owner.PlaySound(Sound'MP5S.FiveSevenRelease', SLOT_None,,, 1024);
}


simulated function PreBeginPlay()
{
Super.PreBeginPlay();

// If this is a netgame, then override defaults
if ( Level.NetMode != NM_StandAlone )
{
HitDamage = mpHitDamage;
BaseAccuracy = mpBaseAccuracy;
ReloadTime = mpReloadTime;
AccurateRange = mpAccurateRange;
MaxRange = mpMaxRange;
ReloadCount = mpReloadCount;

// Tuned for advanced -> master skill system (Monte & Ricardo's number) client-side
recoilStrength = 0.75;
}
}

defaultproperties
{
LowAmmoWaterMark=6
GoverningSkill=Class'DeusEx.SkillWeaponPistol'
EnviroEffective=ENVEFF_Air
Concealability=CONC_All
ShotTime=0.100000
reloadTime=0.500000
HitDamage=14
maxRange=4800
AccurateRange=2400
BaseAccuracy=0.700000
bHasLaser=True
recoilStrength=0.300000
MinWeaponAcc=0.200000
mpReloadTime=1.000000
mpHitDamage=12
mpBaseAccuracy=0.950000
mpAccurateRange=2000
mpMaxRange=3200
mpReloadCount=12
bCanHaveModBaseAccuracy=True
bCanHaveModReloadCount=True
bCanHaveModAccurateRange=True
bCanHaveModReloadTime=True
bCanHaveModRecoilStrength=True
AmmoName=Class'DeusEx.Ammo10mm'
ReloadCount=12
PickupAmmoCount=12
bInstantHit=True
FireOffset=(X=-16.000000,Y=5.000000,Z=11.500000)
shakemag=200.000000
FireSound=Sound'MP5S.Weapons.FiveSevenFire'
Misc1Sound=Sound'MP5S.Weapons.GenericDryfire'
InventoryGroup=196
ItemName="Five-seveN Tactical"
PlayerViewOffset=(X=16.000000,Y=-5.000000,Z=-11.500000)
PlayerViewMesh=LodMesh'MP5S.fiveseven1st'
PickupViewMesh=LodMesh'MP5S.FiveSevenPickup'
ThirdPersonMesh=LodMesh'MP5S.FiveSeven3rd'
LandSound=Sound'DeusExSounds.Generic.DropMediumWeapon'
Icon=Texture'DeusExUI.Icons.BeltIconPistol'
largeIcon=Texture'DeusExUI.Icons.LargeIconPistol'
largeIconWidth=46
largeIconHeight=28
Description="A tactical pistol with a laser sight attachment."
beltDescription="Five-seveN"
Mesh=LodMesh'MP5S.FiveSevenPickup'
CollisionRadius=7.000000
CollisionHeight=1.000000
}
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: How to make weapon 'Shoot' animation faster

Post by Cybernetic pig »

Unfortunately you didn't post that in code tags (or even quotation tags) and so the formatting is destroyed, but never mind. It's only relevant to readability.

Just copy paste this over your whole FiveSeven class, overwriting the existing code. Back up the WeaponFiveSeven.uc file beforehand just in case.

Code: Select all

//=============================================================================
// WeaponFiveSeven. 
//=============================================================================
class WeaponFiveSeven extends DeusExWeapon;

simulated function PlaySelectiveFiring()
{
	local Pawn aPawn;
	local float rnd;
	local Name anim;

        anim = 'Shoot';

	if (bHandToHand)
	{
		rnd = FRand();
		if (IsA('WeaponHideAGun'))
                anim = 'Shoot';
		else if (rnd < 0.33)
			anim = 'Attack';
		else if (rnd < 0.66)
			anim = 'Attack2';
		else
			anim = 'Attack3';
	}

	if (anim == '')
		return;

	if (( Level.NetMode == NM_Standalone ))
	{
		if (bAutomatic)
		       LoopAnim(anim,1, 0.1);
		else
			PlayAnim(anim,1, 0.1);
	}
	else if ( Role == ROLE_Authority )
	{
		for ( aPawn = Level.PawnList; aPawn != None; aPawn = aPawn.nextPawn )
		{
			if ( aPawn.IsA('DeusExPlayer') && ( DeusExPlayer(Owner) != DeusExPlayer(aPawn) ) )
			{
				// If they can't see the weapon, don't bother
				if ( DeusExPlayer(aPawn).FastTrace( DeusExPlayer(aPawn).Location, Location ))
					DeusExPlayer(aPawn).ClientPlayAnimation( Self, anim, 0.1, bAutomatic );
			}
		}
	}
}

simulated function FiveSevenSelectSound()
{
Owner.PlaySound(Sound'MP5S.FiveSevenSelect', SLOT_None,,, 1024); 
}

simulated function FiveSevenClipOut()
{
Owner.PlaySound(Sound'MP5S.FiveSevenReloadBegin', SLOT_None,,, 1024); 
}

simulated function FiveSevenClipIn()
{
Owner.PlaySound(Sound'MP5S.FiveSevenReloadEnd', SLOT_None,,, 1024); 
}

simulated function FiveSevenRelease()
{
Owner.PlaySound(Sound'MP5S.FiveSevenRelease', SLOT_None,,, 1024); 
}


simulated function PreBeginPlay()
{
Super.PreBeginPlay();

// If this is a netgame, then override defaults
if ( Level.NetMode != NM_StandAlone )
{
HitDamage = mpHitDamage;
BaseAccuracy = mpBaseAccuracy;
ReloadTime = mpReloadTime;
AccurateRange = mpAccurateRange;
MaxRange = mpMaxRange;
ReloadCount = mpReloadCount;

// Tuned for advanced -> master skill system (Monte & Ricardo's number) client-side
recoilStrength = 0.75;
}
}

defaultproperties
{
LowAmmoWaterMark=6
GoverningSkill=Class'DeusEx.SkillWeaponPistol'
EnviroEffective=ENVEFF_Air
Concealability=CONC_All
ShotTime=0.100000
reloadTime=0.500000
HitDamage=14
maxRange=4800
AccurateRange=2400
BaseAccuracy=0.700000
bHasLaser=True
recoilStrength=0.300000
MinWeaponAcc=0.200000
mpReloadTime=1.000000
mpHitDamage=12
mpBaseAccuracy=0.950000
mpAccurateRange=2000
mpMaxRange=3200
mpReloadCount=12
bCanHaveModBaseAccuracy=True
bCanHaveModReloadCount=True
bCanHaveModAccurateRange=True
bCanHaveModReloadTime=True
bCanHaveModRecoilStrength=True
AmmoName=Class'DeusEx.Ammo10mm'
ReloadCount=12
PickupAmmoCount=12
bInstantHit=True
FireOffset=(X=-16.000000,Y=5.000000,Z=11.500000)
shakemag=200.000000
FireSound=Sound'MP5S.Weapons.FiveSevenFire'
Misc1Sound=Sound'MP5S.Weapons.GenericDryfire'
InventoryGroup=196
ItemName="Five-seveN Tactical"
PlayerViewOffset=(X=16.000000,Y=-5.000000,Z=-11.500000)
PlayerViewMesh=LodMesh'MP5S.fiveseven1st'
PickupViewMesh=LodMesh'MP5S.FiveSevenPickup'
ThirdPersonMesh=LodMesh'MP5S.FiveSeven3rd'
LandSound=Sound'DeusExSounds.Generic.DropMediumWeapon'
Icon=Texture'DeusExUI.Icons.BeltIconPistol'
largeIcon=Texture'DeusExUI.Icons.LargeIconPistol'
largeIconWidth=46
largeIconHeight=28
Description="A tactical pistol with a laser sight attachment."
beltDescription="Five-seveN"
Mesh=LodMesh'MP5S.FiveSevenPickup'
CollisionRadius=7.000000
CollisionHeight=1.000000
}
----

Now to actually increase the speed of the animation you just need to modify this bit:

Code: Select all

if (( Level.NetMode == NM_Standalone ))
	{
		if (bAutomatic)
		       LoopAnim(anim,1, 0.1);
		else
			PlayAnim(anim,1, 0.1);
	}
As the Five Seven is not a fully automatic weapon, you need to modify the PlayAnim call (play animation once), not LoopAnim (loop animation indefinitely).

This is twice as fast firing animation speed:

Code: Select all

if (( Level.NetMode == NM_Standalone ))
	{
		if (bAutomatic)
		       LoopAnim(anim,1, 0.1);
		else
			PlayAnim(anim,2, 0.1);
	}
Note the only thing different is the change in one single number, increased by one.

As a general guideline, 1=default animation speed. 2= Twice as fast animation speed 0.5 = half as fast. You'll probably not want to go higher than 1.5 (+50% speed) to save the animation from looking bad.

This will only apply to your five seven. You'll need to take the PlaySelectiveFiring() function and paste it to all your weapon classes, and modify the anim rates individually for each weapon. Which is good, as some you may want to fire faster or slower than others.

An alternative method is to no longer have firing speed tied to the animation, but that is more involved.
SkrillaX
NSF
Posts: 86
Joined: Sun Oct 02, 2016 4:43 am

Re: How to make weapon 'Shoot' animation faster

Post by SkrillaX »

Gee, thanks, really worked. Hey, can I ask you something ? Where did you learn this weapon coding ?
Post Reply