Terrain

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
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

Terrain

Post by enric »

When moving the pointer over tiles the tooltip offers different info, the first one is about terrain type: "open ground", "buidding", "forest", etc.

The Helpers file does not show how it get/shows that concept.
I see that in FUNCTION HELPER_TILE_TOOLTIP(terrain, tilex, tiley, side) the terrain parameter is an integer with the order of the type defined in the file TERRAIN.TXT, but I can't trust on a value that can be different in each scenario if this file has more types.

Is there a function to get this concept terrain type of a tile? I want to know on which terrain type a unit is. Probably is an obvious function that I missed.

Something to be able to: If me.terrain_Type = "building" then closeDoor :)

IsTileWater works for water,
isTile ("type") would be perfect
pipfromslitherine
Site Admin
Site Admin
Posts: 9923
Joined: Wed Mar 23, 2005 10:35 pm

Re: Terrain

Post by pipfromslitherine »

Hmmm. Perhaps a workaround would be to set up default values that you use, rather than fixed values? Terrain can only change per campaign, not per scenario, so it shouldn't be too problematic?

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: Terrain

Post by enric »

As you said Terrain.txt can be attached to a Campaign so I may control de order of the terrain type in TERRAIN.TXT, but unfortunately, I see that the "terrain" parameter that HELPER_TILE_TOOLTIP has, is not received by others Unit Ability Functions.

When I developed the remove tank trap mod for BA1, to detect if the tile has a tank trap I open a loop of the objects present in the tile looking for one of the tank traps objects, I may do the same here to look for another terrain type, but this is not a very clean way.

The tooltip shows for each tile the terrain type of the tile. How did it?

a workaround would be to set up default values that you use, rather than fixed values?
???
pipfromslitherine
Site Admin
Site Admin
Posts: 9923
Joined: Wed Mar 23, 2005 10:35 pm

Re: Terrain

Post by pipfromslitherine »

The call to the tooltip helper has special code around it to pass in the params.

What I mean is that you could set up some globals in a startup function, and then use the global values rather than hard-coded terrain values when looking for. So rather than == "building" you would have == GetGlobal("building")

There isn't a function to get the current tile terrain as you say. I guess you could use one of the cover values to hold a flag?

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: Terrain

Post by enric »

Thanks, I'll investigate some workarounds.
Post Reply

Return to “Battle Academy 2: Modders Corner”