• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Detecting Adjacent Buildings

Status
Not open for further replies.
Level 24
Joined
Oct 12, 2008
Messages
1,783
How do I go about detecting if a building is adjacent to another?

1. I understand that a 4x4 pathing (ie. farm type) is a 128x128 square in editor.
2. Simply drawing a region around the structure doesnt work when buildings are of larger pathing or when 2 buildings have a different pathing shape.
 
Level 24
Joined
Oct 12, 2008
Messages
1,783
Maybe you can calculate an approximation from Doc - BlzGetUnitCollisionSize
If you want to account for pathing shape, I think you'd need to "map out" the building outline with unit/item setpos and then see where the item/unit were actually moved by the game. Sure the next question is, do you need that accuracy?

Thanks for the reply
1. Unfortunately, pathing size (for buildings) doesnt not equal with collision size. Collision size does increase with pathing size but the number is not the same.
2. I dont quite understand what you mean by "do you need the accuracy?"
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
It might be possible to read this data at runtime in some way using unit field natives? I didn't check. It could also be possible to export the unit/object data for a map, read it with an external program, and extract building pathing shape information from that; then import that data in a sensible way into the map and build a hashtable to be read at runtime.
 
Status
Not open for further replies.
Top