• 🏆 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!

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,240
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