🏆 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!
How can I make it so buildings have to be built within 200 of each other, and if the player tries to build a building more than 200 from another allied building, an error message appears?
Set TempLocA = (Position of (Constructing structure))
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units within 200.00 of TempLocA matching ((((Matching unit) is A structure) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an ally of (Owner of (Constructing structure))) Equal to True)))) and do (Actions)
Loop - Actions
Set TempIntA = (TempIntA + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TempIntA Equal to 0
Then - Actions
Unit - Kill (Constructing structure)
Else - Actions
Way 1 is the most effective way, it will never fail, but you will not get your gold back if you fail to build close to an allied building.
Way 2
Events
Unit - A unit Begins construction
Conditions
Actions
Set TempLocA = (Position of (Constructing structure))
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units within 200.00 of TempLocA matching ((((Matching unit) is A structure) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an ally of (Owner of (Constructing structure))) Equal to True)))) and do (Actions)
Loop - Actions
Set TempIntA = (TempIntA + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TempIntA Equal to 0
Then - Actions
Selection - Select (Constructing structure) for (Owner of (Constructing structure))
Game - Force (Owner of (Constructing structure)) to press Escape/Cancel
Else - Actions
Way 2 is slightly less efficient, but it will give you your money back.
You don't have to select and force the player to press cancel, you can just issue the building the cancel order.
I would also like to note that the player won't get back 100% of the resources unless you set the gameplay constants so.
There's actually a third way, I think I would go with: Aura.
Give all buildings an aura with 200 range, make this aura affect units as well, so players would have a visible indicator where can they build (the aura buff / model on the builder).
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.