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

[General] How to reffer the builder in triggers?

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,511
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,850
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