• 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] replacement trigger HELP plz

Status
Not open for further replies.
Level 2
Joined
Mar 21, 2008
Messages
7
I am trying to make a trigger for a map that will replace one unit with another after a reserch is done. the units i was using were a footman and a knight. I just cant get my trigger right this is what i have so far.


event

conditions (Researched tech-type) Equal to Iron Forged Swords

actions

Unit Group - Pick every unit in (Units owned by Player 1 (Red) of type Footman) and do (Actions)
Loop - Actions

Unit - Replace (Triggering unit) with a Knight using The old unit's relative life and mana



I am pretty sure i need an event but i am not sure what to set it to. any advice would be help full.
 
Level 12
Joined
Aug 20, 2007
Messages
866
Also

You must change the "Triggering Unit" bit to "Picked Unit"

That is how you refer to the currently picked unit in the group (it loops through for every single unit and executes each action for each unit)
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
If you have a big number of researches, you would probably want to make it all in a loop, like this little example:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Upgrade[1] = Iron Forged Swords
      • Set Upgrade[2] = Black Gunpowder
      • Set Upgrade[3] = Storm Hammers
      • Set Unit[1] = Footman
      • Set Unit[2] = Rifleman
      • Set Unit[3] = Gryphon Rider
      • Set NewUnits[1] = Swordsman
      • Set NewUnits[2] = Elite Rifleman
      • Set NewUnits[3] = Elite Gryphon Rider
  • thtrrrury55675476
    • Events
      • Unit - A unit Finishes research
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Researched tech-type) Equal to Upgrade[(Integer A)]
            • Then - Actions
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Unit[(Integer A)]) and do (Actions)
                • Loop - Actions
                  • Unit - Replace (Picked unit) with a NewUnits[(Integer A)] using The old unit's relative life and mana
            • Else - Actions
 
Level 12
Joined
Aug 20, 2007
Messages
866
Thats a good way to do it

Yeah, if I was gonna do it in GUI, that'd probably be how I'd do it
 
Level 9
Joined
Oct 17, 2007
Messages
547
y cant use just use the Object editor for that i dont see y u need the GUI triggers, just change the "upgrade to-" in ur units and make a new upgrade base on the berserker.
 
Status
Not open for further replies.
Top