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!
Hey wondering how to set a building distance so players cant build within 500 range of each other, mostly, a Specific builder cant build near buildings owned be enemy.
This is probably the simplest way to do it. I attached a map with the trigger.
BuildingDistanceCheck
Events
Unit - A unit Begins construction
Conditions
Actions
-------- Change the distance variable to the distance you want --------
-------- The building construction is cancelled if there are enemy buildings nearby. --------
-------- The resources are still used, so you need to refund the gold/lumber cost of the building. --------
-------- Unfortunetly there is no way to retrieve these costs directly, so you need to save these values somewhere. --------
-------- I find the easiest way is to use point value which you can set in the object editor for each building to correspond to the gold cost. --------
-------- If you need lumber cost as well you are probably better off saving all of the information in arrays. --------
Set VariableSet Distance = 500.00
Set VariableSet Point = (Position of (Constructing structure))
Set VariableSet TriggeringPlayer = (Owner of (Constructing structure))
Set VariableSet TriggeringUnit = (Constructing structure)
Set VariableSet UnitGroup = (Units within Distance of Point matching ((((Matching unit) is A structure) Equal to True) and (((Matching unit) belongs to an enemy of TriggeringPlayer.) Equal to True)).)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup) Greater than 0
Then - Actions
Unit - Explode TriggeringUnit.
Player - Add (Point-value of TriggeringUnit) to TriggeringPlayer.Current gold
Game - Display to (All players) the text: (You cannot build within + ((String(Distance)) + range of enemy buildings.))
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.