• 🏆 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!

[Spell] An aid to program this.

Status
Not open for further replies.
Level 4
Joined
Mar 15, 2011
Messages
39
Hi, I'm editing a similar age of empires map. My problem is that I want that when a player builds its town center, the other players can only build your respective city center to a given distance. I also wish that buildings such as houses can only be created in a radius around the city center. I thank them for their help, because I have no idea how to program this XD.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
On start construction event

Get city center of building player

If unit type id is your target

Use distance formula to get distance. If too far, cancel order

You can also compare distance to every other city center with a group enumeration. If too far, do whatever. If too close, etc. There is a native called IsUnitAlly as well if I'm not mistaken. You can also check player ids.

To cancel order, it's an IssueImmediateOrder I think. Check my sig for a list of orders. Don't know where I put it, dig around.

Pretty trivial to code this :)
 
Status
Not open for further replies.
Top