• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[General] How to reffer the builder in triggers?

Status
Not open for further replies.
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:
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.
Back
Top