Jump to content

Photo

Psi Soldier Chance


  • Please log in to reply
2 replies to this topic

#1
Kaezarhg

Kaezarhg

    Stranger

  • Members
  • Pip
  • 1 posts
Been playing for some time now, and while trying to make up an all-psi squad (I'm a perfectionist, sue me) I noticed that as you go through it gets harder - or at least it seems so - to get a psi player. I think I'm getting more or less 1 psi every 10 test cycles. Is that right?

Anybody knows the formula that gives the chance of a psi soldier?

#2
Drakous79

Drakous79

    Drak

  • Supporter
  • 845 posts
Here you go.

function bool RollForGift(XGStrategySoldier kSoldier)
{
	local int iChance, iTraineeWill, iGiftedSix, iSoldier, iTraineeRank;

	local array<XGStrategySoldier> arrCandidates;

	arrCandidates = BARRACKS().m_arrSoldiers;
	arrCandidates.Sort(SortPsiCandidates);
	iSoldier = 0;
	while if(iSoldier < Min(6, arrCandidates.Length))
	{
		if(arrCandidates[iSoldier].HasPsiGift())
		{
			++ iGiftedSix;
		}
		++ iSoldier;
	}
	iSoldier = 0;
	while if(iSoldier < m_arrTraining.Length)
	{
		if(m_arrTraining[iSoldier].bPsiGift && arrCandidates.Find(m_arrTraining[iSoldier].kSoldier) != -1 && arrCandidates.Find(m_arrTraining[iSoldier].kSoldier) < 6)
		{
			++ iGiftedSix;
		}
		++ iSoldier;
	}
	iTraineeWill = kSoldier.m_kChar.aStats[7];
	if(IsOptionEnabled(11))
	{
		iChance = int(float(iTraineeWill) / class'XGTacticalGameCore'.default.SW_RARE_PSI);
		iChance /= float(1 + BARRACKS().GetNumPsiSoldiers());
	}
	else
	{
		iChance = int(float(iTraineeWill) / class'XGTacticalGameCore'.default.PSI_GIFT_CHANCE); // basic formula
		iTraineeRank = arrCandidates.Find(kSoldier);
		if(iTraineeRank >= 0 && iTraineeRank < 6)
		{
			iChance += Max(0, 75 - iTraineeRank * 20 - iGiftedSix * 40);
		}
	}
    return Roll(iChance);
}
Roll is true if random number from 100 is less than iChance:
function bool Roll(int iChance)
{
	return Rand(100) < iChance;
}
Looking at the math, the best odds fot getting PSI gift has Major and Colonel, because only basic formula applies to them. Other ranks count with 75 - iTraineeRank * 20 - iGiftedSix * 40.

Good news is you can set PSI_GIFT_CHANCE in DefaultGameCore.ini :) Soldier's will is divided by default value of 4 nerfing the chance. Setting it to 1 improves the situation. It can be set to 0.01f for 100% chance. Tested with 12 soldiers and all got the gift.

Use Modpatcher, but copy your up to date DefaultGameCore.ini to DefaultGameCore.mod and set PSI_GIFT_CHANCE=0.01f

#3
Scipio65

Scipio65

    Journeyman

  • Members
  • Pip
  • 24 posts

Is there a way to 'reset' the lab to accept members that have been tested before but turned out with no ability... so they get a second chance with the new percent chances changed?

 

That is.. can my failed psi-gifted soldiers get to test it again?






IPB skins by Skinbox
Page loaded in: 0.329 seconds