Jump to content

Help please - want a script or mod to reduce critical multiplier to 1.2


sniggles

Recommended Posts

Hi guys - i really could use some help to make a quick mod to reduce the critical multiplier from 1.5 to 1.2.

 

I am using Enemy Within with all DLC and latest patch (patch 3)

 

I know nothing about UPK editing and hex editing etc and just want to make this small change to my game.

 

From this forum i understand the code is..

 

if(bCritical)
{
iDamage += 1;
iDamage = int(float(iDamage) * 1.50);
iDamage += class'XComEngine'.static.SyncRand(3, string(Name) @ string(GetStateName()) @ string(GetFuncName())) - 1;
return iDamage;
}

 

and it is in either XComGame.upk or XComStrategyGame.upk

 

not sure which.

 

I just want to change the * 1.5 to * 1.2

 

Can anyone help me out with a txt file script i could use with latest 'Patcher GUI (4.0) way of modding.

 

I am already using a number of mods using this excellent utility and fully understand how to prepare my game for modding and load the mods - i just don't know how to find the hex code and write the txt script to create my own mod.

 

I could even have a go writing the txt file myself if i just had the modified hex code line i need to insert and the UPK file name.

 

Really appreciate any help or advice.

 

All the best,

 

Mark.

 

Link to comment
Share on other sites

Thanks for the reply Dubios but you can't reduce the actual critical damage output calculation using the DefaultGameCore.ini - only the critical hit chance.

 

I have already set all the critical bonuses to zero for the weapon stats and balancing section and criticals still occur quite often using the 1.5 X base weapon stat calculation (randomized with a dice throw).

 

I have modded my game to be high hp and low damage weapon output for long tactical battles but i need to reduce the high critical calculation to something like 20% as the current dice rolls are giving way too high a critical damage output for my mod.

 

Here's hoping someone can find the hex code i need to change.

Link to comment
Share on other sites

Well - attempted to make my own changes and mod - FAIL!

 

I got as far as locating the code which was in...

 

XComGame.upk / XGTacticalGameCore / CalcOverallDamage

 

but couldn't work out how to find the decimal 1.50 when you view the hex code.

 

So - got close but no cigar - in case anyone can point me in the right direction i will copy and paste the script and corrosponding hex code below so maybe someone can point out where the multiplier 1.5 in hex is shown?

 

 

 

