March 29, 2024, 07:26:36 am
Username:

Password:

Topic: On luck and critical misses  (Read 1545 times)

Smalec

  • Posts: 18
    • View Profile
On luck and critical misses
« on: October 04, 2017, 09:05:27 pm »
Greetings
This, I think, is a question to the devs and a request to somebody with fonline reloaded wikia privileges to update these tidbits of info to Luck and Critical Miss pages.
I wanted to find out what exactly Luck does in regards to Critical Misses, so I downloaded 2nd session source (AFAIK! this part hasn't changed in 3rd session, which is current. Whole post is irrelevant if devs changed this part).
Here's the bit from combat.fos, I'm assuming the relevant one.

Code: [Select]
if(isCritical) //if the miss is critical
            {
                int roll = Random(1, 100) - 5 * (cr.Stat[ST_LUCK] - 5);
                if(roll <= 20)
                    roll = 0; //severity of the critical miss, set in critical_failures.fos
                else if(roll <= 50)
                    roll = 1;
                else if(roll <= 75)
                    roll = 2;
                else if(roll <= 95)
                    roll = 3;
                else
                    roll = 4;

Also, I've tried finding out what exactly do 0x 4byte codes stand for in regards to severity of critical misses, but to no avail. So I'm going to assume roll 3 means destroying the weapon and roll 4 something like crippling oneself in addition to destroying the weapon.

In summary:
A) Luck doesn't modify the CHANCE of Critical Miss occurding instead of a Miss. Weapon deterioration/condition affects that, the more broken the weapon the worse - that is in the wikia and is correct afaik.
B) Luck 1 gives +20 to the Critical Miss SEVERITY, meaning Critical Misses are more severe than usual, while Luck 4 gives +5 and Luck 5 doesn't add anything.
C) With Luck 6, a Critical Miss of 5th severity level can't happen. I don't know what exactly this means.. Think weapon exploding - being destroyed and crippling you.
D) With Luck 10, a Critical Miss of 4th severity level can't happen. Think weapon just being destroyed from a critical miss.

There, I've said it.
Information regarding to Luck and inflicting Critical Hits or preventing Bonus Effects that sometimes happen in addition of a Critical Hit Effects when YOU get Critically Hit is already on the wikia. For all I know it "probably is" accurate still.
« Last Edit: October 04, 2017, 10:00:40 pm by Smalec »

FrankenStone

  • Posts: 337
    • View Profile
Re: On luck and critical misses
« Reply #1 on: October 04, 2017, 09:29:35 pm »
random is god, dunno what your question was tho, since u seem to understand simple things.
just look in critical_failures.fos if you want to know what roll is doing what... like decribed in the comment line in the script i guess, the rest is simple math like u already figured out.

you already figured out the differences between different luck, its simple addition operation

Random(1, 100) - 5 * (cr.Stat[ST_LUCK] - 5); or Random(1, 100) + (- 5 * (cr.Stat[ST_LUCK] - 5));


Random() just generates a number between 1 and 100 this value will be used for simple calculation. only thing you have to pay attention too is that a negative number multiplied with another negative number will have an positive result.

you analysed that already on the bottom like, Random number between 1 and 100 + (-5*(1-4)) would look like Random + (-5*(-3)) > Random number between 1 and 100 + 15 and so on ...

so yeah with 1 luck and anything under 5 you will end up with some addition to the random generated number, on the other hand its still pretty rare i think the random generated number ranges from 1 to 100 so thats a wide field were u would have to hit >=75 on random gen to receive the baddest critical miss roll. i dont know exactly how the random number generator works here but if you just go by probability its like 3/4 chance against it and 1/4 to happen, in reality you might have more luck haha.

also this is only for creating a critical roll when already a "critical" miss occured. it would be more interesting to look on the part which turns a miss into a critical miss.
« Last Edit: October 04, 2017, 09:48:44 pm by FrankenStone »

Smalec

  • Posts: 18
    • View Profile
Re: On luck and critical misses
« Reply #2 on: October 04, 2017, 10:00:05 pm »
I did take a look at critical_failures, and it says only 0x00000000 byte codes and stuff, presumably from fallout.dat or .exe or else, no reference whatnot.

Any way, you confirmed so I'll fix the post. At the very least it can be copypasted into the wikia page now, same as "note from mojuk" is on Luck page regarding Luck as defender.

The bit about Miss turning into Critical Miss is right above the code I pasted in the combat.fos file. It does random crap + weapon deterioration as main factor.
« Last Edit: October 04, 2017, 10:01:54 pm by Smalec »

FrankenStone

  • Posts: 337
    • View Profile
Re: On luck and critical misses
« Reply #3 on: October 04, 2017, 11:00:01 pm »
I did take a look at critical_failures, and it says only 0x00000000 byte codes and stuff, presumably from fallout.dat or .exe or else, no reference whatnot.

Any way, you confirmed so I'll fix the post. At the very least it can be copypasted into the wikia page now, same as "note from mojuk" is on Luck page regarding Luck as defender.

The bit about Miss turning into Critical Miss is right above the code I pasted in the combat.fos file. It does random crap + weapon deterioration as main factor.

yeah looks like a flag thing, maybe you are lucky and its defined somewhere in _defines script.
im sure there are some flags written in that hexadecimal style dealing with crippling.

the 0x is just a prefix (used in C and many other programming languages) to mean that the following number is in base 16.

« Last Edit: October 04, 2017, 11:10:49 pm by FrankenStone »

Smalec

  • Posts: 18
    • View Profile
Re: On luck and critical misses
« Reply #4 on: October 05, 2017, 05:49:57 am »
Well the file does state "fallout2.exe at file offset 0x1065A0 (517FA0 memory offset)" so those codes in columns and rows probably mean additional offsets.
I don't have my FO2 copy atm nor a hex editor I know how to use, tho. Hex editing makes my head hurt.

I checked defines and some other files but, really, I'm just stumbling blind there.