Question on smoke?

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

Question on smoke?

Post by GottaLove88s »

How long does smoke float around for?

Does it stay for the same number of turns whether it came from a mortar bombardment, an engineer, or the smoke artillery barrage?

Does smoke always disappear at the beginning of the turn of the player that fired it? (it would be deeply unpleasant if smoke evaporated just before an enemy took his turn lol)

Where can I control (increase/decrease) the number of turns that smoke stays for...?

Thanks! :D
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
pipfromslitherine
Site Admin
Site Admin
Posts: 9863
Joined: Wed Mar 23, 2005 10:35 pm

Re: Question on smoke?

Post by pipfromslitherine »

The smoke logic is controlled by OBJECTS.BSF script in DATA/OBJECTS/SYSTEM

Cheers

Pip
follow me on Twitter here
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Re: Question on smoke?

Post by GottaLove88s »

Thanks again Pip.

Got it. So if I understand the code correctly, BA2 uses age as a counter (which it stores in ObjectData for each smoke cloud). It then checks a binary AND so that every other turn it will run the test to randomly remove smoke.

So there's a 25% chance of the smoke disappearing after 2 turns, 50% after 4, 75% after 6, and after 8 turns it's definitely gone...

I assume it runs this test independently for each 'unit' of smoke, so that an artillery barrage of smoke will gradually dissipate at different times, not all en masse?... Elegant guys! Nice

Code: Select all

FUNCTION Smoke_StartTurn(objectid, user)
{
	int age ;
	int odd ;
	
	age = GetObjectData(objectid, 0) ;
	age += 1 ;
	SetObjectData(objectid, 0, age) ;
	
	odd = age & 1;
	
	if (odd == 0)
	{
		// every pair of turns, chance of smoke removal increases by 25%
		age /= 2 ;
		age *= 25 ;
		
		if (Rand(0, 99) < age)
		{
			AddVizFunctionCall("DeleteObject", objectid) ;
		}
	}
}
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 2: Modders Corner”