Mass Unit Upgrade

hopy

Active Member
Reaction score
64
Hey everyone, a pretty annoying little trigger here that I cant get to work, so I'm hoping you guys will be able to detect the problems in it and hopefully we can get it to work.

The thing I'm trying to create is a way that upgrades unit1 (Warrior) into unit2 (Berserker) afther unit1 uses the upgrade ability located in a spellbook on the Warrior.

This ability, called Upgrade to Berserker, has a casting time, no mana cost, and it's based on Channel with War Stomp (Tauren Chieftan's stomp ability) as Base ID. The hotkey for the Warstomp is B, and the spellbooks hotkey is T.

I've already made the whole unit1 changes into unit2 trigger, the gold, lumber and food costs and everything. The only thing I still need is changing the trigger in such a way that it allows multiple units to upgrade, and start upgrading at once.

I've made two triggers that I thought would work and do exactly what I wanted them to do, but the problem is they don't work at all.

Trigger:
  • Berserker Start
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Matching unit) is in Upgrade_Group[(Player number of (Owner of (Triggering unit)))]) Not equal to True
      • (Ability being cast) Equal to Upgrade to Berserker
    • Actions
      • Unit Group - Add (Triggering unit) to Upgrade_Group[(Player number of (Owner of (Triggering unit)))]
      • Set Unit_Group = (Units owned by (Owner of (Triggering unit)) matching ((((Matching unit) is selected by (Owner of (Triggering unit))) Equal to True) and (((Unit-type of (Matching unit)) Equal to Warrior) and (((Matching unit) is in Upgrade_Group[(Player number of
      • Selection - Clear selection for (Owner of (Triggering unit))
      • Unit Group - Pick every unit in Unit_Group and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to Upgrade_Group[(Player number of (Owner of (Triggering unit)))]
          • Selection - Select (Picked unit)
          • Game - Force (Owner of (Triggering unit)) to press the key T
          • Game - Force (Owner of (Triggering unit)) to press the key B
          • Selection - Remove (Picked unit) from selection
      • Selection - Select Unit_Group for (Owner of (Triggering unit))
      • Custom script: call DestroyGroup (udg_Unit_Group)

What's this trigger supposed to do?
When A unit starts the upgrade ability (triggering unit):
- Places the Triggering into the unit group: Upgrade_Group.
- Picks every other Warrior currently being selected by the player.
- Places the Picked Unit into the unit grouo: Upgrade_Group.
- Forces the Picked Unit/player to open the spellbook and cast the upgrade ability.
- Places every unit that was selected when the trigger started back into the players selection.

Why the Upgrade_Group? Why the Upgrade_Group in the trigger conditions? That's to prevent an endless loop... D:

Trigger:
  • Berserker
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Matching unit) is in Upgrade_Group[(Player number of (Owner of (Triggering unit)))]) Equal to True
      • (Ability being cast) Equal to Upgrade to Berserker
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) Current gold) Greater than or equal to 70
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Triggering unit)) Current lumber) Greater than or equal to 4
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of (Triggering unit)) Food used) Less than or equal to (((Owner of (Triggering unit)) Food cap) - 1)
                • Then - Actions
                  • Player - Set (Owner of (Triggering unit)) Current gold to (((Owner of (Triggering unit)) Current gold) - 70)
                  • Player - Set (Owner of (Triggering unit)) Current lumber to (((Owner of (Triggering unit)) Current lumber) - 4)
                  • Unit - Replace (Triggering unit) with a Berserker using The new unit's default life and mana
                  • Unit Group - Remove (Triggering unit) from Upgrade_Group[(Player number of (Owner of (Triggering unit)))]
                • Else - Actions
                  • Game - Display to (All players matching ((Matching player) Equal to (Owner of (Triggering unit)))) the text: |cffff0000You need ...
                  • Unit Group - Remove (Triggering unit) from Troll_Group[(Player number of (Owner of (Triggering unit)))]
            • Else - Actions
              • Game - Display to (All players matching ((Matching player) Equal to (Owner of (Triggering unit)))) the text: |cffff0000You need ...
              • Unit Group - Remove (Triggering unit) from Troll_Group[(Player number of (Owner of (Triggering unit)))]
        • Else - Actions
          • Game - Display to (All players matching ((Matching player) Equal to (Owner of (Triggering unit)))) the text: |cffff0000You need ...
          • Unit Group - Remove (Triggering unit) from Troll_Group[(Player number of (Owner of (Triggering unit)))]

