class RWRealisticAimingAngles extends UIScreenListener config (RWRealisticAimingAngles); var bool ModInjected; event OnInit(UIScreen Screen) { if (ModInjected == false) { ModInjected = true; ReplaceStandardAimAlsoInAbilitiesWithUnusuallyDefinedHitCalc();}} //SOME ABILITIES CALL DEFAULT.SIMPLESTANDARDAIM INSTEAD OF CONVENTIONAL CLASS HABILITYTOHITCALC_STANDARDAIM static function ReplaceStandardAimAlsoInAbilitiesWithUnusuallyDefinedHitCalc() { local X2DataTemplate DataTemplate; local X2AbilityTemplate AbilityTemplate; // local X2AbilityToHitCalc_StandardAim OldAbilityToHitCalc; // local Override_X2AbilityToHitCalc_StandardAim NewAbilityToHitCalc; local X2AbilityToHitCalc_StandardAim AbilityToHitCalc; local X2AbilityToHitCalc_StandardMelee AbilityToHitCalcMelee; foreach class'X2AbilityTemplateManager'.static.GetAbilityTemplateManager().IterateTemplates(DataTemplate, None) { AbilityTemplate = X2AbilityTemplate(DataTemplate); /* if (AbilityTemplate.AbilityToHitCalc.class == class'X2AbilityToHitCalc_StandardAim' ){//&& // AbilityTemplate.AbilityToHitCalc.class != class'X2AbilityToHitCalc_StandardMelee'){ //JUST IN CASE... _STANDARDMELEE IS THE (ONLY) CHILD OF _STANDARDMELEE... OldAbilityToHitCalc = X2AbilityToHitCalc_StandardAim(AbilityTemplate.AbilityToHitCalc); NewAbilityToHitCalc = new class'Override_X2AbilityToHitCalc_StandardAim'; NewAbilityToHitCalc.HitModifiers = OldAbilityToHitCalc.HitModifiers; // Configured in the ability template to provide always-on modifiers. NewAbilityToHitCalc.bIndirectFire = OldAbilityToHitCalc.bIndirectFire; // Indirect fire is stuff like grenades. Hit chance is 100, but crit and dodge and armor mitigation still exists. NewAbilityToHitCalc.bMeleeAttack = OldAbilityToHitCalc.bMeleeAttack; // Melee attacks ignore cover and get their own instrinsic hit bonus. NewAbilityToHitCalc.bReactionFire = OldAbilityToHitCalc.bReactionFire; // Reaction fire suffers specific penalties to the hit roll. Reaction fire also causes the Flanking hit bonus to be ignored. NewAbilityToHitCalc.bAllowCrit = OldAbilityToHitCalc.bAllowCrit; // Ability will build crit into the hit table as applicable NewAbilityToHitCalc.bHitsAreCrits = OldAbilityToHitCalc.bHitsAreCrits; // After the roll is made, eHit_Success will always change into eHit_Crit NewAbilityToHitCalc.bMultiTargetOnly = OldAbilityToHitCalc.bMultiTargetOnly; // Guarantees a success for the ability when there is no primary target. NewAbilityToHitCalc.bOnlyMultiHitWithSuccess = OldAbilityToHitCalc.bOnlyMultiHitWithSuccess; // Multi hit targets will only be hit as long as there is a successful roll (e.g. Sharpshooter's Faceoff ability) NewAbilityToHitCalc.bGuaranteedHit = OldAbilityToHitCalc.bGuaranteedHit; // Skips all of the normal hit mods but does allow for armor mitigation rolls as normal. NewAbilityToHitCalc.bIgnoreCoverBonus = OldAbilityToHitCalc.bIgnoreCoverBonus; // Standard high/low cover bonuses do not apply NewAbilityToHitCalc.FinalMultiplier = OldAbilityToHitCalc.FinalMultiplier; // Modifier applied to otherwise final aim chance. Will calculate an amount and display the ability as the reason for the modifier. NewAbilityToHitCalc.BuiltInHitMod = OldAbilityToHitCalc.BuiltInHitMod; // Initial modifiers that are always used by the ability. ModReason will be the ability name. NewAbilityToHitCalc.BuiltInCritMod = OldAbilityToHitCalc.BuiltInCritMod; // Initial modifiers that are always used by the ability. ModReason will be the ability name. AbilityTemplate.AbilityToHitCalc = NewAbilityToHitCalc; if (AbilityTemplate.AbilityToHitOwnerOnMissCalc.class == class'X2AbilityToHitCalc_StandardAim'){ //ABILITIES ALSO HAVING .ABILITYTOHITOWNERONMISSCALC AbilityTemplate.AbilityToHitOwnerOnMissCalc = NewAbilityToHitCalc;}}}} //ALWAYS HAVE IT IDENTICAL TO .ABILITYTOHITCALC */ // if (AbilityTemplate.AbilityToHitCalc .Name == 'DefaultSimpleStandardAim') AbilityTemplate.AbilityToHitCalc = new class'Override_X2AbilityToHitCalc_StandardAim'; // if (AbilityTemplate.AbilityToHitOwnerOnMissCalc.Name == 'DefaultSimpleStandardAim') AbilityTemplate.AbilityToHitOwnerOnMissCalc = new class'Override_X2AbilityToHitCalc_StandardAim'; // if (AbilityTemplate.AbilityToHitCalc .Name == 'SimpleStandardAim') AbilityTemplate.AbilityToHitCalc = new class'Override_X2AbilityToHitCalc_StandardAim'; // if (AbilityTemplate.AbilityToHitOwnerOnMissCalc.Name == 'SimpleStandardAim') AbilityTemplate.AbilityToHitOwnerOnMissCalc = new class'Override_X2AbilityToHitCalc_StandardAim';}} AbilityToHitCalc = X2AbilityToHitCalc_StandardAim(AbilityTemplate.AbilityToHitCalc); if (AbilityToHitCalc == None) continue; if (AbilityToHitCalc.bIndirectFire == true || //HITABILITIESTEMPLATE WITH THESE VARIABLES PRESENT AbilityToHitCalc.bReactionFire == true || //ALREADY CORRECTLY USE THE OVERRIDDEN HITABILITY CLASS AbilityToHitCalc.bAllowCrit == false || //WHILE THE REMAINING ONES USED AN UNCONVENTIONAL AbilityToHitCalc.bHitsAreCrits == true || //DEFINITION NOT REFERENCING DIRECTLY TO HABILITYTOHITCALC AbilityToHitCalc.bMultiTargetOnly == true || //AND THEREFORE USING THE UNOVERRIDDEN HITABILITY CLASS AbilityToHitCalc.bOnlyMultiHitWithSuccess == true || //... ?? ... ONLYMULTIHITWITHSUCCESS DEFINED ONLY ON SHARPSHOOTER'S FACEOFF ABILITY (AS FALSE)... BUT UNDEFINED BOOLS ARE ALWAYS FALSE... MAYBE FIRAXIS IS STILL "THINKING ABOUT IT"??? AbilityToHitCalc.bGuaranteedHit == true || AbilityToHitCalc.FinalMultiplier != 1 || AbilityToHitCalc.BuiltInHitMod != 0 || //) continue; AbilityToHitCalc.BuiltInCritMod != 0 || AbilityToHitCalc.bMeleeAttack == true ) continue; //BEFORE THE BMELEEATTACK WAS NOT SEEN AS TRUE WITH MY OVERRIDE (APPLYING THEREFORE COVER, GOODANGLE,ETC..)... STRANGE... SO TRIED TO ADD THIS LAST CHECK TO LEAVE THE X2ABILITYTOHIT_STANDARDMELEE ALONE... AbilityToHitCalcMelee = X2AbilityToHitCalc_StandardMelee(AbilityTemplate.AbilityToHitCalc); if (AbilityToHitCalcMelee != None) continue; //EVEN THIS LINE... JUST IN CASE X2ABILITYTOHITCALC_STANDARDMELEE'S FATHER (_STANDARDAIM) DOESNT SEE THE .BMELEEATTACK VARIABLES SET... AbilityTemplate.AbilityToHitCalc = new class'Override_X2AbilityToHitCalc_StandardAim'; AbilityToHitCalc = X2AbilityToHitCalc_StandardAim(AbilityTemplate.AbilityToHitOwnerOnMissCalc); if (AbilityToHitCalc == None) continue; AbilityTemplate.AbilityToHitOwnerOnMissCalc = new class'Override_X2AbilityToHitCalc_StandardAim';}} // class'X2DataTemplateManager'.static.RebuildAllTemplateGameCaches();} defaultproperties { ModInjected = false; ScreenClass = none;}