SteelRook Posted February 21, 2016 Share Posted February 21, 2016 Just for my own personal curiosity - is there any way I can mess with Squadsight aim penalties in real time as the game is running? I'm mulling over a new project somewhere in the future which replaces Death From Above completely with a brand new sniper-enhacing skill. One of my ideas was for that skill - still called "Death From Above" - to remove or lessen the squad sight aim penalties at range against targets that the sniper has a height advantage on. I tracked down the Squad Sight aim penalties to a frighteningly large function which seems to handle all aim calculations in the game, one that's obviously not a good candidate for tinkering with. On cursory examination, that more or less makes squad sight penalties not subject to being altered by skills. Does anyone know how that works? To be honest, I liked the Damn Good Ground skill from Enemy Within more than Death From Above. If messing with squad sight falls through, then I'll probably just have to replace the skill with an aim and crit bonus for having the high ground, probably dependent on weapon tech level again. Link to comment Share on other sites More sharing options...
davidlallen Posted February 21, 2016 Share Posted February 21, 2016 Is this helpful, or too simple?http://steamcommunity.com/sharedfiles/filedetails/?id=617712294&searchtext=squadsight Link to comment Share on other sites More sharing options...
SteelRook Posted February 21, 2016 Author Share Posted February 21, 2016 Is this helpful, or too simple?http://steamcommunity.com/sharedfiles/filedetails/?id=617712294&searchtext=squadsight Too simple, in the sense that it's an ini file tweak to change the squad sight penalty value globally. I'm trying to change it conditionally based on what skills the sniper has. I want my "Sniper" sharpshooters to suffer less of a range penalty than my "Gunslinger" sharpshooters, which means I need to change the penalty at runtime. Or I guess cheat by adding aim to counter the squad sight penalty but that's a horrible way of doing it. Link to comment Share on other sites More sharing options...
Deleted32045420User Posted February 21, 2016 Share Posted February 21, 2016 Is this helpful, or too simple?http://steamcommunity.com/sharedfiles/filedetails/?id=617712294&searchtext=squadsight Too simple, in the sense that it's an ini file tweak to change the squad sight penalty value globally. I'm trying to change it conditionally based on what skills the sniper has. I want my "Sniper" sharpshooters to suffer less of a range penalty than my "Gunslinger" sharpshooters, which means I need to change the penalty at runtime. Or I guess cheat by adding aim to counter the squad sight penalty but that's a horrible way of doing it.Not really. It beats any other way you can do it,it dosnt mess with other code,dosnt break compatibility and is all around harmless and less bug prone Link to comment Share on other sites More sharing options...
SteelRook Posted February 21, 2016 Author Share Posted February 21, 2016 Not really. It beats any other way you can do it,it dosnt mess with other code,dosnt break compatibility and is all around harmless and less bug prone Which part are you referring to with "not really?" I don't mean to be rude and I do apologise if it comes across that way. I just can't follow which approach you're referring to being harmless and less bug prone. Confusion on my part. Link to comment Share on other sites More sharing options...
Deleted32045420User Posted February 21, 2016 Share Posted February 21, 2016 Or I guess cheat by adding aim to counter the squad sight penalty but that's a horrible way of doing it. just add a modifyStat effect Link to comment Share on other sites More sharing options...
SteelRook Posted February 21, 2016 Author Share Posted February 21, 2016 I'm not familiar with "modifyStat." How does that work? That seems possible to do if I can read the distance to target and use that as the basis of the bonus. I was thinking of maybe using a PersistentEffect with an internal logical check to see if the soldier has a height advantage on the target. Link to comment Share on other sites More sharing options...
Deleted32045420User Posted February 21, 2016 Share Posted February 21, 2016 I'm not familiar with "modifyStat." How does that work? That seems possible to do if I can read the distance to target and use that as the basis of the bonus. I was thinking of maybe using a PersistentEffect with an internal logical check to see if the soldier has a height advantage on the target.you can probably take most of the stuff you need for the internal logic from the stock code for checking those things, modify stats works by giving it a set of stat changes and smacking it's bum Link to comment Share on other sites More sharing options...
SteelRook Posted February 22, 2016 Author Share Posted February 22, 2016 So far, my plan is to use a version of the Steady Hands approach for Death From Above, but the way that effect is hooked up confuses me a little. Code snipper from X2Ability_SharpshooterAbilitySet follows: local X2Effect_Persistent PersistentEffect; local X2Effect_PersistentStatChange StatChangeEffect; // this effect stays on the unit indefinitely PersistentEffect = new class'X2Effect_Persistent'; PersistentEffect.EffectName = 'SteadyHands'; PersistentEffect.BuildPersistentEffect(1, true, true, false, eGameRule_PlayerTurnBegin); PersistentEffect.SetDisplayInfo(ePerkBuff_Passive, Template.LocFriendlyName, Template.GetMyHelpText(), Template.IconImage, true,,Template.AbilitySourceName); // each turn this effect is applied StatChangeEffect = new class'X2Effect_PersistentStatChange'; StatChangeEffect.EffectName = 'SteadyHandsStatBoost'; StatChangeEffect.BuildPersistentEffect(1, false, true, false, eGameRule_PlayerTurnEnd); StatChangeEffect.AddPersistentStatChange(eStat_Offense, default.STEADYHANDS_AIM_BONUS); StatChangeEffect.AddPersistentStatChange(eStat_CritChance, default.STEADYHANDS_CRIT_BONUS); This is how Steady Hands is defined (the rest of the function is utility settings). Basically, there's a persistent effect which does nothing but apply a non-persistent effect on every "tick," with the tick event being the start of the player's turn. What I don't understand is why this is needed. Why not use just a simple X2Effect_Persistent and bake the logical checks inside its return functions? Or can X2Effect_Persistent not handle aim bonuses? Hmm... It doesn't seem like there are functions for handling aim or critical hits in there. Interesting. This brings up the question - how does one give conditional aim bonuses to a soldier, then? Do I HAVE to use a non-persistent effect? Link to comment Share on other sites More sharing options...
Recommended Posts