The long story:
Before I begin, this is NOT an ABS question, this is a general mapping question to which I'm not sure where to begin with coding. Now then, lately I've been working on a game in my spare time using Blizzard's ABS system, but there's always been something I've been miffed about ever since I started Midnight:
attacks can cut straight through walls.
There are a few ways that this is preventable, such as shooting actual events that cannot pass or the projectile setup in Blizzard's script. But these ways are annoying for being slow and clunky, and makes games that use handguns with speeding bullets rather than slower bows and arrows extremely difficult to do decently. The method I've always used for ranged weapons with Blizzard's ABS script is a straight-forward melee weapon that attacks anything seven tiles in front of him. I've tried going to Blizzard's website for help, but unfortunately the only solution they knew of was to use the projectile weapons I dislike. Melee weapons were not meant to have so long of a range.
However, it is very possible to script in the solution myself. I already know the basics for what I want to do: whenever I press to attack, I will need to figure out where my character is on a map and which direction he is facing. Then, we check each tile from his position to the edge of his range (seven tiles) to see if any of them have a specific terrain tag as marked in the tileset. If there IS a tile, we then calculate the distance to that tile, and shorten the range of our melee weapon to that number. We then execute the attack, and then return the range back to being seven tiles.
The problem is that I don't have any idea for how to do even half of this yet.
The short summation:
I will need to determine the character's position on the map, determine the direction he is facing, determine if there is a tile with a specific terrain tag within seven tiles from the character's position in his given direction, and then if one exists, determine the distance between the character and the first terrain tagged tile away from him.
Anyone know anything that might help?