Problem with creating new weapon

Ask questions, discuss ideas, get answers
Post Reply
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Problem with creating new weapon

Post by Vilespring »

I am trying to make a variant of the Thompson SMG by making it have a 145 round drum. I make a new weapon with the changes (copy paste, bit of renaming) and build a new kit for it. The weapon losses its animation when in game. The weapon is below the FOV when the kit is picked up, no reload animation, and the weapon is held side ways from switching from a different weapon. What did I, exactly, do wrong?
A picture is worth a thousand words, but takes up three thousand times the memory.

Area 51: http://battlefieldarea51mod.weebly.com/

Image
"I didn't steal your pizza"
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Problem with creating new weapon

Post by Swaffy »

It's in the animations. Are you trying to use the original Thompson animations, or do you have new animations that you want to use with your new Thompson?
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: Problem with creating new weapon

Post by Vilespring »

old Thompson animations. Forgot to add that.
A picture is worth a thousand words, but takes up three thousand times the memory.

Area 51: http://battlefieldarea51mod.weebly.com/

Image
"I didn't steal your pizza"
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Problem with creating new weapon

Post by Swaffy »

It doesn't take much to get them working. Here is what I do:

- In "Animations/1pAnimationsTweaking", copy every line of code that has the Thompson in it. Because the lines are all split up, it's faster to use Ctrl+F to search for the Thompson code. This is what I do to get all the Thompson code together in one bunch: (1) go through and delete every line that's not for the Thompson, (4) highlight all of the Thompson code and rename it to your new firearm, (3) copy all of the code and do not save the file, (4) go into "1pAnimationsTweakingMod" and paste it into the file then save. Close out the "1pAnimationsTweaking" file without saving, but save the "1pAnimationsTweakingMod" file.

- Do the same for "3pAnimationsTweaking" and "3pAnimationsTweakingMod".

- Do the same for "MiscAnimationsTweaking" and "MiscAnimationsTweakingMod".

- In the file named "MultiShotWeaponsMod", add these lines:
AnimationStateMachine.copyState NewFIREARM v_arg1 Thompson 1.0 Thompson 1.0
AnimationStateMachine.copyState2 NewFIREARM v_arg1 Thompson 1.0 Thompson 1.0
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

Re: Problem with creating new weapon

Post by Senshi »

To expand on Swaffy's answer:
It doesn't matter at all in which of the ".con" or ".inc" files you place the stuff, they all get loaded. It just makes things more orderly ;) .

There's also one minor mistake in your answer, Swaffy:
In the "MultiShotWeaponsMod.inc", you only need to add this:

Code: Select all

AnimationStateMachine.copyState NewFIREARM v_arg1 Thompson 1.0 Thompson 1.0
The other command, "CopyState2" is just a convenient abbreviation of "copyState":

Code: Select all

CopyState2 FIREARM v_arg1
equals

Code: Select all

CopyState FIREARM v_arg1 FIREARM 1.0 FIREARM 1.0
This means that CopyState2 only makes sense if you utilize your own, unique animations (.baf files).

You can see this for yourself if you take a look at the vanilla SingleShotweapons.inc. First comes a bunch of copyState2 to define the main weapons, then comes a bunch of copyState commands of wepaons that "recycle" existing animations. E.g. the K98 uses the same anims as the No4, as well as the K98Sniper and the No4Sniper.


To further expand on this explanation, let me tell you what the individual values of "copyStates" are for.
Let's take a look at this line from vanilla BF42:

Code: Select all

AnimationStateMachine.copyState Panzershreck v_arg1 Bazooka 1.0 Panzershreck 1.0
The first argument ("Panzershreck") is the new weapon you want to assign animations to.
The second argument is a variable and always has to be v_arg1.
The third argument are the WEAPONHANDLING animations you want to the new weapon to use.
The fourth argument is an overall animation playback scaler (IIRC, might be wrong. I always used 1.0).
The fifth argument is the WEAPONS animations for the new weapon.
And the sixth and last again is a playback speed multiplier.

Many weapons that are very similar easily can use the same handling animations (Bazooka&Shreck), but obviously need different weapon animations as the firing, reloading etc. are different. As the "weapon" animations also control stuff like magazine positions during reload this is vital, whereas the soldier animations (Weaponhandling) are rough anyway, so if they are a bit off nobody will notice anyway.
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: Problem with creating new weapon

Post by Vilespring »

Where, exactly, is this file?
A picture is worth a thousand words, but takes up three thousand times the memory.

Area 51: http://battlefieldarea51mod.weebly.com/

Image
"I didn't steal your pizza"
Post Reply