• 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.

Triggering Production of Units

Status
Not open for further replies.
Level 5
Joined
Jul 13, 2010
Messages
84
I am making AI for my custom map and I have a variable for the Barracks so that when it is done it will begin making units heres what I have for it, although It won't have the barracks train units
Heres triggering to set barracks as the variable:
Barracks Variable
Events
Unit - A unit Begins construction
Conditions
(Triggering unit) Equal to BuilderVariable
Actions
Set BarracksVariable = (Constructing structure)
Trigger - Turn off (This trigger)
Please tell me how to correct this! +rep for help=)
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
This has quite good accuracy in picking the constructed structure:

  • Untitled Trigger 032
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Set point = (Position of (Triggering unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Set u = (Random unit from (Units within 0.00 of point matching (((Matching unit) is A structure) Equal to (==) True)))
      • Custom script: call RemoveLocation(udg_point)
      • Game - Display to Player Group - Player 1 (Red) the text: (String((Unit-type of u)))
 
Level 7
Joined
Apr 1, 2010
Messages
289
spinnaker, maker, triggering unit refers to the structure you cannot get what unit is constructing the structure, test this
  • Triggers
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Unit - Kill (Triggering unit)
it kills the structure every time. The difficulty for any thing like this is finding the constructing unit not in finding the structure, as there is no function for constructing unit.

@XxJizzxX you can just use triggering unit to refer to your structure.
 
Status
Not open for further replies.
Top