Page 1 of 1

LOS in tiles/10 (so 50 means 5 tiles)

Posted: Thu Dec 12, 2019 3:55 pm
by Ubberdorc
In the Squads file what do these do?

LOS in tiles/10 (so 50 means 5 tiles)
LOS to infantry in cover/10

Are they representative of how far the unit can see (like I got my binoculars out looking - scouting distance)
or
How far the unit itself can be seen (like I am hiding - stealth)

Re: LOS in tiles/10 (so 50 means 5 tiles)

Posted: Sat Dec 14, 2019 7:41 am
by rbodleyscott
Ubberdorc wrote: Thu Dec 12, 2019 3:55 pm In the Squads file what do these do?

LOS in tiles/10 (so 50 means 5 tiles)
LOS to infantry in cover/10

Are they representative of how far the unit can see (like I got my binoculars out looking - scouting distance)
or
How far the unit itself can be seen (like I am hiding - stealth)
The former.

Re: LOS in tiles/10 (so 50 means 5 tiles)

Posted: Sat Dec 14, 2019 3:43 pm
by Ubberdorc
Thank you.
I was hoping it was the other way around like the scenario design PDF said. Is there anything that makes a unit hard to see?

4.9 LOS
200 Divide by 10 to get number of tiles away that unit can be seen.
4.10 CoverLOS
20 Divide by 10 to get number of tiles away that unit can be seen when under cover.

Re: LOS in tiles/10 (so 50 means 5 tiles)

Posted: Sat Dec 14, 2019 3:51 pm
by Athos1660
Ubberdorc wrote: Sat Dec 14, 2019 3:43 pm Is there anything that makes a unit hard to see?
Obstacles and terrain ?

Re: LOS in tiles/10 (so 50 means 5 tiles)

Posted: Sat Dec 14, 2019 4:27 pm
by Ubberdorc
Yeah Forests work real well - I was just hoping to have a good ambush unit.

Athos1660 wrote: Sat Dec 14, 2019 3:51 pm
Ubberdorc wrote: Sat Dec 14, 2019 3:43 pm Is there anything that makes a unit hard to see?
Obstacles and terrain ?

Re: LOS in tiles/10 (so 50 means 5 tiles)

Posted: Sat Dec 14, 2019 5:11 pm
by Athos1660
Ubberdorc wrote: Sat Dec 14, 2019 4:27 pm Yeah Forests work real well - I was just hoping to have a good ambush unit.
There are also other kinds of terrains and obstacles that offer concealment to troops.
See manual, section 14.4, if you haven't yet. :-)

Moreover, obstacles offer protection (14.6).

I guess that, at that time, in terms of stealth, nothing could equal a small group of detached musketeers approaching an enemy camp at night (for scouting, stealing...). However, the day and night cycle has no effect on visibility in game.

Re: LOS in tiles/10 (so 50 means 5 tiles)

Posted: Sat Dec 14, 2019 5:52 pm
by Cronos09
Ubberdorc wrote: Sat Dec 14, 2019 3:43 pm Is there anything that makes a unit hard to see?
It may be scripted very easily. I can give two different examples of the scripts: Lutzen.BSF (...\Campaigns\1ThirtyYearsWar\Scenarios\) using SkewedRandom function

Code: Select all

	// CUSTOM - Set variable visibility for fog etc.
	visibility = SkewedRandom(2, 6, 1) * 10;  

//  visibility = 300; // For demo only.

	for (j = 0; j < 2; j++)
	{
		for (i = 0; i < GetUnitCount(j); i++)
		{
			id = GetUnitID(j,i);
			if (id != -1)
				{
					v = visibility;
					// Increase visibility for units on windmill hill
					if (GetTileHeight(GetUnitX(id), GetUnitY(id)) >= 50)
						{
							v += 60;
						}
					SetAttrib(id, "LOS", v);
				}
		}
	}
	// END CUSTOM
and SOOR.BSF in SOOR scenario by Edward77 using a certain number of 'visible' tiles

Code: Select all

       if ((turn == 0) || (turn == 1))
         {
            visibility = 30;
         }

       if ((turn == 2) || (turn == 3))
         {
            visibility = 50;
         }

       if ((turn == 4) || (turn == 5))
         {
            visibility = 70;
         }

       if (turn > 5)
         {
           visibility = 120;
         }

        if (turn > 7)
         {
           visibility = 160;
         }

       for (j = 0; j < 2; j++)
	{
		for (i = 0; i < GetUnitCount(j); i++)
		{
			id = GetUnitID(j,i);
			if (id != -1)
				{
					v = visibility;
					// Increase visibility for units on heights
					if (GetTileHeight(GetUnitX(id), GetUnitY(id)) >= 50)
						{
							v += 20;
						}
					SetAttrib(id, "LOS", v);
				}
		}
	}
FUNCTION SkewedRandom(min, max, skew_type)

Code: Select all

// Returns skewed randomly generated number.
FUNCTION SkewedRandom(min, max, skew_type)
{
int result;
int randomizer;
int difference;

	if (skew_type == 0) // Uniform distribution
		{
			result = Rand(min,max);
		}

	if (skew_type == 1) // Bell-shaped distribution
		{
			result = Rand(min,max) + Rand(min,max);
			result /= 2;
		}

	if (skew_type == 2) // Left skew (low values predominant)
		{
			// This version is equivalent to (Rand(0, max - min) ^ 2) / ((max - min) ^ 1) + min.
			// It gives an average value of approximately 2/3 of the average of a non-skewed range.

			difference = max - min;
			result = Rand(0, difference);
			result *= result;
			result /= difference;
			result += min;
		}

	if (skew_type == 3) // Right skew (high values predominant)
		{
			// Not yet implemented.
			Log ("Skew Type 3 not yet implemented");
			result = Rand(min,max); // To avoid crashing if it is attempted to be used.
		}

return result;
}

Re: LOS in tiles/10 (so 50 means 5 tiles)

Posted: Sat Dec 14, 2019 6:14 pm
by Athos1660
Thus visibility and weather conditions (fog...), darkness, etc. can be scripted ? Nice !

Re: LOS in tiles/10 (so 50 means 5 tiles)

Posted: Sun Dec 15, 2019 1:02 am
by Ubberdorc
Nice thank you!