Havens and Lasers

Share strategy and tips here.
Post Reply
User avatar
Arcalane
Posts: 339
Joined: Thu Jan 19, 2017 10:42 pm

Havens and Lasers

Post by Arcalane »

I was poking around at a few things and... well, I'll just leave this here--

Code: Select all

    if (Loadout == '')
	{
        LoadoutStr = "RebelSoldier";
		if (class'UIUtilities_Strategy'.static.GetXComHQ().IsTechResearched('MagnetizedWeapons'))
		{
			LaserChance += (20 * (Outpost.GetRebelLevel(RebelRef) + 1)); // 20/40/60
		}
		if (class'UIUtilities_Strategy'.static.GetXComHQ().IsTechResearched('GaussWeapons'))
		{
			LaserChance += (20 * (Outpost.GetRebelLevel(RebelRef) + 1)); // 40/80/100
		}
		if (class'UIUtilities_Strategy'.static.GetXComHQ().IsTechResearched('Coilguns'))
		{
			LaserChance = 100;
			MagChance += (20 * (Outpost.GetRebelLevel(RebelRef) + 1)); //20/40/60
		}
		if (class'UIUtilities_Strategy'.static.GetXComHQ().IsTechResearched('AdvancedCoilguns'))
		{
			MagChance += (20 * (Outpost.GetRebelLevel(RebelRef) + 1)); //40/80/100
		}
		if (class'UIUtilities_Strategy'.static.GetXComHQ().IsTechResearched('PlasmaRifle'))
		{
			MagChance += (20 * (Outpost.GetRebelLevel(RebelRef) + 1)); //60/100/100
		}
		if ((class'Engine'.static.GetEngine().SyncRand(100,"Utilities_LW::"$GetFuncName())) < MagChance)
		{
			LoadoutStr $= "3";
		}
		else
		{
			if ((class'Engine'.static.GetEngine().SyncRand(100,"Utilities_LW::"$GetFuncName())) < LaserChance)
			{
				LoadoutStr $= "2";
			}
		}
		iRand = (class'Engine'.static.GetEngine().SyncRand(100,"Utilities_LW::"$GetFuncName()));
		if (iRand < 20)
		{
			LoadoutStr $= "SMG";
		}
		else
		{
			if (iRand < 40 && Outpost.GetRebelLevel(RebelRef) < 2)
			{
				LoadoutStr $= "Shotgun";
			}
		}
		//`LWTRACE ("Rebel Loadout" @ LoadoutStr);
		Loadout = name(LoadOutStr);
	}
(If I'm reading this right: chance of Haven volunteers being armed with lasers and mag weapons hinges primarily on volunteer level and requires the base tech (of course). If you have coilguns, the chance of lasers is 100%. Mag weapons are essentially guaranteed on any high-level volunteers once you hit Adv. Coilguns.)
User avatar
8wayz
Posts: 340
Joined: Sat Jan 16, 2016 3:59 pm

Re: Havens and Lasers

Post by 8wayz »

Yep, you are reading it right. Their weapons will be upgraded in regards to your tech level and their experience level.
trihero
Posts: 1099
Joined: Sun Jan 01, 2017 7:01 am

Re: Havens and Lasers

Post by trihero »

It matches my experience as well. It gives some minor bonus to researching for instance magnetics even if you don't have the intention or money to build more of them, to make the haven missions a bit safer.
Mavoc
Posts: 38
Joined: Mon Jan 23, 2017 8:13 am

Re: Havens and Lasers

Post by Mavoc »

Now this is not my language, but it seems to be randomizing a number up to 100 and then doing a less than check. Which means even with a 100 chance, you could still fail if the number randomized was a 100 due to it not being a less than or equal to check.
dstar3k
Posts: 91
Joined: Sun Jan 15, 2017 4:11 am

Re: Havens and Lasers

Post by dstar3k »

Mavoc wrote:Now this is not my language, but it seems to be randomizing a number up to 100 and then doing a less than check. Which means even with a 100 chance, you could still fail if the number randomized was a 100 due to it not being a less than or equal to check.
It depends on what SyncRand does. For example, python's random.random() returns a number equal to or greater than zero, and _less than_ 1.0. Perl's rand function returns an integer greater than or equal to 0, and less than the argument provided.

So it's entirely possible that the highest value that that call can return is 99.9999 repeating.
Post Reply