function int CalcOverallDamage(int iWeapon, int iCurrDamageStat, optional bool bCritical, optional bool bReflected)
{
local int iDamage, iRandDamage;

bCritical = false;
bReflected = false;
iDamage = m_arrWeapons[iWeapon].iDamage + iCurrDamageStat;
// End:0x54
if(bReflected)
{
return 0;
}
// End:0x76
if(WeaponHasProperty(iWeapon, 9))
{
return iDamage;
}
// End:0x114
if(IsOptionEnabled(0))
{
iRandDamage = 1 + class'XComEngine'.static.SyncRand(int(float(iDamage) * 1.50), (string(Name) @ string(GetStateName())) @ string(GetFuncName()));
// End:0x10A
if(bCritical)
{
return iDamage + iRandDamage;
}
// End:0x114
else
{
return iRandDamage;
}
}
// End:0x1A4
if(bCritical)
{
iDamage += 1;
iDamage = int(float(iDamage) * 1.50);
iDamage += (class'XComEngine'.static.SyncRand(3, (string(Name) @ string(GetStateName())) @ string(GetFuncName())) - 1);
return iDamage;
}
iDamage = (iDamage + class'XComEngine'.static.SyncRand(3, (string(Name) @ string(GetStateName())) @ string(GetFuncName()))) - 1;
// End:0x217
if(iDamage < 1)
{
iDamage = 1;
}
return iDamage;
//return ReturnValue;

 

 

 

and the hex code looks like (not sure if this will paste okay)

 

 

Offset 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F

00000000 50 86 00 00 51 60 00 00 00 00 00 00 31 86 00 00 P . . . Q ` . . . . . . 1 . . .
00000010 00 00 00 00 00 00 00 00 38 86 00 00 00 00 00 00 . . . . . . . . 8 . . . . . . .
00000020 C8 02 00 00 B8 53 00 00 2C 02 00 00 84 01 00 00 . . . . . S . . , . . . . . . .
00000030 49 02 00 28 15 49 02 00 28 15 0F 00 33 86 00 00 I . . ( . I . . ( . . . 3 . . .
00000040 92 35 27 0F 00 00 2C 0F 00 00 00 00 10 00 38 86 . 5 ' . . . , . . . . . . . 8 .
00000050 00 00 01 1B 12 00 00 00 37 86 00 00 16 07 54 00 . . . . . . . . 7 . . . . . T .
00000060 2D 00 35 86 00 00 04 25 07 76 00 1B 68 7F 00 00 - . 5 . . . . % . v . . h . . .
00000070 00 00 00 00 00 38 86 00 00 2C 09 16 04 00 33 86 . . . . . 8 . . . , . . . . 3 .
00000080 00 00 07 14 01 1B B4 45 00 00 00 00 00 00 24 00 . . . . . . . E . . . . . . $ .
00000090 16 0F 00 32 86 00 00 92 26 12 20 FB 55 00 00 3E . . . 2 . . . . & . . U . . >
000000A0 00 A8 55 00 00 00 1C AB 55 00 00 38 44 AB 38 3F . . U . . . . . U . . 8 D . 8 ?
000000B0 00 33 86 00 00 1E 00 00 C0 3F 16 A8 A8 38 57 01 . 3 . . . . . . . ? . . . 8 W .
000000C0 C7 F9 FF FF 38 57 61 1C 16 16 38 57 1C 99 FC FF . . . . 8 W a . . . 8 W . . . .
000000D0 FF 16 16 16 16 07 0A 01 2D 00 36 86 00 00 04 92 . . . . . . . . - . 6 . . . . .
000000E0 00 33 86 00 00 00 32 86 00 00 16 06 14 01 04 00 . 3 . . . . 2 . . . . . . . . .
000000F0 32 86 00 00 07 A4 01 2D 00 36 86 00 00 A1 00 33 2 . . . . . . - . 6 . . . . . 3
00000100 86 00 00 26 16 0F 00 33 86 00 00 38 44 AB 38 3F . . . & . . . 3 . . . 8 D . 8 ?
00000110 00 33 86 00 00 1E 00 00 C0 3F 16 A1 00 33 86 00 . 3 . . . . . . . ? . . . 3 . .
00000120 00 93 12 20 FB 55 00 00 2C 00 A8 55 00 00 00 1C . . . . U . . , . . U . . . .
00000130 AB 55 00 00 2C 03 A8 A8 38 57 01 C7 F9 FF FF 38 . U . . , . . . 8 W . . . . . 8
00000140 57 61 1C 16 16 38 57 1C 99 FC FF FF 16 16 16 26 W a . . . 8 W . . . . . . . . &
00000150 16 16 04 00 33 86 00 00 0F 00 33 86 00 00 93 92 . . . . 3 . . . . . 3 . . . . .
00000160 00 33 86 00 00 12 20 FB 55 00 00 2C 00 A8 55 00 . 3 . . . . . U . . , . . U .
00000170 00 00 1C AB 55 00 00 2C 03 A8 A8 38 57 01 C7 F9 . . . . U . . , . . . 8 W . . .
00000180 FF FF 38 57 61 1C 16 16 38 57 1C 99 FC FF FF 16 . . 8 W a . . . 8 W . . . . . .
00000190 16 16 16 26 16 07 17 02 96 00 33 86 00 00 26 16 . . . & . . . . . . 3 . . . & .
000001A0 0F 00 33 86 00 00 26 04 00 33 86 00 00 04 3A 34 . . 3 . . . & . . 3 . . . . : 4
000001B0 86 00 00 53 00 00 00 02 40 02 00 E1 10 00 00 00 . . . S . . . . @ . . . . . . .
000001C0 00 00 00 . . .
Appreciate any help guys as i know nothing about hex editing
Link to comment
Share on other sites

Changing an existing function in XCOM is not as simple and straightforward as one might think. You need to use UE Explorer as well. See "Hex editing UPK files" which outlines the process. Suggest the "Hex values XCOM Modding" article may also help.

 

Otherwise, you need to get the attention of one of the "code divers", who are plenty busy on their own projects. (I'm just the librarian.)

 

-Dubious-

Link to comment
Share on other sites

Floats are marked by the byte 1e ... the four following bytes make up the value, although they are in reverse order from what you might expect.

 

So, 1.5 will appear in the code as

1e 00 00 c0 3f

 

And 1.2 is

1e 9a 99 99 3f

 

I use this to convert floats to hex:

http://gregstoll.dyndns.org/~gregstoll/floattohex/

 

Use explorer's tokens and buffer modes to get a feel for how hex translates into code.

Link to comment
Share on other sites

Thanks Johnnylump - really appreciate you taking the time to help a newbie modder.

 

Now you have helped me identify the 1.5 multipliers i can crack on and thanks also for saving me the hassle of working out what 1.2 would be in hex code.

 

I have to go out in a while to visit family ( real life getting in the way of my gaming again - lol ) so i will create my mod to reduce the random damage mult and crit dam mult to 1.2 later today.

 

If all goes well after testing in game i will report back the gameplay results in case this change appeals to others on this excellent forum.

 

Thanks again.

 

Good luck with your modding.

 

Mark.

Link to comment
Share on other sites

Johnylump you are a GOD! - thanks again - made my own quick changes using your references for 1.5 and 1.2 and VOILA - reduced the random damage and critical bonuses from 50% to 20%.

 

Been testing it out all afternoon / evening and works perfectly with no problems and the extreme damage calculations have been reduced significantly just like i wanted.

 

I will paste below the new ' CalcOverallDamage ' script after my hex edits to the ' XComGame.upk ' file..............

 

 

function int CalcOverallDamage(int iWeapon, int iCurrDamageStat, optional bool bCritical, optional bool bReflected)
{
local int iDamage, iRandDamage;

bCritical = false;
bReflected = false;
iDamage = m_arrWeapons[iWeapon].iDamage + iCurrDamageStat;
// End:0x54
if(bReflected)
{
return 0;
}
// End:0x76
if(WeaponHasProperty(iWeapon, 9))
{
return iDamage;
}
// End:0x114
if(IsOptionEnabled(0))
{
iRandDamage = 1 + class'XComEngine'.static.SyncRand(int(float(iDamage) * 1.20), (string(Name) @ string(GetStateName())) @ string(GetFuncName()));
// End:0x10A
if(bCritical)
{
return iDamage + iRandDamage;
}
// End:0x114
else
{
return iRandDamage;
}
}
// End:0x1A4
if(bCritical)
{
iDamage += 1;
iDamage = int(float(iDamage) * 1.20);
iDamage += (class'XComEngine'.static.SyncRand(3, (string(Name) @ string(GetStateName())) @ string(GetFuncName())) - 1);
return iDamage;
}
iDamage = (iDamage + class'XComEngine'.static.SyncRand(3, (string(Name) @ string(GetStateName())) @ string(GetFuncName()))) - 1;
// End:0x217
if(iDamage < 1)
{
iDamage = 1;
}
return iDamage;
//return ReturnValue;

 

 

As you can see the 2 damage mult references are now *1.2 instead of *1.5

 

 

I don't know how to make a mod script to use with the Patcher GUI utility and so i just edited the XComGame.upk directly using Hxd.

 

If anyone wishes to do the same i will paste my own mod reference procedure that i wrote for myself below....

 

 

USE HxD HEX EDITING UTILITY TO HACK THE ' XComGame.upk '
1.5 MULT
--------
1E 00 00 C0 3F
1.2 MULT
--------
1E 9A 99 99 3F
RANDOM DAMAGE
-------------
ORIGINAL (1.5 MULT) HEX STRING
00 33 86 00 00 1E 00 00 C0 3F 16 A8 A8 38 57 01
REPLACE CODE (1.2 MULT)
00 33 86 00 00 1E 9A 99 99 3F 16 A8 A8 38 57 01
CRITICAL DAMAGE
---------------
ORIGINAL (1.5 MULT) HEX STRING
00 33 86 00 00 1E 00 00 C0 3F 16 A1 00 33 86 00
REPLACE CODE (1.2 MULT)
00 33 86 00 00 1E 9A 99 99 3F 16 A1 00 33 86 00
Most people will understand how to use HxD to change hex code but if you need any more clearer instructions or a step by step then just post a quick reply.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...