Jump to content
Game-Labs Forum

Weapon and Perk Modding Guide


pandakraut

Recommended Posts

Based on the work of Tokiedian and JonnyH13 here is an updated guide to modding weapons and perks in the resource.assets. A hex editor will be needed to view and make changes to the file.
- Float values will need to be converted from and into hex using a float calculator.
- Other game values can be changed, but discovering where those values are is largely trial and error. 
- No matter what changes you make, the assets file size cannot be increased or decreased. You can shorten text values to gain space.

The first hex block shows the palmetto infantry rifle. The second block shows the discipline artillery perk. The basic hex blocks will be the same for other weapons and perks. Apologies for the formatting and usage of paint.

image.png.13b7ba1b6e0263f05997330aa803e23d.png

Weapon Hex details

Hex Value Type Notes
8B 04 00 00 thumbnail reference int  
00 00 7A 43 effective range hint float  
00 00 96 43 effective range float  
00 00 96 42 rate of fire float This seems to be a multiple of 3, going down. So 100 = 30, 30 = 100, 15 = 200, etc..
00 00 90 41 weapon damage float  
00 00 B6 42 melee damage float  
71 3D 0A 3E accuracy random low float Values shown in tooltip are * 100
CD CC 8C 3F accuracy random high  float Values shown in tooltip are * 100
00 00 96 42 collateral radius float  
05 00 00 00 00 28 C3 36 56 96 3E 3F ... 30 C9 F6 BE 02 00 00 00 02 00 00 00 00 00 00 00   animation curve Length can vary. Can copy between weapons but curves cannot be modified.
1E 00 00 00 weapon ammo int  
0D 00 00 00 weapon cost int  
8F C2 75 3E adaption coef float Affects AI weapon scaling
00 00 80 3F ammo cost float  
01 00 00 00 crew amount int  

Perk Hex Details

Hex Value Type Notes
FF FF FF FF Unit type int 00 00 00 00 is infantry, 01 00 00 00 is Cavalry, 02 00 00 00 is Artillery, FF FF FF FF apply to all. Only corps perks use the type.
02 00 00 00 number of bonuses int this cannot be changed
04 00 00 00 type of bonus    
00 00 00 00 add or multiply bonus int 00 00 00 00 is add, 01 00 00 00 is is multiply
 
00 00 20 41 value added or multiplied float  
 

- Depending on the number of bonuses assigned to the perk, you will see additional sets of three 4 pair blocks for each bonus
- List of Bonus types and associated reference value.
Stamina,00
Efficiency,01
Melee,02
Firearms,03
Morale,04
Stealth,05
Spotting,06
Reload,07
EffectiveRange,08
Cover,09
Accuracy,10
GetMeleeDamageMoraleImpact,11
GetSmallArmsDamageMoraleImpact,12
Ammo,13
RotationSpeed,14
CanisterDamage,15
SolidAndShellDamage,16
HorseSpeed,17
ChargeDamage,18
MoveSpeed,19
Experience,20
CommandRadius,21

Edited by pandakraut
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

  • 2 months later...

I tried following this guide, but my changes don't seem to be reflected in game, in either the UI or in performance of weapon.

I'm starting my edits from 'Weapon/rifle_Whitworth_Rifle' hex area, and modifying things like effective range and effective range hint, but it doesn't seem to affect units with the rifle. The UI that shows the stats is also not changed. Any ideas?

  • Like 1
Link to comment
Share on other sites

11 hours ago, makotech222 said:

I tried following this guide, but my changes don't seem to be reflected in game, in either the UI or in performance of weapon.

I'm starting my edits from 'Weapon/rifle_Whitworth_Rifle' hex area, and modifying things like effective range and effective range hint, but it doesn't seem to affect units with the rifle. The UI that shows the stats is also not changed. Any ideas?

Weapon value changes should show up in the tooltip. Are you sure you have the right hex block? The one you want starts at offset 021249E0.

Both EffectiveRange and EffectiveRangeHint need to have the same value. Only EffectiveRangeHint is displayed in the base game tooltip.

Link to comment
Share on other sites

My mistake. I was using that popular mod, and they seemed to have remapped a bunch of guns. I was editing another gun by accident. I did a search for the stats of the gun i wanted and found it. Editing it works perfect now, Thanks!

 

P.S. regarding fire rate, it seems to be a multiple of 3, going down. So 30 = 100, 15 = 200, etc..

Edited by makotech222
Link to comment
Share on other sites

13 hours ago, makotech222 said:

