Merkava120
Oberleutnant
I know I've been posting an awful lot of python questions, and I've been getting better at figuring them out myself, but this one has me stumped. I don't even know how to approach this with any kind of programming.
I'm experimenting with making a python button to allow units to shoot each other (so that I can modify it whatever way I want) - and I've got most of it figured out. Line of sight, though, is giving me grief.
I need to put some stuff in canpickplot in CvGameUtil to check if something is in between a shooter and the plot you're looking at, and if there is something blocking the shooter, to return false.
I was thinking I'd make a line formula using the target tile's coordinates and the shooter's coordinates and then loop through tiles touching that line - but I've no idea how to tell through programming whether or not a line crosses a tile.
For example, if a shooter's at (3,2) and aiming at a unit on (2,4), a line drawn between the two crosses over (3,3) and (2,3). How do I tell the game that?
I'm experimenting with making a python button to allow units to shoot each other (so that I can modify it whatever way I want) - and I've got most of it figured out. Line of sight, though, is giving me grief.
I need to put some stuff in canpickplot in CvGameUtil to check if something is in between a shooter and the plot you're looking at, and if there is something blocking the shooter, to return false.
I was thinking I'd make a line formula using the target tile's coordinates and the shooter's coordinates and then loop through tiles touching that line - but I've no idea how to tell through programming whether or not a line crosses a tile.
For example, if a shooter's at (3,2) and aiming at a unit on (2,4), a line drawn between the two crosses over (3,3) and (2,3). How do I tell the game that?