[Trigger] replacement trigger HELP plz

Status
Not open for further replies.

Sgtwisky

S

Sgtwisky

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.
 
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)
 
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
 
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
 
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.
Back
Top