I don't get this part at all. Giving back a negative value? Second formula that compares used weapons by both fighters involved?
Could you break it down again while using 2 example weapons, e.g. MGunner VS Plasmapistol-Alien + Pistolsoldier VS Plasmapistol-Alien?
I'll try.
James Bond (pistol snap shot) and John Rambo (MG full auto) are awaiting ET. ET came around the corner and enters both LOS with 20 TU left. Both aim at ET, Bond will fire at 20-(6/4) = 18,5 TU, next alien step. Rambo will fire at 20-(25/4) = 13,75 TU, allowing ET to move up to 4 further steps into his LOS, before reaction is triggered. Seems fine.
But ET does not take a walk, instead it fires at Bond with plasma pistol snap shot. Bonds reaction would take 6 TU, ET's attack equals at 6 TU, attacker shoots first on draw. Rambo is even slower, so no reaction before the shot. In theory, laser pistol snap shots with 5 TU should fire before ET's attack. There is a recalculation of the reaction TU, which should IMO not happen, if reaction TU is already set. Bond, probably taking the hit, will now fire at 20-(6-6)= 20 TU, next alien step if he survives. Rambo will fire at 20-(25-6) = 1 TU, giving up reaction without reason.
Now the actual attack takes place, ET loose 6 TU, 14 remaining. After attack, movement reaction will be triggered, allowing both soldiers to check their reaction. Bond, if he survived, will now react, if he gets the 30% chance. He will also react on every alien movement, as long ET remains visible and Bond has TU left.
Thats the theory, in fact it is even worse. The reaction fire code knows only, ET is about to attack, but has no clue, how this will happen. Instead of comparing with the alien attack TU (plasma pistol snap shot = 6), the code checks ET's reaction fire settings with the soldiers weapon. So, all calculations are completely fucked up and there is a good chance, the function can't calculate a result at all. Some examples:
- ET does not have reaction fire activated (why should it? its attacking) on right hand
- soldiers weapon cannot be used on reaction fire mode of ET (f.e. it uses the third fire mode for reaction, pistol has no third mode, mg cannot react with it) or the range is too far
Ancient coding rule #1 says "Thou shall return a value of -1, if no sane result can be calculated.". While there should be better ways nowadays, UFO:AI stand by the traditional rules. But there is no further check for this error, instead the -1 is interpreted as -1 TU attack and the RF code thinks, ET has become Lucky Luke. So not even Flash Gordons laser pistol snap shot stands a chance against the alien, shooting faster than its shadow. Miscalculated reaction TU for Bond is in fact 20-(6-(-1))=13, meaning he will not even react after the alien attack. No chance for Flash Gordon also, he has a reaction TU of 14.
RF only gets you a countershot at aliens using slower fire modes.
Why will that change anything? Won't my soldier just be "the guy who entered my (aliens) LOS with only 22 TUs, then took two steps and thus cracked my plasma-pistols RF threshold ..." ?
Not if you become Lucky Luke, because the reaction TU is reset on the attack.
Soldierstats influence the chance to hit.
that seems to be the most important part for the RF not happening. Good soldiers and precise wappons improve that chance
That's right. But stats inflicts RF only indirect on rare occasions. Weapons are more important than soldier stats, the weapon has to be much faster than the alien weapon and you have to survive the alien shot.
I thinkthats the chance to hit with atlast one bullet, so burst mode improve the chances.
Could be. But you will rarely get a reaction fire check in burst mode, if AI follows its usual tactic "step in sight, fire at will, step out sight".
Which seems to be a great tactic.
And the player can do the same
The code works for both sides the same way
Right, if the player has red and understand the C source code, gets very detailed instructions or has a very good observation skill over a long time.
Not all players like to learn game rules this way.
you missed the part where the react "reaction TU" are not reset after a shot so the next shot takes place on the "next step"
There is no test for reaction fire after crouche and turne.
Both right. I didn't mention these, because they seem to be more clearly to the non-coding player.
Well, time to see the trunk.