My mistake. I was using that popular mod, and they seemed to have remapped a bunch of guns. I was editing another gun by accident. I did a search for the stats of the gun i wanted and found it. Editing it works perfect now, Thanks!

 

P.S. regarding fire rate, it seems to be a multiple of 3, going down. So 30 = 100, 15 = 200, etc..

If you're looking at the Rebalance mod assets several of the weapon have been renamed and are on different base types. Current list for 1.23a available here http://forum.game-labs.net/topic/25749-j-p-rebalance-mod-by-jonnyh13-and-pandakraut-83118/?page=13&tab=comments#comment-559655

Thanks for the insight into the fire rate. I'll update the note in the main post.

 

Link to comment
Share on other sites

It seems that lots of the traits do different stuff than advertised:

For cavalry:
Horseback riding and Endurance don't change movement speed; both just provide +10 Stamina and +5 Efficiency

Cavalry Training
Does not provide bonus charge damage

Recon Course
Firearms +5
Melee +5
Spotting *1.2
Stealth *1.5

Shock Cavalry
Does not provide bonus charge damage

----------------------------

General Skills

Cavalry Focus
Charge Damage bonus is 20%, not 10%

--------------------

Infantry:

Endurance Course
Does not provide move speed bonus


--------------------

Artillery

Tactical:
Does not provide rotation speed bonus

Long/Short Range training
Both Provide +10 Firearms and +10% accuracy (and no other bonuses)

--------------------

Skirmishers

Endurance Course:
Does not provide a movement bonus

Sharpshooters:
Additionally provides +10% effective range

--------------

And since I've not been able to decode how it does it's numbers, here are the hex values and decimal equivalents:

CD CC CC BD------0.9
CD CC 4C BD------0.95
CD CC 4C 3D------1.05
CD CC CC 3D------1.1
CD CC 4C 3E------1.2
00 00 80 3E------1.25
00 00 00 3F------1.5
53 6B 69 6C------3
00 00 A0 40------5
00 00 20 41-----10
00 00 70 41-----15
00 00 A0 41-----20


[edit]
Here's how at least some of the numbers work:
for numbers in the format of 00 xx yy 4z

If yy starts with 7 or less, then (game used) decimal value is 64 + (yy decimal value) * .5.
Example: 00 00 7A 4z. Hex to decimal on 7A = 122 game used value is (122/2) + 64 = 125

4z is a multiplier
40---------1/32
41---------1/16
42---------1/18
43---------2
44---------8
45---------16

So, for example, 00 00 A0 40 -> decimal value of A0 is 160, and 40 is 1/32 so in game value is 5.

For numbers in the 00 xx yy 4z format, xx = 80 adds .5 to the number before the multiplier. For example: 00 80 89 43 -> decimal value for 89 is 137, the preceding 80 makes for a value of 137.5 and the multiplier for 43 is 2, so in game value is 275.

Edited by Crusher Bob
add more info
Link to comment
Share on other sites

Are you using a float calculator? It should convert those values into the ones used in game.

You appear to be correct that several of the perks in the base game are missing values listed in the tooltip. This is not something that is fixable by modders as far as I know. Would have to report the discrepancies as a bug and hope they decide to patch it. This seems similar to the logistics perk not working properly that was fixed in a somewhat recent patch.

Edit: to clarify incorrect values can be fixed. If the perk bonus is missing entirely then that has to be fixed by the devs.

Edited by pandakraut
Link to comment
Share on other sites

Another comment: Multiplicative modifiers are additive, not compounding (at least for spotting and stealth, which were easy to check).
Examples:
Spotting * 3.0 and Spotting * 3.0 = a final modifier of Spotting * 5.0
Stealth * 1.5 and Stealth 1.5 = a final modifier of Stealth * 2.0

---------------------

Questions:
Is the fact that 3rd tier general skills are aura skills hard coded? or is it set somewhere/ Didn't see any options for aura skills in the guide?

What are the relative speeds of cavalry, infantry, skirmishers, artillery, supply?

Are the weapon degradation based on a fraction of the weapons effective range, or based on fixed value?
(If we change the effective range of a weapon, how does the degradation curve react? Does it simply 'stretch' to cover the new range, or does the new range just get a copy of the tail end of the curve?)

Link to comment
Share on other sites

36 minutes ago, Crusher Bob said:

Is the fact that 3rd tier general skills are aura skills hard coded? or is it set somewhere/ Didn't see any options for aura skills in the guide?

