Extra vision for units in Watchtowers?

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

Extra vision for units in Watchtowers?

Post by GottaLove88s »

Guys,

Is there any code out there that extends LOS, say by +2 squares, for a unit that has climbed into something tall... say a Watchtower, or a tall building?

Thanks!
GL88
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
jcb989
Colonel - Fallschirmjäger
Colonel - Fallschirmjäger
Posts: 1423
Joined: Fri Nov 05, 2010 12:02 am
Location: Bradenton, Florida

Re: Extra vision for units in Watchtowers?

Post by jcb989 »

clever idea.
pipfromslitherine
Site Admin
Site Admin
Posts: 9883
Joined: Wed Mar 23, 2005 10:35 pm

Re: Extra vision for units in Watchtowers?

Post by pipfromslitherine »

You would need to change (and keep updated) their LOS in the post start turn function I think (as well as changing it obviously when they climb in to, out of the tower).

Cheers

Pip
follow me on Twitter here
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: Extra vision for units in Watchtowers?

Post by enric »

Probably all can be modded, but a step ahead in the core of BA would be that "objects" give several abilities to the unit in.

- A Watchtowers gives extra LOS
- A Bunker, sand bags, already gives protection but, units inside can only fire in one direction or 180 degrees in front.
- maybe units in hills have more LOS also
- etc.
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Re: Extra vision for units in Watchtowers?

Post by GottaLove88s »

Thanks Jcb, Pip & Enric,

So it's sounds like it's possible. If I understand correctly:

1. The best place to put this code is in the Post Start Turn function
2. I'd have to run through each of the units on the board and make a quick check of 'is this unit in a watchtower?' (for example)
3. If it is in a watchtower add +2 to the LOS from squads.csv (presumably there's an active LOS variable that is read directly from squads.csv?)
4. Redraw the screen with that new LOS

Questions:

5. Is there a variable that tells me what objects are in the same square as a specific unit?
6. Is there a variable that tells me the height (based on hill heights) of a specific unit? (Great idea Enric! At the moment, variable height hills look pretty, eg. Seelow Heights, but they don't change much vision for either side. It would be cool to advantage/handicap LOS based on unit height)

Thanks guys!
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
Richcat
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 219
Joined: Sun Nov 07, 2010 10:09 pm

Re: Extra vision for units in Watchtowers?

Post by Richcat »

How about if infantry unit that enters Tower building triggers the normal scout command, or even elite scout command?
Cheers
Richcat
jcb989
Colonel - Fallschirmjäger
Colonel - Fallschirmjäger
Posts: 1423
Joined: Fri Nov 05, 2010 12:02 am
Location: Bradenton, Florida

Re: Extra vision for units in Watchtowers?

Post by jcb989 »

enric wrote: - A Bunker, sand bags, already gives protection but, units inside can only fire in one direction or 180 degrees in front.
Does not this mean there is a script somewhere that is modifying unit stats based on what hex content they are in...?
It seems that would be the place to add the "tell me if I'm in a watch tower" code...

I probably misunderstand Pip's suggestion.
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: Extra vision for units in Watchtowers?

Post by enric »

Probably the start point is the mine objects, they explode when a unit enter the tile, so a similar function may give some additional attribute the unit is in.

In Road to Wiltz (BA1), in OBJECTS.BSF there is a function that may help: FUNCTION enterMine(objectid, tilex, tiley, objectx, objecty, check, user, unit)

In BA2 I did not yet looked in the core, maybe there is something better.
pipfromslitherine
Site Admin
Site Admin
Posts: 9883
Joined: Wed Mar 23, 2005 10:35 pm

Re: Extra vision for units in Watchtowers?

Post by pipfromslitherine »

The protection from a given terrain type (such as sand bags) just comes from the cover value for the terrain. The watchtower code would best be probably need to be something that looked at every unit each tick and checked if the tile they were on had a watchtower in it.

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: Extra vision for units in Watchtowers?

Post by GottaLove88s »

pipfromslitherine wrote:The protection from a given terrain type (such as sand bags) just comes from the cover value for the terrain. The watchtower code would best be probably need to be something that looked at every unit each tick and checked if the tile they were on had a watchtower in it.

Cheers

Pip
Thanks Pip, that makes sense to me.

But what's the correct variable to check whether the unit is in a tile that also has a watchtower object?
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: 9883
Joined: Wed Mar 23, 2005 10:35 pm

Re: Extra vision for units in Watchtowers?

Post by pipfromslitherine »

Check out GetObjectFromName and GetTileObject in the autodocs. They should do the job.

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: Extra vision for units in Watchtowers?

Post by GottaLove88s »

Thanks Pip!
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”