What oh what is trigger supposed to do? :O
- It checks if the player has enough gold, lumber and food. If that's not the case the upgrading unit is removed from Upgrade_Group and the player gets a massage telling him/her that he sucks and needs more recourses. >:
- Decreases recourses of the player and replaces the Warrior with a Berserker.
- Origonal Warrior is than removed from the unit group.

Now what happens is... absolutely nothing... :(
I've added some debug massages into the first trigger (Berserker start) that was supposed to show all the names of units in Upgrade_Group at the end of the first trigger. This was tested using 3 Warrior units selected while one of them casted the upgrade ability, the result was that instead of 3x the massage "Warrior" I got 2x "Customo023" I believe it was, and all units got deselected and none of them upgraded.

Thanks for any help, and +rep for any usefull replies.

(Now a small question that I wanted to ask: Is it posible to increase the amount of letters you can place in Quest? Because if I place more than x symbols in one quest page they wont show).
 

Bankde

Member
Reaction score
20
Trigger:
  • Berserker Start
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Matching unit) is in Upgrade_Group[(Player number of (Owner of (Triggering unit)))]) Not equal to True

Trigger:
  • Berserker
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Matching unit) is in Upgrade_Group[(Player number of (Owner of (Triggering unit)))]) Equal to True

It doesn't work because you use wrong condition.

Matching unit only work in some situation like this: (Only function with have "matching" word)
Trigger:
  • Set UnitGroup = (Units owned by Player 1 (Red) matching ((Unit-type of (Matching unit)) Equal to Footman))


I haven't check any other triggering but "Matching unit" is your main problem as there is no matching unit to check.

Delete it or change to something else will run this trigger.
 

LurkerAspect

Now officially a Super Lurker
Reaction score
118
Just make a morphing ability based off Destroyer form :p using triggers seems a bit fancy and unnecessary compared to:

Make an ability off Destroyer Form, and set it so it would look like this:
Data - Alternate Form Unit: Beserker
...
Data - Morphing Flags: Uninterruptable, Permanent, Requires Payment
Data - Normal Form Unit: Warrior

Then set mana cost etc to 0, and there you go :3

You can also detect when this ability is being used quite simply, and add/remove units from the unit group as you please.
 

hopy

Active Member
Reaction score
64
It doesn't work because you use wrong condition.

Matching unit only work in some situation like this: (Only function with have "matching" word)
Trigger:
  • Set UnitGroup = (Units owned by Player 1 (Red) matching ((Unit-type of (Matching unit)) Equal to Footman))


I haven't check any other triggering but "Matching unit" is your main problem as there is no matching unit to check.

Delete it or change to something else will run this trigger.
Thank you very much for pointing that one out, it seems I didn't notice those small tiny mestakes again... the upgrade itself now works as normal, but the other units selected other than the main unit still don't start the ability.



Just make a morphing ability based off Destroyer form :p using triggers seems a bit fancy and unnecessary compared to:

Make an ability off Destroyer Form, and set it so it would look like this:
Data - Alternate Form Unit: Beserker
...
Data - Morphing Flags: Uninterruptable, Permanent, Requires Payment
Data - Normal Form Unit: Warrior

Then set mana cost etc to 0, and there you go :3

You can also detect when this ability is being used quite simply, and add/remove units from the unit group as you please.

Well the thing is... first of all it should only be usable if the player has enough gold, wood and food left for the upgrade...
Second, and most important is that the upgrade system itself works, the problem, and the reason for this threat, is that I want multiple units to be able to upgrade at once using an ability IN A SPELLBOOK. So I still would have to trigger the gold, lumber and food costs and I would still have to find a way for all units to use this ability at once if they're selected... which would result in nearly the exact two triggers I have here. :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top