Dynamic lighting? Is this possible?

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Dynamic lighting? Is this possible?

Post by GottaLove88s »

Gents,

I'd like to add changing lighting during a battle.

Specifically, for Dieppe, I want to start at night, with dark/blue lighting, but then warm up into dawn colours about 10 turns in...

I believe that I've figured out how to mod LOS to match. So the commando raid would benefit from defenders' reduced LOS for the first 10 turns, but then be exposed to the full fury of accurate snipers and arty from turns 10-30...

Is this possible?
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
Amaris
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 929
Joined: Fri Jul 23, 2010 11:08 am
Location: France
Contact:

Re: Dynamic lighting? Is this possible?

Post by Amaris »

Not tested but I think that possible:

Seen into autodoc.txt:

//load a lighting file from the scenarios folder, name does not include .txt extension
SetLightingFile(lightfile)

So if you have several lighting files, you can load them when you want with adding into your scenario.BSF files a script like:

Code: Select all

FUNCTION StartTurn(side)
{
...
	if( GetTurn() == TURN_DESIRED1 )
	{
		SetLightingFile(lightfile1);
	}
	if( GetTurn() == TURN_DESIRED2 )
	{
		SetLightingFile(lightfile2);
	}
...
}
“Take care, my friend; watch your six, and do one more roll… just for me.”
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Re: Dynamic lighting? Is this possible?

Post by GottaLove88s »

Intriguing! Nicely discovered Alex... Merci encore... :D :D :D

So if we start with a night lighting file and switch to a dawn lighting file after 10 turns...

Then add a LOS change for all units, also at 10 turns...

We can simulate a night raid becoming a dawn battle...

That's AWESOME!! Let's test... :mrgreen:
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Re: Dynamic lighting? Is this possible?

Post by GottaLove88s »

Hi Amaris!

I tried your solution in Dieppe v1.01 but it didn't seem to recognise the DIEPPE_LIGHTING filenames for my Lighting Files, even tho they're definitely in the scenario folder... BA kept crashing... Any ideas why??

For now, I've settled with half LOS for the first 5 turns for both players, opening up to full LOS on turn 6, to simulate dawn...
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
Amaris
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 929
Joined: Fri Jul 23, 2010 11:08 am
Location: France
Contact:

Re: Dynamic lighting? Is this possible?

Post by Amaris »

May ba a name problem:

Seen into autodoc.txt:

//load a lighting file from the scenarios folder, name does not include .txt extension
SetLightingFile(lightfile)


Otherwise send me the all mod, I'll check that when I've time. :roll:
“Take care, my friend; watch your six, and do one more roll… just for me.”
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Re: Dynamic lighting? Is this possible?

Post by GottaLove88s »

Ummm... Could be...?

Here's the actual error report... It seems to want to interpret the filename inside SetLightingFile as a variable, where the actual filename is not meaningful...?
Image
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Re: Dynamic lighting? Is this possible?

Post by GottaLove88s »

If you're feeling brave, here's the full zip for Dieppe, including the bad lighting code that I've removed for the live version... [link removed]

Pls let me know if you picked it up, and I'll delete it from here, so players definitely have the same version... :-)
Last edited by GottaLove88s on Tue May 21, 2013 11:57 am, edited 1 time in total.
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
Amaris
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 929
Joined: Fri Jul 23, 2010 11:08 am
Location: France
Contact:

Re: Dynamic lighting? Is this possible?

Post by Amaris »

I'm at work, so no BA allowed (Yes I know I need a new job with no BA restriction :P)

Try with "" :

SetLightingFile("AGJS44_NT_LIGHTING");

If not tell me, I'll check that tonight. :wink:
“Take care, my friend; watch your six, and do one more roll… just for me.”
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Re: Dynamic lighting? Is this possible?

Post by GottaLove88s »

Merci Amaris... the power of quotes. Sounds like something my old Prof used to say, lol! Your solution works perfectly...

Now that's GOOOOOOD... Dieppe now really starts at night... and Dawn rises after the 5th turn for both sides... Seriously, that's quite a wow effect... Merci Monsieur! :-)

PS. Je suis très désolé for your predicament. I empathise deeply! ;-)
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
Amaris
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 929
Joined: Fri Jul 23, 2010 11:08 am
Location: France
Contact:

Re: Dynamic lighting? Is this possible?

Post by Amaris »

GottaLove88s wrote: Merci Amaris... the power of quotes. Sounds like something my old Prof used to say, lol! Your solution works perfectly...
Alrights. :P
GottaLove88s wrote:PS. Je suis très désolé for your predicament. I empathise deeply! ;-)
Thanks. I'll fighting one more time with ldap(*)... So sexy. :wink: The hard life of a sysadmin. :roll:

(*): it would make a very good Action After Report with a lots of sweat, blood, and suspense. :oops:
“Take care, my friend; watch your six, and do one more roll… just for me.”
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Re: Dynamic lighting? Is this possible?

Post by GottaLove88s »

Haha... I shan't asked what LDAP is?!?! Is it legal?!?!
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Re: Dynamic lighting? Is this possible?

Post by GottaLove88s »

With Amaris' fabulous support, anyone who might like to explore how Dynamic Lighting works in a scenario... that starts at night, with reduced line of sight (LOS), and then becomes dawn after 5 turns, please take a look at any version of The Dieppe Raid from v1.02 onwards...

Link here -> viewtopic.php?f=87&t=42347#p399048
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
Post Reply

Return to “Battle Academy : Modders Corner ”