[Help] How to Mod BF2

Making or wanting help making your own asset? Check in here
Post Reply
Bluedrake42
Posts: 1933
Joined: 2009-07-23 17:52

[Help] How to Mod BF2

Post by Bluedrake42 »

I have an idea for a game play aspect of PR BF2 and I want to try and do it myself. I'm gonna post it in the suggestions forum too later, but right now I want to see if I can do it myself.

Right now what I want to do is this.

You know how when you fire a gun there's recoil?
You know how we don't like the limited deviation system right now?

Here's what I was thinking. When you get shot, or generally just when you have large radius of deviation, there would be a continuous recoil animation that animated at the intensity equal to your current amount of deviation.

Kind of like this
YouTube - SMOD: Tactical Delta 6 Early Gameplay

Go to around 50 seconds in the video,
Notice the effect when the player is hurt.
So that's what I'm thinking of, can anyone help me understand how I start coding for this?
Last edited by Bluedrake42 on 2010-10-13 17:50, edited 1 time in total.
Reason: Video
Jigsaw
Posts: 4498
Joined: 2008-09-15 02:31

Re: How to Mod BF2? Help

Post by Jigsaw »

Moved to PR:BF2 Community Modding.
http://www.youtube.com/watch?v=8CKjNcSUNt8
"I love the smell of napalm in the morning. You know, one time we had a hill bombed, for 12 hours. When it was all over, I walked up. We didn't find one of 'em, not one stinkin' dink body. The smell, you know that gasoline smell, the whole hill. Smelled like... victory. Someday this war's gonna end... "
Bluedrake42
Posts: 1933
Joined: 2009-07-23 17:52

Re: How to Mod BF2? Help

Post by Bluedrake42 »

[R-MOD]Jigsaw wrote:Moved to PR:BF2 Community Modding.
Oh sorry thanks a lot man
Sniperdog
Retired PR Developer
Posts: 1177
Joined: 2009-02-27 00:06

Re: How to Mod BF2? Help

Post by Sniperdog »

Deviation for handheld weapons in bf2 is not handled by animations but rather by deviation and recoil properties assigned specifically to each firearm.

Take for example:

pr\objects\weapons_server.zip/Handheld/usrif_m16a4/usrif_m16a4.tweak

You'll see a section in that file where it defines:

Code: Select all

rem ---BeginComp:SoldierBasedRecoilComp ---
rem 556 Standard Recoil Assault Rifle
ObjectTemplate.createComponent SoldierBasedRecoilComp
ObjectTemplate.recoil.hasRecoilForce 1
ObjectTemplate.recoil.recoilForceUp CRD_UNIFORM/1.8/1.8/0
ObjectTemplate.recoil.recoilForceLeftRight CRD_UNIFORM/-1/1/1
ObjectTemplate.recoil.zoomModifier 0.6
ObjectTemplate.recoil.goBackOnRecoil 1
ObjectTemplate.recoil.recoilGraphFrameCount 5
ObjectTemplate.recoil.recoilGraphExponent 5
ObjectTemplate.recoil.recoilGraphTotalMovement 0.25
rem ---EndComp ---
rem ---BeginComp:SoldierDeviationComp ---
rem 556 Optical Sight Standard Accuracy Assault Rifle
ObjectTemplate.createComponent SoldierDeviationComp
ObjectTemplate.deviation.minDev .333
ObjectTemplate.deviation.setFireDev 1.4 .7 .023
ObjectTemplate.deviation.setTurnDev 2 .15 .15 .05
ObjectTemplate.deviation.setSpeedDev 3 .02 .02 .02
ObjectTemplate.deviation.setMiscDev 20 20 .15
ObjectTemplate.deviation.devModStand 1.5
ObjectTemplate.deviation.devModCrouch 1.0
ObjectTemplate.deviation.devModLie 0.9
ObjectTemplate.deviation.devModZoom .3
rem ---EndComp ---
The numbers in the recoil component define specifically what the gun does when you fire a bullet.

The numbers in the deviation component define specifically how the spread of your weapon increases as you move, turn, fire, crouch, etc... and how it decreases as time passes.

Coding wise you have two options:

1. Duplicate your mod directory, Edit tweak files like the above, and save it in the archive. Then go in game and try it out.

or

2. Set up your mod for the bfeditor (heres a link with instructions: https://www.realitymod.com/forum/f189-m ... dding.html) and open the weapon and test fire it in there.

I also suggest you read as much of the stuff from this section:

https://www.realitymod.com/forum/f189-modding-tutorials

as you can; there is a wealth of excellent info there.
Image

Image

Will Stahl aka "Merlin" in the Squad community
Bluedrake42
Posts: 1933
Joined: 2009-07-23 17:52

Re: How to Mod BF2? Help

Post by Bluedrake42 »

Oh I know deviation isn't handled by animation, but is there some way to link animation to deviation values? not to what they're set as in the properties mind you, I'm talking about being linked to the real time deviation values in the game... or am I missing something?
Sniperdog
Retired PR Developer
Posts: 1177
Joined: 2009-02-27 00:06

Re: How to Mod BF2? Help

Post by Sniperdog »

Bluedrake42 wrote:Oh I know deviation isn't handled by animation, but is there some way to link animation to deviation values? not to what they're set as in the properties mind you, I'm talking about being linked to the real time deviation values in the game... or am I missing something?
No we can't actually change the in game deveation values in real-time, we can only set the properties according to the above. There is no way to link animations to the deviation values (nothing that wouldn't be extremely complicated and involve reading/writing to the memory at least)
Image

Image

Will Stahl aka "Merlin" in the Squad community
Post Reply

Return to “PR:BF2 Community Modding”