Yes. This is controlled in the dll though I don't know how to make that kind of change at this point.I

39 minutes ago, Crusher Bob said:

What are the relative speeds of cavalry, infantry, skirmishers, artillery, supply?

It's been a while since I looked at this but I think the base speeds are all the same and there are unitmodifiers that result in different overall speeds.

40 minutes ago, Crusher Bob said:

Are the weapon degradation based on a fraction of the weapons effective range, or based on fixed value?
(If we change the effective range of a weapon, how does the degradation curve react? Does it simply 'stretch' to cover the new range, or does the new range just get a copy of the tail end of the curve?)

Weapon degradation takes the current range of the target as input. Furthest point on the curve is the effective range. If you change the range the curve stretches. Graphs of the current curves are available in my hidden mechanics thread if you haven't already seen that.

Link to comment
Share on other sites

You might want to check out what the modders of the battletech game are doing, they've written a tool (BTML[/url] and the related ) that is made to inject code into Assembly-CSharp.dll so you can run multiple mods that change things. This way, for example, running your mod and the surrender mod can be done separately, and you (probably) wouldn't have to produce an integrated version.

edit:

Well it looks like I didn't format the URLs correct, and the forum software has re-written the links. But you should be able to google 'btml' and 'modtek' to find them.

Edited by Crusher Bob
  • Like 1
Link to comment
Share on other sites

4 hours ago, Crusher Bob said:

Well it looks like I didn't format the URLs correct, and the forum software has re-written the links. But you should be able to google 'btml' and 'modtek' to find them.

I've looked into it before but haven't had the time to try and take that step. The current mods all touch a lot of the same areas so I'm not sure how effective modtek would be in this case.

Link to comment
Share on other sites

  • 3 months later...
33 minutes ago, sayaka666 said:

Where would it be located to allow skirmisher weapons to be used by infantry and vice versa? Thanks. Btw, your guides are top notch

Presumably that is controlled in the assets somewhere but I don't know where it is. I'm currently enabling it through a workaround in the dll that adds the extra weapons to the shop interface.

Link to comment
Share on other sites

  • 4 years later...
On 12/30/2018 at 11:31 AM, pandakraut said:

Presumably that is controlled in the assets somewhere but I don't know where it is. I'm currently enabling it through a workaround in the dll that adds the extra weapons to the shop interface.

Hi Panda,

Has this been figured out since this thread was updated?  If not how and which dll file do you add stuff to the store so that line can use skirmisher weapons or vice versa?

 

thanks

  • Like 1
Link to comment
Share on other sites

On 9/19/2023 at 1:45 PM, Margrave said:

Hi Panda,

Has this been figured out since this thread was updated?  If not how and which dll file do you add stuff to the store so that line can use skirmisher weapons or vice versa?

 

thanks

dnspy can be used to make changes to the assembly-csharp.dll in the ultimate general civil war_DATA/managed folder

That can also be used to the decompiled code to a VS solution and then do a compare between the base game and the J&P mod to see how I enabled it.

Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...
  • 1 month later...

Panda and other modders et al,

I have gotten pretty fair at modding weapon stats to my satisfaction.  This is a great guide for that.

In the "Tentative Guide to Modding Thread" Tokiedian lists some weapon perk ID's and hints at modding the Reputation Shop.  I have played a bit with that but nothing seems to change in game.  I suspect that the version changes that led to his mod becoming obsolete also plague this.  Is this something that can be modded in the resource assets file?  If so, is there a similar guide to this one on how to do so?  I have searched in vain, perhaps I am searching the wrong query or perhaps it does not exist.

 

The types of things that I want to mod include increasing the size of the reward artillery up to 10 from 6 and 8 respectively for pieces unavailable to the Confeds.  Switching the reward MS rifles to MJ&G's and Enfield's to Lorenz's due to preference and how I have modded ranges.  For balance you would also need to mod reputation cost for said items. 

I would probably decrease the cost of the historical generals as well, just because I like to have them.  I usually have no shortage of quality random generated generals but for me having the historical increases the immersion factor but often forgo them for weapons.  Even at MG level I have and abundance of manpower but I can see some people wanting to mod manpower and money buys in the rep store as well.

Link to comment
Share on other sites

Changing the types and amounts of the rep buys can presumably be done in the assets file, though I have no idea where that information lives. Some of those changes are in the j&p mod but they were done by editing the dll using something like dnspy. Changing the amounts is much easier than changing the types, but both are going to require some programming knowledge to figure out.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...