Page 1 of 1

Terrain

Posted: Tue Apr 28, 2015 6:40 am
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

Re: Terrain

Posted: Tue Apr 28, 2015 4:09 pm
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

Re: Terrain

Posted: Tue Apr 28, 2015 6:04 pm
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?
???

Re: Terrain

Posted: Tue Apr 28, 2015 7:48 pm
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

Re: Terrain

Posted: Tue Apr 28, 2015 8:08 pm
by enric
Thanks, I'll investigate some workarounds.