Amineri Posted May 9, 2013 Share Posted May 9, 2013 Another step forward ... was able to finally get the developer console to display the following error that occurs when an alien is overwatched and flanked: [0082.16] ScriptWarning: Divide by zero XGAIAbilityDM URB_GasStation.TheWorld:PersistentLevel.XGAIAbilityDM_1 Function XComGame.XGAIAbilityDM:AI_GetScoreModifier:01F5 This error message occurred twice (and I had two sectoid overwatched and flanked). The only division occuring in XGAIAbilityDM.AI_GetScoreModifier is : if(kAbility.GetType() == 1){if(!m_kBehavior.m_bIgnoreOverwatchers && (m_kPlayer.m_arrEnemiesInOverwatch.Length > 0)){fModifier *= 0.30 / float(m_kBehavior.m_iOverwatchDangerZone);}} I thought that m_iOverwatchDangerZone should always be 1, 2, or 3, if m_arr_EnemiesInOverwatch.Length > 0, but apparently a zero value can sneak in there. This is with the vanilla game running. I don't get the error when there are no overwatching soldiers ... which is when the sectoids move and take actions as normal Link to comment Share on other sites More sharing options...
Amineri Posted May 9, 2013 Share Posted May 9, 2013 (edited) Just fixing that one divide-by-zero error seems to have drastically improved matters. There were sort of two bugs. 1) The conditional was checking m_kPlayer.m_arrEnemiesInOverwatch.Length -- this is the total number of XCOM soldiers in overwatch, not just the ones in visual range 2) This led to oft-times divide-by-zero errors when m_iOverwatchDangerZone would be zero I'm currently running a vanilla game with just this one change, and the sectoids will shoot back and not skip their turns. Hex change is pretty short: before:07 F6 01 9A 19 00 BA 88 00 00 0A 00 1C 7C 00 00 00 1B 1E 35 00 00 00 00 00 00 16 26 16 07 F6 01 82 81 19 01 B0 88 00 00 0A 00 C2 8A 00 00 00 2D 01 C2 8A 00 00 16 18 23 00 97 36 19 01 B1 88 00 00 09 00 77 BB 00 00 00 01 77 BB 00 00 25 16 16 B6 00 B8 88 00 00 AC 1E 9A 99 99 3E 38 3F 19 01 B0 88 00 00 09 00 8C 8A 00 00 00 01 8C 8A 00 00 16 16 04 00 B8 88 00 00 04 3A B9 88 00 00 53 after:07 F7 01 9A 19 00 BA 88 00 00 0A 00 1C 7C 00 00 00 1B 1E 35 00 00 00 00 00 00 16 26 16 07 F7 01 82 81 19 01 B0 88 00 00 0A 00 C2 8A 00 00 00 2D 01 C2 8A 00 00 16 18 23 00 97 36 19 01 B2 88 00 00 09 00 91 30 00 00 00 01 91 30 00 00 25 16 16 B6 00 B8 88 00 00 AC 1E 9A 99 99 3E 38 3F 36 19 01 B2 88 00 00 09 00 91 30 00 00 00 01 91 30 00 00 16 16 04 00 B8 88 00 00 00 B8 88 00 00 53 code before:if(!m_kBehavior.m_bIgnoreOverwatchers && (m_kPlayer.m_arrEnemiesInOverwatch.Length > 0)){ fModifier *= 0.30 / float(m_kBehavior.m_iOverwatchDangerZone);} code after:if(!m_kBehavior.m_bIgnoreOverwatchers && (m_kUnit.m_arrFlankingUnits.Length > 0)){ fModifier *= 0.30 / float(m_kUnit.m_arrFlankingUnits.Length);} The unit now only gets a move score penalty if there are units flanking IT. The penalty is inversely proportional to this same number -- guaranteed no divide-by-zero. --------------------------------------- This change by itself will enable the designed-for behavior, which appears to highly limit moving if any XCOM unit is overwatching. Even just one guy with a pistol 23 tiles away. Units prioritize shooting any units that are flanking. If more than one unit is flanking then it will shoot at the closest. I'm willing to put together a slightly more comprehensive package if people are interested. It would allow:1) occasional repositioning if only 1 unit is overwatching, but only if the current shot is bad and move gets to a better location2) units able to dash when fleeing Edited May 9, 2013 by Amineri Link to comment Share on other sites More sharing options...
johnnylump Posted May 9, 2013 Author Share Posted May 9, 2013 That's great! No good mod should be without this. Would you recommend keeping or dropping the other AI changes you have proposed? Link to comment Share on other sites More sharing options...
Amineri Posted May 9, 2013 Share Posted May 9, 2013 (edited) Well, on classic and impossible essentially any overwatch will still prevent aliens from moving, allowing you to lock aliens into exposed/flanked positions while you trade fire with them from high cover. Some may not view this as an exploit, since it requires keeping one soldier on overwatch (and hence not shooting). Note that using this 'tactic' makes Covering Fire a MUCH more useful perk. The goal of using Covering Fire is to prevent the aliens from running for cover, forcing them to remain in their flanked/exposed positions. However, Covering Fire allows the unit to still shoot, hence not "wasting" the unit by just overwatching and never shooting. Also note that this 'tactic' would make the Ready For Anything perk EXTREMELY useful (it allows a soldier that didn't move to shoot and enter overwatch). ---------------------------------- If you just want to make the aliens shoot (but not be allowed to move), then this hex change is all that is needed. I'm going to work up some various AI alterations after I finish packaging up the new Perk Tree mod into a ToolBoks custom mod. I'll start a new thread taking suggestions for AI improvements. Edited May 9, 2013 by Amineri Link to comment Share on other sites More sharing options...
Yzaxtol Posted May 11, 2013 Share Posted May 11, 2013 Unfortunately I've still gotten a sectoid that won't fire after being supressed and flanked. http://cloud-2.steampowered.com/ugc/885233862089264688/071115E27CDC44CE1F9C1654ABA613732644BD81/ Link to comment Share on other sites More sharing options...
Amineri Posted May 11, 2013 Share Posted May 11, 2013 (edited) Unfortunately I've still gotten a sectoid that won't fire after being supressed and flanked. http://cloud-2.steampowered.com/ugc/885233862089264688/071115E27CDC44CE1F9C1654ABA613732644BD81/ Interesting. Suppression is handled by the AI in a completely different way than overwatching. Essentially the AI treats Suppression as "more dangerous" than overwatch, so the restrictions against it moving are even more absolute. From a game-theoretic perspective, I'd think that moving when suppressed is a BETTER choice than when just overwatched. The negatives in both cases are the same... a reaction fire shot at you. But moving when suppressed clears the -30 aim penalty that is suffered. You've reduced the base aim of all units in your Merciless Mod, right? What should the to-hit value be for a Suppressed sectoid shooting at someone in full cover? I make the penalty to be -70% to hit, so it's very likely that the Sectoid has a 0% chance to hit, which is why it doesn't shoot. To fix this we'd have to allow suppressed units to move -- that is truly the unit's only option in the situation. If you are willing to be a guinea pig, try the hex change: original:1B 2D 61 00 00 00 00 00 00 24 01 26 16 change to:1B 2D 61 00 00 00 00 00 00 24 59 26 16 This will change the setting of the rule from:SetAbilityRestriction(1, 1) to:SetAbilityRestriction(89, 1) eAbility_MAX = 89, so this should then have no effect. I'm not sure if there are other restrictions on the unit moving based on suppression. If you are suppressing the unit and another unit is overwatching, the unit may still be prevented from moving. If you are curious, the second 1 refers to the condition itself -- being suppressed. Edited May 11, 2013 by Amineri Link to comment Share on other sites More sharing options...
dubiousintent Posted May 12, 2013 Share Posted May 12, 2013 (edited) 1. It's always useful to have identified the relevant code.2. People will do what they wish with this information. More power to them.3. In real life, the only people who attempt to move while under suppression fire are either panicked, or 'soon to be wounded or dead' hero-wannabes. Moving merely increases the odds from a relatively low chance of being hit (assuming some cover) to a much better chance of being hit. How well the game handles this will be interesting to see, though I suspect it will just remove the cover defense without giving the suppressor any other aim bonuses.4. The appropriate counter to being suppressed is to have other members of your team either counter-suppress, or take out the suppressor with aimed shots, or (last resort) covering the withdrawal attempt with smoke. Increasing the likelihood of one of those reactions by the aliens appears to me to be a better solution than having the suppressed target simply forced to move.5. If you effectively negate suppression, how do you expect anyone to capture aliens? But that's just my opinion (with some RL experience behind it). -Dubious- Edited May 12, 2013 by dubiousintent Link to comment Share on other sites More sharing options...
wcraige Posted May 19, 2013 Share Posted May 19, 2013 If you are willing to be a guinea pig, try the hex change: original:1B 2D 61 00 00 00 00 00 00 24 01 26 16 change to:1B 2D 61 00 00 00 00 00 00 24 59 26 16 This will change the setting of the rule from:SetAbilityRestriction(1, 1) to:SetAbilityRestriction(89, 1) eAbility_MAX = 89, so this should then have no effect. I'm not sure if there are other restrictions on the unit moving based on suppression. If you are suppressing the unit and another unit is overwatching, the unit may still be prevented from moving. If you are curious, the second 1 refers to the condition itself -- being suppressed. Thought I'd pop in to say that I tried this and it made no difference - flanking a suppressed unit still resulted in AI freezing. Also, dunno if you've ever noticed this, but twice now I have seen a floater move while suppressed (I think in a retreat action). Thought this was worth mentioning in case it's useful for discerning a solution (I wouldn't know where to look or what to look for myself!) Will. Link to comment Share on other sites More sharing options...
johnnylump Posted May 20, 2013 Author Share Posted May 20, 2013 @ wcraige -- do you have the other freezing fix in place, as well? -- It's In the updated original post of this thread. Link to comment Share on other sites More sharing options...
wcraige Posted May 20, 2013 Share Posted May 20, 2013 Assuming you mean the overwatch freeze fix, yes, definitely. To be sure (realising I'd never been in a situation where it would have mattered) I just did a test to see if it was working. Sectoids gladly killed my overwatching soldiers while flanked. It's worth noting, regarding my point about the floater and suppression, that this happened once *before* I modded out the overwatch freeze (so it doesn't happen because of that change, although I've been running Merciless as a base so maybe there's a change there somewhere?). Will. Link to comment Share on other sites More sharing options...
Recommended Posts