• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

[General] How to reffer the builder in triggers?

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 71
Joined
Aug 10, 2018
Messages
7,537
Unfortunately there's no Event response to get the builder, however, there are some workarounds.

This trigger should work for Orc and Night Elf buildings since the worker goes inside of the structure in order to construct it.

The idea is to pick every worker within 1 range of the constructing structure. This works because the peon or wisp are actually hidden and positioned at the very center of the structure.
  • Get Peon/Wisp Builder
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Set VariableSet tempPoint = (Position of (Constructing structure))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 1.00 of tempPoint.) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Peon
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set VariableSet tempUnit = (Picked unit)
            • Else - Actions
      • Game - Display to (All players) for 30.00 seconds the text: (Name of tempUnit)
      • Custom script: call RemoveLocation (udg_tempPoint)
This method doesn't really work properly for Human/Undead buildings since they don't function the same way.
 
Last edited:
Level 24
Joined
Jun 26, 2020
Messages
1,921
Unfortunately there's no Event response to get the builder, however, there are some workarounds.

This trigger should work for Orc and Night Elf buildings since the worker goes inside of the structure in order to construct it.

The idea is to pick every worker within 1 range of the constructing structure. This works because the peon or wisp are actually hidden and positioned at the very center of the structure.
  • Get Peon/Wisp Builder
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Set VariableSet tempPoint = (Position of (Constructing structure))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 1.00 of tempPoint.) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Peon
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set VariableSet tempUnit = (Picked unit)
            • Else - Actions
      • Game - Display to (All players) for 30.00 seconds the text: (Name of tempUnit)
      • Custom script: call RemoveLocation (udg_tempPoint)
This method doesn't really work properly for Human/Undead buildings since they don't function the same way.

It's a shame, anyway I already did something similar, but still thanks.
 
Status
Not open for further replies.
Top