• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

[GUI] City-building Condition Trigger

Status
Not open for further replies.
Level 5
Joined
Apr 8, 2007
Messages
116
(SOLVED)


Hey all,

so my trigger is supposed to cause players to be unable to build a city within 700 distance units from any pre-existing cities.

So far, I have it as:

Event:
Unit begins construction

Action:
If [All conditions are true] Then do [then actions] else do [else actions]
If Conditions:
-unit-type of constructing city = city
-number of units in [units within 700.00 of [position of constructing unit] matching [unit type of matching unit Equal to City] Greater than or Equal to 1

Then:
Unit - remove constructing unit
Player - add 400 gold to owner of constructing unit
Game - display text to owner of constructing unit [Error cities must be built within blah blah]
Else: Do nothing


However, the problem is that the "error" trigger pops up no matter where the city is targeted, even if the nearest one is all the way across the 256 x 256 map.


I have another building-conditions for houses, which is the fact that they must be built within 600 range of cities, similarly formatted - but it functions perfectly fine...

Anyways, thanks in Advance
 
Last edited:
  • Tg
  • Events
    • Unit - A unit begins a construction
  • Conditions
    • ((Unit-type) of (Constructing structure)) Equal to X
  • Actions
    • Set Point1 = (Position of (Constructing Structure))
    • Set Temp_Group = (Units within 700.00 of (Point1) matching ((Matching unit) is a structure) Equal to True)
    • If/ Then/ Else
      • If (Conditions)
        • (Number of units in (Temp_Group)) Greater than or Equal to 1
      • Then (Actions)
        • Unit - Remove (Constructing structure)
        • Player - Add 400 gold to (Owner of (Constructing unit))
        • Game - Display ...
    • Custom script: call RemoveLocation (udg_Point1)
    • Custom script: call DestroyGroup (udg_Temp_Group)
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
Trigger above isn't working because trigger fires when structure begins construction. Trigger adds constructing structure to your Unit Group. Now, Unit Group is Greater Than or Equal to 1 and actions automatically destroy building and add resources.

Try this trigger:
  • Trigger
    • Events
      • Unit - A unit Begins construction
    • Conditions
      • (Unit-type of (Constructing structure)) Equal to <Your Building>
    • Actions
      • Set TempPoint = (Position of (Constructing structure))
      • Set TempGroup = (Units within <Range> of TempPoint matching ((Unit-type of (Matching unit)) Equal to <Your Building>))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Greater than 1
        • Then - Actions
          • Unit - Kill (Constructing structure)
          • Player - Add <Gold Cost> to (Owner of (Constructing structure)) Current gold
          • Player - Add <LumberCost> to (Owner of (Constructing structure)) Current lumber
          • Game - Display to (All players) the text: <Text>
        • Else - Actions
        • Custom script: call DestroyGroup(udg_TempGroup)
        • Custom script: call RemoveLocation(udg_TempPoint)
 
Last edited:
Status
Not open for further replies.
Top