Jump to content
Game-Labs Forum
pandakraut

Weapon and Perk Modding Guide

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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.

 

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Found the problem, had pulled the wrong value for 3, should be 00 00 00 40 the float calculator didn't make heads or tails of the value I had pulled up instead. For those coming by later, the Hex numbers are little endian, if you aren't getting the values you expect.

Share this post


Link to post
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?)

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

×