Jump to content

All about Will


RYUchan

Recommended Posts

Good day!

 

I'm poking around XComGame.upk in order to implement some of my ideas on will stat. I have some questions about it.

 

1) Is it possible to replace Iron Will OTS upgrade with a permanent bonus to will, say +15 to existing and new soldiers?

 

2) Can anyone point how to remove will stat penalty after bleeding out, either completely or maybe after you use revive skill.

 

3) If I want a small will progression based on a successful mission count without casualities/2, is this the correct method?

			if(noDeadSoldiers)
                          kSoldier.m_kChar.aStats[7] += 0.5;
			{
				kSoldier.AddXP(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.CalcXP(kUnit, 6, none));
				// End:0x507 Loop:False
				if(kSoldier.m_kChar.aUpgrades[158] > 0 && (kSoldier.m_kChar.aStats[6] < XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.COUNCIL_STAT_MAX))
				{
					kSoldier.m_kChar.aStats[6] += 1;
					kSoldier.m_kChar.aStats[1] += XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.COUNCIL_STAT_BONUS;
					kSoldier.m_kChar.aStats[7] += XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.COUNCIL_STAT_BONUS;
				}
			}
Link to comment
Share on other sites

1) Should be possible, but I haven't played much with adjusting OTS effects. The function XGTechTree.ApplyOTSTech in XComStrategyGame is called when a ots upgrade is unlocked so that's where to look first.

 

2) Check XGUnit.OnTakeDamage and you should see all the code related to taking damage, death, and critical wounds.

 

3) aStats is an array of int, so adding 0.5 won't work correctly - you can only record whole numbers there. So if you want to add the bonus only once every N missions without casualties you need to record the number of missions without casualties somewhere else and then increment the will stat when it reaches the threshold. To do this you'll need to borrow some other variable to record the mission count or extend the number of stats on a soldier. This is something that LW has done a lot of and has often run out of of "stealable" variables, so if you want your mod to be LW compatible this might be difficult. If you don't care about that, you can likely steal one that LW already stole, but I'm not sure which of those there are. One option might be stat 18 - reaction. Not sure if that's actually used, you'd need to carefully search for uses of aStats[18] and callers of all of those functions to make sure you're not breaking anything if you decide to use it.

Link to comment
Share on other sites

Thanks for the tips.

 

I guess 1 and 3 is too complicated for me, at least for now :smile: Since I have no idea how to add bonus to all soldiers present and new

 

as for the 2nd one.

if(!bMPForceDeathOnMassiveDamage && (inDamageType != class'XComDamageType_MindMerge') && (!m_bCriticallyWounded) && (!ActionQueueContains('XGAction_Death')) && (kDamageDealer != none) && (kDamageDealer.GetCharacter().m_kChar.iType != 13) && (!XComTacticalGRI(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kBattle.m_kDesc.m_bScripted) && (!XComTacticalGRI(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kBattle.m_kDesc.m_bDisableSoldierChatter) && (XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.CalcCriticallyWounded(self, GetCharacter().m_kChar, m_aCurrentStats, iDamage, iRank, GetCharacter().AllObjects('XGCharacter_Soldier') && (XGCharacter_Soldier(GetCharacter()).m_kSoldier.iPsiRank == 4), GetCharacter().HasUpgrade(4) && (m_iUsedSecondaryHeart == 0), m_iUsedSecondaryHeart, GetPawn().Location, m_eTeamVisibilityFlags)))
		{
			SetUnitHP(1);
			m_kPawn.Health = 1;
			m_kDamageDealer = kDamageDealer;
			// End:0x18ca Loop:False
			if(!GetCharacter().HasUpgrade(4))
			{
				m_aCurrentStats[7] -= XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.5;
				GetCharacter().m_kChar.aStats[7] -= XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.5;
			}
			AddCriticallyWoundedAction();
		}
		// End:0x1ca9

Do I understand it correctly that the first one is for combat and the other string is overall will decrease? So if I want to change overall will decrease I need to edit the second one?

Edited by RYUchan
Link to comment
Share on other sites

Yes, the first one is the will stat on the character in the current combat. It'd be relevant only if they get revived. The second one is the permanent stat on the character that gets copied back to the strategy game after combat ends. So, if you just took the 2nd one out altogether but left the first one they'd have a will penalty for that combat if you revived them, but that penalty would disappear at the end of combat.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...