• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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