• 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Forcing building to be built adjacent to another building

Status
Not open for further replies.
Level 3
Joined
Dec 24, 2007
Messages
29
I'm having trouble writing a trigger that forces the player to build certain structures adjacent to another specific structure (similar to addon buildings in starcraft). But I'm not finding any trigger condition that checks for adjacency. The event/action portion is no problem, I just need help getting the trigger to recognize when to cancel construction.

Any help is appreciated.
 
Level 4
Joined
Jul 25, 2007
Messages
68
I don't think theres a way to limit the range of construction, but if you move the constructed structer instantly to the position of the building you want it to be adjacent to, it will automaticly put it in the nearest position to that unit that has enough room for it. do this:

  • Events
    • Unit - A unit Finishes construction
  • Conditions
  • Actions
    • Unit - Move (Constructed structure) instantly to (Position of (Triggering unit))
where triggering unit is just put the building that you want it to be adjacent to. Easiest way to do this is after that building is placed or at the start of the map apply the building to a variable. Then use the variable instead of the specific unit.

hope this helps.

EDIT: read your post wrong, sorry. this condition should do it:

  • ((Region centered at (Position of (Triggering unit)) with size (250.00, 250.00)) contains (Constructing structure)) Equal to True
 
Level 3
Joined
Dec 24, 2007
Messages
29
Sorry I'm not entirely clear how that would work. I want certain structures to only be built next to a road specifically.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Well, an alternative could be something like:

  • Trigger
  • Events
    • Unit - a unit is issued an order targetting a point
  • Conditions
    • Order comparison: issued order equal to "farm" // This is the order given when a peasant starts constructing a farm. For other buildings, use other strings
  • Actions
    • if Unit Group(units within 256 of "position of order" of type "road") is empty then: order triggering unit to 'stop'
 
Status
Not open for further replies.
Top