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

[Trigger] Need system in Castle Fight

Status
Not open for further replies.
Level 37
Joined
Mar 6, 2006
Messages
9,243
Periodic training:
  • Untitled Trigger 055
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Barracks)) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to train/upgrade to a Footman
Automatic attack order:
  • Untitled Trigger 056
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player number of (Owner of (Triggering unit))) Equal to 1
        • Then - Actions
          • Set p1 = (Center of Region 000 <gen>)
          • Unit - Order (Triggering unit) to Attack-Move To p1
          • Custom script: call RemoveLocation(udg_p1)
        • Else - Actions
Or you can pre-set the point an use it over and over again. You might not need to set/remove it in this trigger every time.
 
Level 3
Joined
Apr 17, 2008
Messages
41
If each building only trains one type of unit (like in castle fight) then I have exactly what you're looking for. Unfortunately I don't have it with me right now, so you'll need to wait until later. I'll post back here later.
 
Level 3
Joined
Dec 9, 2009
Messages
35
You can do it with 3 triggers :
  • Buildings
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Set NumberOfBuilding = (NumberOfBuilding + 1)
      • Set BuildingType[NumberOfBuilding] = Barracks
      • Set UnitType[NumberOfBuilding] = Footman
      • -------- - --------
      • Set NumberOfBuilding = (NumberOfBuilding + 1)
      • Set BuildingType[NumberOfBuilding] = Blacksmith
      • Set UnitType[NumberOfBuilding] = Rifleman
      • -------- - --------
  • Train First
    • Events
      • Unit - A unit Finishes construction
    • Conditions
    • Actions
      • For each (Integer loop) from 1 to NumberOfBuilding, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Constructed structure)) Equal to BuildingType[loop]
            • Then - Actions
              • Unit - Order (Constructed structure) to train/upgrade to a UnitType[loop]
              • Unit - Order (Constructed structure) to train/upgrade to a UnitType[loop]
            • Else - Actions
  • Loop Training
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • Unit - Order (Triggering unit) to train/upgrade to a (Unit-type of (Trained unit))
      • Set p = (Position of Castle 0000 <gen>)
      • Unit - Order (Trained unit) to Attack-Move To p
      • Custom script: call RemoveLocation(udg_p)
 
Status
Not open for further replies.
Top