• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

[Trigger] Place base at nearest land region

Status
Not open for further replies.
Level 2
Joined
Jun 18, 2009
Messages
15
Im making my map, Rising of Empires, and I need to implement a trigger. You see, after three minutes have passed, the spirit that constructs your main building automatically drops the main building at that time if it hasn't already. the only problem is that my map has water. I need a trigger so that if the spirit is over a body of water or unbuildable area then the building is placed at the nearest buildable location.
 
Level 6
Joined
May 7, 2009
Messages
228
I think if you create a unit in an inappropriate place, it is automatically moved to the nearest available spot.

So just create the unit normally. No need to check for water.
 
That is a lot harder than you may think. The only way I can think of doing it is by "sending out probes". AKA make a loop which checks points increasing distances away and the first point it checks which is land, is where the building will be constructed. I don't think it's possible to do in GUI, and if it is, it's very hard. I couldn't do it. Paladon might be able to. I could do it in JASS for you if you want.
 
Level 4
Joined
Mar 14, 2009
Messages
98
Make a dummy unit with ground pathing. Create it where the spirit is. Save the location of the dummy unit(because it will spawn on land somewhere it can fit). Remove the dummy unit. Build your main building on the location.

Well, the problem comes when your main building is bigger than the dummy unit. But I found your nearest land region! :D

Edit: Or not... it could spawn on shallow water. Does that count?

Barring this solution, your only other option is to search around a location with an increasing radius.
 
Status
Not open for further replies.
Top