Jump to content

Arc Thrower Stun Chance?


daeger

Recommended Posts

I'm interested in making the game a bit less random. Some randomness is good, but things like rockets having a 10% chance to randomly fail and stray weapon shots completely wiping out important cover instantly.. very frustrating!

 

There are mods that change these things, but I have yet to find a way at all to control the stun chance of the arc thrower. Even unupgraded, the arc thrower should have a 100% chance to stun an enemy at 1 health. It generally requires a lot of setup, and when you finally move into position and use it, to have it fail is catastrophic. It's infuriating.

 

If anyone knows any way to edit the chances, please tell me, it doesn't seem to be present in any of the files.

Link to comment
Share on other sites

XGTacticalGameCoreNativeBase.uc has more or less all const(ant)s.

 

const STUN_I_HP_THRESHHOLD = 3;
const STUN_II_HP_THRESHHOLD = 6;
const STUN_BASE_CHANCE = 70;
const STUN_MAX_CHANCE = 95;
const STUN_MIN_CHANCE = 1;

I found the files in question, but I'm at a loss as to how I'm supposed to edit them. I used the extract tool and the .const files are in the XGTacticalGameCoreNativeBase folder, but they have a bunch of non-human readable characters in them.

 

What program am I supposed to be using to edit the decompressed upk file?

Edited by daeger
Link to comment
Share on other sites

Unfortunately, you need to hexedit such settings.

 

I've bumped a topic with a modding tool bundle. Maybe you have already seen it, otherwise here.

So Notepad++ will edit these const files safely even though it has a bunch of characters it can't recognize in it?

 

If so that's great because I found it with the hex editor but I don't understand what I need to do to change the value.

 

 

Edit: Also, I'm kind of confused where you got those lines you pasted from, what program gave you that output?

Edited by daeger
Link to comment
Share on other sites

Good news, I figured out what I was doing, and was able to correctly edit the values of the files.

 

Bad news, it didn't seem to have any in-game effect no matter what I changed the numbers to. Do I need to start a new campaign or something?

Edited by daeger
Link to comment
Share on other sites

Even more bad news. I started a new campaign on easy just to see if there was any sort of change and there was not. It does not seem like changing those constants is having any gameplay effect. I unpacked XComGame.upk and looked over the files just to make sure the edits I made were still there, and they were.

 

Where do I go from here?

Edited by daeger
Link to comment
Share on other sites

There's another file in XGAbility_Targeted called m_strChanceToStun.StrProperty but it doesn't seem to be human-readable.

 

Any help?

 

There are some other files that have stun in the name too. I can't find any that have numbers I can read in them though.

 

Edit: I think XComGame\XGTacticalGameCoreNativeBase\CalcStunChance.Function is the file that needs to be edited but it looks Greek to me. Anyone know how to accomplish this?

Edited by daeger
Link to comment
Share on other sites

There's another file in XGAbility_Targeted called m_strChanceToStun.StrProperty but it doesn't seem to be human-readable.

 

Any help?

 

There are some other files that have stun in the name too. I can't find any that have numbers I can read in them though.

 

Edit: I think XComGame\XGTacticalGameCoreNativeBase\CalcStunChance.Function is the file that needs to be edited but it looks Greek to me. Anyone know how to accomplish this?

 

Open XComGame.upk in UE Explorer. Go to File > Exporting > Export Classes

(Note, there are 2 "file" buttons. You need the second one, just below the one in the top left.)

 

Go to the folder where UE Explorer is installed. It will now have created a new folder there called "Decompiled". Inside there, you'll find all the classes from the UPK file, but in plain text format.

 

Now open Notepad++. Use the search function. Search inside files by going to the "find in files" tab. Point it to that folder where the UPK text files are.

 

Search for "CalcStunChance". You'll find two results.

 

You'll find a function called "CalcStunChance" (a function, see it as a title for a piece of code):

native simulated function int CalcStunChance(XGUnit kVictim, XGUnit kAttacker, XGWeapon kWeapon);

Unfortunately, it seems there's no code assigned to that function. This means the code is hidden somewhere. There are a lot of functions like that in the UPK files. Some people are guessing that the code is hardcoded somewhere. Maybe inside the EXE file? Who knows.

 

Let's look at the second search result:

fStunChance = float(CalcStunChance(kVictim, kFireAction.m_kUnit, kFireAction.m_kWeapon)) / 100.00;

 

It seems that function (whos code is hidden) is being called inside another piece of code. This code is within a function called:

function bool TryStunned(XGUnit kVictim, XGAction kAction)

The "bool" part means that at the end of the code, it returns either "true" or "false". So another code that calls "TryStunned" will receive a reply that will be either "true" (yes) or "false" (no). Simply by reading the name of the function you can conclude that it decides whether something is being stunned or not. (Guessing what a code does by it's function name is not reliable, you should check the code to see what it actually does.)

 

Now, if you look at the code of the function TryStunned, you'll see there's a part (among others) where you could manipulate the end result. Here:

return fRoll < fStunChance;

This part handles the final action that this function performs. What this does is two things. 1. It gives "true" when the value of "fRoll" is smaller than "fStunChance". Vice versa for false: if "fRoll" is bigger than "fStunChance" then it will result in a "false". 2. It will "return" the result of the calculation to the previous code that called this function. So if the result was "true", then it will pass on this information to the previous code that executed this function. That previous code will then do its own check like "if TryStunned == true then stun the alien".

 

The reason why this part is interesting is not because of the "return", but because here it performs the calculation that decides if the "stun chance" will result in a "yes" or "no". So this is one of the places you could edit to change it to the result you want. For example, you could change it to: "return (fRoll / 2) < fStunChance. That would always make fRoll twice as small as usual, so there's a higher chance it will return a "true".

 

I hope it makes sense. Of course, the hard part is that we can basically only change existing numbers. Adding and removing code is virtually impossible. So the example I just gave you is not possible to implement. But maybe there's another solution that is possible. See if you can somehow change the code inside that function to get the desired end result.

 

So that's the CalcStunChance part...

 

 

About "m_strChanceToStun". If you seach for it through the text files, you'll find a few results. One of the search results is this:

m_strChanceToStun="Chance To Stun"

It assigns text to "m_strChanceToStun". In other words, wherever you see "m_strChanceToStun", you must read plain text "Chance To Stun".

 

This is not surprising because if you look at the name "m_strChanceToStun", you'll see it begins with "str". It's short for "string". The developers decided so. A string value is basically a value containing text.

 

Some other naming conventions I noticed (the developers simply decided to name stuff like this, it's not a rule of programming or anything, it's just a good idea on their behalve):

Variables starting with:

"i" are integers (numbers without a comma).

"f" are floats (numbers with a comma).

"b" are booleans (true or false).

"str" are strings (text).

"a" are arrays (containing multiple values inside a single variable).

There's probably some other stuff I forgot about.

Edited by BlackAlpha
Link to comment
Share on other sites

Hmm okay, that's all very interesting, I'm looking through the file now. The only problem is once I've made the chance I think will work, I'm not exactly sure HOW to make the change, there doesn't seem to be any way to import the changes back into the upk file with UE Explorer.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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