Simple trigger help

Beaves36

New Member
Reaction score
0
Ok i need help with what a trigger would look like in order to change a unit once an upgrade it bought. For example if you have a footmen and someone researches the rifle man upgrade turn all footmen units owned by that player into rifle men.
 

aussj4link

New Member
Reaction score
3
Well what I ended up having to do was make a trigger and variable for every player, there might be an easier way but I couldn't figure it out. These triggers are for making unit abilities level correctly in my map, but for you all you would need to do is "Unit - Replace" the picked units into rifle men. The first trigger is what happens when you do the research:

Trigger:
  • Priest Abilities Red
    • Events
      • Unit - A unit owned by Player 1 (Red) Finishes research
    • Conditions
      • (Researched tech-type) Equal to Priest Adept Training (Level 1)
      • ((Current research level of Priest Adept Training (Level 1) for (Owner of (Triggering unit))) Equal to 0) or (((Current research level of Priest Adept Training (Level 1) for (Owner of (Triggering unit))) Equal to 2) or (((Current research level of Priest Adept Training (Level 1) for (Owner of (Triggering unit))) Equal to 4) or (((Current research level of Priest Ade
    • Actions
      • Set Priests_Heal_Red = (Priests_Heal_Red + 1)
      • Set PriestsInnerFire_Int_Red = (PriestsInnerFire_Int_Red + 1)
      • Set PriestShad_Int_Red = (PriestShad_Int_Red + 1)
      • Set ShadowLD_Int_Red = (ShadowLD_Int_Red + 1)
      • Set ShadowMB_Int_Red = (ShadowMB_Int_Red + 1)
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to (Owner of (Triggering unit))
              • (Unit-type of (Picked unit)) Equal to Priest
            • Then - Actions
              • Unit - Set level of Heal for (Picked unit) to Priests_Heal_Red
              • Unit - Set level of Inner Fire for (Picked unit) to PriestsInnerFire_Int_Red
              • Unit - Set level of Shadow Form (Priest) for (Picked unit) to PriestShad_Int_Red
              • Unit - Set level of Dual Drain (Shadow Priest) for (Picked unit) to ShadowLD_Int_Red
              • Unit - Set level of Mind Blast (Shadow Priest) for (Picked unit) to ShadowMB_Int_Red
            • Else - Actions
              • Do nothing


This will make it so that units already on the map will adjust to whatever you want.

Trigger:
  • Set PriestTrained Abilities Red
    • Events
      • Unit - A unit owned by Player 1 (Red) Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Priest
    • Actions
      • Unit - Set level of Heal for (Trained unit) to Priests_Heal_Red
      • Unit - Set level of Inner Fire for (Trained unit) to PriestsInnerFire_Int_Red
      • Unit - Set level of Shadow Form (Priest) for (Trained unit) to PriestShad_Int_Red


This will make it so that any new units are adjusted the moment they are trained. If you need any further help let me know. There might be an easier way and a more efficient way but for now this is the only way I know how. Hope it helps! :D
 

Beaves36

New Member
Reaction score
0
it does help but it seems kinda complicated to do something so easy. Ive made spells that are more complex then this and there tiny triggers hahaha
 

aussj4link

New Member
Reaction score
3
Oky doky, this might be a little easier, just made new triggers real quick as compact as I could think of.

Trigger:
  • Footmen to Riflemen
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Black Gunpowder
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Footman
              • (Owner of (Picked unit)) Equal to (Triggering player)
            • Then - Actions
              • Unit - Replace (Picked unit) with a Rifleman using The old unit's relative life and mana
            • Else - Actions


That will change units on the map and:

Trigger:
  • Trained Footmen to Riflemen
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Footman
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Trained unit)) Equal to (Triggering player)
        • Then - Actions
          • Unit - Replace (Trained unit) with a Rifleman using The new unit's default life and mana
        • Else - Actions


Will change them when they are trained (if you have them being trained in your map that is). :)

Edit: lol I know "Do Nothing" is not needed but it doesn't hurt anything either lol.
 

tooltiperror

Super Moderator
Reaction score
231
Other than the fact it calls DoNothing, which is a pointless call.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top