Way to vary max LOS?

Post Reply
Karvon
Major-General - Tiger I
Major-General - Tiger I
Posts: 2384
Joined: Fri Jan 27, 2012 12:36 pm
Location: Osaka, Japan

Way to vary max LOS?

Post by Karvon »

I was wondering if there was a way of capping LOS distance to reflect night actions or battles in fog/dust, etc?
Chaos Tourney and Little Wars Organizer, TDC VIII Bronze Age Coordinator. WTC US Team Hell on Wheels Captain.
Paul59
General - King Tiger
General - King Tiger
Posts: 3859
Joined: Tue Jul 21, 2015 11:26 pm

Re: Way to vary max LOS?

Post by Paul59 »

Karvon wrote: Sat Dec 11, 2021 1:59 pm I was wondering if there was a way of capping LOS distance to reflect night actions or battles in fog/dust, etc?
It's easily possible for a Editor created scenario.

Just put this script in the FUNCTION StartTurnPost(side) of the scenarios .bsf file.

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);
				}
		}
	}
It will need a few variables defined, at least these:

Code: Select all

	int j;
	int visibility;
	int v;
and maybe a few others, they just go at the start of the FUNCTION StartTurnPost(side)

I used this in my Castulo scenario, which is available for download. Download it, open the .bsf file and you can see how it's done. I originally got the script from the Pike and Shot scenario Lutzen. If I remember correctly, the actual range of LOS varies from turn to turn, simulating the effect of the smoke clearing or getting worse. The bit about the windmill hill just gives an extended LOS for units on hills equal to or over 50 high. I have never tried changing the values, but I am guessing that you would have to change the values in

Code: Select all

visibility = SkewedRandom(2, 6, 1) * 10;
If you want it for a mod, I am afraid I don't know how it would be done, but I am sure RBS would know.


cheers

Paul
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
Post Reply

Return to “Field of Glory II: Modding”