If I get an event say for example that a vehicle factory entered my line of site (or the line of site of a specific unit.....btw, there is no way to determine what unit actually 'spotted' another, is there?), I can get it's position and I can get it's x and z size from the unitdef.... but where is the position with relation to the x and z 'widths'? Is the position the upper left corner...and it extends X units right and z units down? Or is it (god forbid) centered on the position?
As I understand it the position is the center of a unit and the x-size and z-size are the width and height of the building in map coodinates (1/8 of the position coordinates) and that is only given that the facing is 0.
If the facing is different (ranges from 0-3), the x-size and z-size changes its meaning from width to height and from height to width. I think 0 and 2 it is normal and 1 and 3 it has the other meaning.
btw, there is no way to determine what unit actually 'spotted' another, is there?)
possibly not directly but the lua api provides a GetClosestEnemy(unit) function which you could simply pass the factory id to. Of course there's no guarentee that the closest unit is actually the one that spotted it (due to los distance differences) but you'd probably find that's good enough for most practical purposes.
Users browsing this forum: No registered users and 0 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum