seamus2008 Posted September 3, 2014 Share Posted September 3, 2014 (edited) Like the title says, I'd like the cover penalties to not apply for reaction fires. Right now, abilities like Suppressing Fire and Covering Fire triggers at the enemy unit's original square, unlike normal overwatch with triggers at the first square they move to. The enemy's starting square usually has cover, thus making these abilities somewhat subpar. Is there a way to make reaction fire ignore cover penalties? Help would be greatly appreciated :smile: EDIT: This is for EW by the way. Edited September 3, 2014 by seamus2008 Link to comment Share on other sites More sharing options...
seamus2008 Posted September 4, 2014 Author Share Posted September 4, 2014 Anyone? Link to comment Share on other sites More sharing options...
johnnylump Posted September 4, 2014 Share Posted September 4, 2014 Well, you'll need to recode some hex in XComGame.upk. A lot of to-hit calculations are in native code, so you may need to construct a substantial workaround. Link to comment Share on other sites More sharing options...
seamus2008 Posted September 5, 2014 Author Share Posted September 5, 2014 Well, you'll need to recode some hex in XComGame.upk. A lot of to-hit calculations are in native code, so you may need to construct a substantial workaround. That's what I'm doing, but I don't know which class I should be looking at, I'm currently sifting through XGAction_Fire and XGAction_FireOverwatchExecuting. I'd like to find the part where they check for target cover and add a condition (not for reaction fire). Link to comment Share on other sites More sharing options...
johnnylump Posted September 6, 2014 Share Posted September 6, 2014 Try XGAbility_Targeted, perhaps RollForHit Link to comment Share on other sites More sharing options...
seamus2008 Posted September 9, 2014 Author Share Posted September 9, 2014 (edited) Try XGAbility_Targeted, perhaps RollForHit Thanks for the tip! I couldn't find anything in RollForHit, but I did find something that looks pertinent in GetShotSummary, in the same Class. else { // End:0xB58 if((coverBonus != 0) && !m_bHasFlank) { // End:0xA1C if(coverBonus == XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.LOW_COVER_BONUS) { kInfo.arrHitPenaltyStrings.AddItem(m_strPenaltyLowCover); } // End:0xA45 else { kInfo.arrHitPenaltyStrings.AddItem(m_strPenaltyHighCover); } kInfo.arrHitPenaltyValues.AddItem(-coverBonus); // End:0xB58 if(kTarget.IsHunkeredDown()) { kInfo.arrHitPenaltyStrings.AddItem(m_strHunker); kInfo.arrHitPenaltyValues.AddItem(int((XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.HUNKER_BONUS - float(1)) * float(-coverBonus))); } } } Those are lines 118-141 This looks like the part where the game applies cover bonus to the target. Now, I have little coding experience, what exactly do you think I should add to these lines to make the cover bonus not apply for reaction fire? Edited September 9, 2014 by seamus2008 Link to comment Share on other sites More sharing options...
johnnylump Posted September 9, 2014 Share Posted September 9, 2014 I think getshotsummary is only what is displayed. I'm fairly sure the cover bonuses themselves are in native code. Link to comment Share on other sites More sharing options...
seamus2008 Posted September 9, 2014 Author Share Posted September 9, 2014 I think getshotsummary is only what is displayed. I'm fairly sure the cover bonuses themselves are in native code. You're right, getshosummary changes only the displayed values, like the smoke grenade bonuses. There are two sets of those in getshotsummary The first one is near to top, this one seemingly does nothing. I had thought it changed the real values, but it does nothing. else { coverPerks = kTarget.GetTacticalSenseCoverBonus(); // End:0x22E if(kTarget.HasBonus(15) && kTarget.HasHeightAdvantageOver(m_kUnit)) { coverPerks += XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.10; } // End:0x2BB if(kTarget.m_bInSmokeBomb) { coverPerks += XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.20; } // End:0x348 if(kTarget.m_bInDenseSmoke) { coverPerks += XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.20; } // End:0x3D7 if(kTarget.HasBonus(132)) { coverPerks += XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.15; } coverBonus = Max(0, kTarget.m_iCurrentCoverValue - coverPerks); // End:0x4A0 if(kTarget.HasAirEvadeBonus()) { iEvasionBonus = XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.AIR_EVADE_DEF; } coverBonus = Max(0, coverBonus - iEvasionBonus); } The second set changes the display value when you click the "?" for a hit percentage breakdown. if(kTarget.GetTacticalSenseCoverBonus() > 0) { kInfo.arrHitPenaltyStrings.AddItem(PERKS().GetPenaltyTitle(33)); kInfo.arrHitPenaltyValues.AddItem(-kTarget.GetTacticalSenseCoverBonus()); } // End:0xD15 if(kTarget.HasBonus(15) && kTarget.HasHeightAdvantageOver(m_kUnit)) { kInfo.arrHitPenaltyStrings.AddItem(PERKS().GetBonusTitle(15)); kInfo.arrHitPenaltyValues.AddItem(-XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.10); } // End:0xDFB if(kTarget.m_bInSmokeBomb) { kInfo.arrHitPenaltyStrings.AddItem(PERKS().GetBonusTitle(44)); kInfo.arrHitPenaltyValues.AddItem(-XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.20); } // End:0xEE1 if(kTarget.m_bInDenseSmoke) { kInfo.arrHitPenaltyStrings.AddItem(PERKS().GetBonusTitle(52)); kInfo.arrHitPenaltyValues.AddItem(-XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.20); } // End:0xFC9 if(kTarget.HasBonus(132)) { kInfo.arrHitPenaltyStrings.AddItem(PERKS().GetBonusTitle(132)); kInfo.arrHitPenaltyValues.AddItem(-XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.15); } After some searches I seem to have located the real values in XGTacticalGameCoreNativeBase const DENSE_SMOKE_DEFENSE_BONUS = 20;const SMOKE_BOMB_DEFENSE_BONUS = 20; I can edit Functions just fine, because the hex codes correspond to the lines. However, they're under the Constants tree, not Functions. I tried View Buffer on those lines, and the hex code that came out seemingly has nothing to do with them 40-12-00-00-76-5F-00-00-00-00-00-00-40-12-00-00-03-00-00-00-32-30-00 I'm at a loss as to actually editing those numbers. Link to comment Share on other sites More sharing options...
johnnylump Posted September 9, 2014 Share Posted September 9, 2014 I'm afraid the constants in XGTacticalGameCoreNativeBase don't do anything when changed. (This is something every XCOM modder must learn.) Aim calculations are handled in the exe (native code), which we cannot edit directly. So if you want to change some aim-related function, you must deduce how it works and then address it in the upk. The problem is that aim calculations are clamped to between 0 and 100 in native code, so in cases where the REAL to hit is below zero or above 100, the difference in aim is lost and unrecoverable, and new bonuses and penalties you add start at 0 or 100. Long War makes a couple of changes like this anyway. We made Lightning Reflexes not automatic in XGAbility_Targeted_RollForHit, and put our range penalties on pistols there, too. So if you can accept the issue I described, I'd recommend RollForHit : Here's some garbage psuedocodeIf hasupgrade(coveringfire) && isreactionshot{if getprimarytarget().is in light covertohit += (lightcovervalue from dgc.ini) else if getprimarytarget().is in heavy covertohit += (heavy cover value from dgc.ini)} Again, if the actual hit came in at -15, the shooter is getting a substantial bonus because the additions start in at zero. No way around this except to rewrite entire XCOM's entire aim calculations from scratch. You'd have to figure out how to determine that the shot is a suppression-based reaction shot, or else recode the shot elsewhere to take place after the unit leaves cover. Link to comment Share on other sites More sharing options...
Recommended Posts