• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Trigger] Enable/Disable Abilities

Status
Not open for further replies.
Level 10
Joined
Jun 20, 2017
Messages
336
The problem is that if I using the change gender ability the blink will disappear or it returns to the first normal blink!
And how to detect When the three different levels of the town hall were destroyed?! (because And - All (Conditions) are true does not work!) For example if all three town hall are destroyed, then the blink should change.
1.jpg

2.jpg

  • Blink cost more mana after 30 minutes
    • Events
      • Time - Elapsed game time is 15.00 seconds
    • Conditions
    • Actions
      • Trigger - Turn on Blink will change if town hall is destroyed <gen>
      • Trigger - Turn on Blink will change if town hall is constructed <gen>
  • Blink will change if town hall is destroyed
    • Events
      • Unit - A unit Dies
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Dying unit)) Equal to Town Hall (2)
          • (Unit-type of (Dying unit)) Equal to Town Hall (3)
          • (Unit-type of (Dying unit)) Equal to Town Hall (4)
    • Actions
      • Set UnitGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Builder (Male)
                  • (Unit-type of (Picked unit)) Equal to Builder (Female)
            • Then - Actions
              • Unit - Remove Blink [Human]Q from (Picked unit)
              • Unit - Remove Blink [Human]W from (Picked unit)
              • Unit - Add Blink [Human]Q disabled to (Picked unit)
              • Unit - Add Blink [Human]W disabled to (Picked unit)
              • Player - Enable Blink [Human]Q disabled for (Owner of (Picked unit))
              • Player - Enable Blink [Human]W disabled for (Owner of (Picked unit))
            • Else - Actions
      • Set PlayerGroup = (Player group((Triggering player)))
      • Game - Display to PlayerGroup the text: (Strings_PlayerColors[(Player number of (Owner of (Dying unit)))] + ((Name of (Owner of (Dying unit))) + (|r + your Town Hall was destroyed and Blink now cost |cffffcc0010|r mana.)))
      • Custom script: call DestroyForce(udg_PlayerGroup)
      • Custom script: call DestroyGroup(udg_UnitGroup)
      • Trigger - Turn on Blink will change if town hall is destroyed2 <gen>
  • Blink will change if town hall is destroyed2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Change Gender
    • Actions
      • Set UnitGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Builder (Male)
                  • (Unit-type of (Picked unit)) Equal to Builder (Female)
            • Then - Actions
              • Unit - Remove Blink [Human]Q from (Picked unit)
              • Unit - Remove Blink [Human]W from (Picked unit)
              • Unit - Add Blink [Human]Q disabled to (Picked unit)
              • Unit - Add Blink [Human]W disabled to (Picked unit)
              • Player - Enable Blink [Human]Q disabled for (Owner of (Picked unit))
              • Player - Enable Blink [Human]W disabled for (Owner of (Picked unit))
            • Else - Actions
  • Blink will change if town hall is constructed
    • Events
      • Unit - A unit Finishes construction
      • Unit - A unit Finishes an upgrade
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Town Hall (2)
          • (Unit-type of (Triggering unit)) Equal to Town Hall (3)
          • (Unit-type of (Triggering unit)) Equal to Town Hall (4)
    • Actions
      • Set UnitGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Builder (Male)
                  • (Unit-type of (Picked unit)) Equal to Builder (Female)
            • Then - Actions
              • Unit - Remove Blink [Human]Q disabled from (Picked unit)
              • Unit - Remove Blink [Human]W disabled from (Picked unit)
              • Unit - Add Blink [Human]Q to (Picked unit)
              • Unit - Add Blink [Human]W to (Picked unit)
              • Player - Enable Blink [Human]Q for (Owner of (Picked unit))
              • Player - Enable Blink [Human]W for (Owner of (Picked unit))
            • Else - Actions
      • Set PlayerGroup = (Player group((Triggering player)))
      • Game - Display to PlayerGroup the text: (Strings_PlayerColors[(Player number of (Owner of (Triggering unit)))] + ((Name of (Owner of (Triggering unit))) + (|r + your Town Hall was built and Blink now cost |cffffcc001|r mana.)))
      • Custom script: call DestroyForce(udg_PlayerGroup)
      • Custom script: call DestroyGroup(udg_UnitGroup)
      • Trigger - Turn on Blink will change if town hall is constructed2 <gen>
  • Blink will change if town hall is constructed2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Change Gender
    • Actions
      • Set UnitGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Builder (Male)
                  • (Unit-type of (Picked unit)) Equal to Builder (Female)
            • Then - Actions
              • Unit - Remove Blink [Human]Q disabled from (Picked unit)
              • Unit - Remove Blink [Human]W disabled from (Picked unit)
              • Unit - Add Blink [Human]Q to (Picked unit)
              • Unit - Add Blink [Human]W to (Picked unit)
              • Player - Enable Blink [Human]Q for (Owner of (Picked unit))
              • Player - Enable Blink [Human]W for (Owner of (Picked unit))
            • Else - Actions
 
Level 39
Joined
Feb 27, 2007
Messages
5,031
If I understand you properly, you need to use UnitMakeAbilityPermanent() on the different versions of blink you have. When you remove and re-add the abilities call that function on the unit for each (new) ability.

I believe you could also just give the unit all versions of blink in the OE and just disable all of them for the player except the one that you want them to use. Then you wouldn’t have to add or remove abilities, just enable/disable.
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,892
First of all, And - All (Conditions are true) isn't needed to have. You can simply add conditions and it automatically assumes the "AND" part.
The Dying Town hall cant be Town 2, 3 and 4 at same time. What you need to do is each time a unit dies, check if the unit type was town hall 2, 3 or 4 and then:
Make an integer variable and set variable = variable + 1 and when the variable is equal to 3, then do your actions.
 
Level 2
Joined
Jul 28, 2009
Messages
14
Considering he is checking the unit-type, i believe that is supposed to be an "Or" condition, not an And, As that condition could never be fulfilled

To further on this if your wanting to see if the player has any town halls left you would change your initial condition to an Or instead of an And, then in the actions you could set a unit group of unit types (or check the unit classification if you have all your town halls set to Town Hall classifcation) owned by owner of dying unit and then use an int condition to check if the number of units in the unit group is greater than 0 or not.
  • Set TempGrp[0] = (Units owned by (Owner of (Triggering unit)) matching (((Picked unit) is A town-hall-type unit) Equal to True))
Also if all your doing with the blink ability is changing mana it might work better for you to instead just use multiple levels of blink, one lvl that costs 10 mana one that costs the other amt, then save the ability lvl for the picked unit to an integer and give the new unit blink and set its lvl to the integer
 
Last edited:
Level 10
Joined
Jun 20, 2017
Messages
336
First of all I'm not sure where did I wrong, and nothing happens!

Pyrogasm's way

Also, I give the unit all versions of blink, and just disable 2 of them for the player, and then dis/enb them on those triggers, but ....
  • Blink will change if town hall is destroyed
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Town Hall (2)
      • (Unit-type of (Dying unit)) Equal to Town Hall (3)
      • (Unit-type of (Dying unit)) Equal to Town Hall (4)
    • Actions
      • Set UnitGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Builder (Male)
                  • (Unit-type of (Picked unit)) Equal to Builder (Female)
            • Then - Actions
              • Unit - Remove Blink [Human]Q from (Picked unit)
              • Unit - Remove Blink [Human]W from (Picked unit)
              • Unit - Add Blink [Human]Q disabled to (Picked unit)
              • Unit - Add Blink [Human]W disabled to (Picked unit)
              • Custom script: call UnitMakeAbilityPermanent(GetTriggerUnit(), true, 'A002')
              • Custom script: call UnitMakeAbilityPermanent(GetTriggerUnit(), true, 'A024')
            • Else - Actions
      • Set PlayerGroup = (Player group((Triggering player)))
      • Game - Display to PlayerGroup the text: (Strings_PlayerColors[(Player number of (Owner of (Dying unit)))] + ((Name of (Owner of (Dying unit))) + (|r + your Town Hall was destroyed and Blink now cost |cffffcc0010|r mana.)))
      • Custom script: call DestroyForce(udg_PlayerGroup)
      • Custom script: call DestroyGroup(udg_UnitGroup)
      • Trigger - Turn on Blink will change if town hall is destroyed2 <gen>
  • Blink will change if town hall is destroyed2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Change Gender
    • Actions
      • Set UnitGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Builder (Male)
                  • (Unit-type of (Picked unit)) Equal to Builder (Female)
            • Then - Actions
              • Unit - Remove Blink [Human]Q from (Picked unit)
              • Unit - Remove Blink [Human]W from (Picked unit)
              • Unit - Add Blink [Human]Q disabled to (Picked unit)
              • Unit - Add Blink [Human]W disabled to (Picked unit)
              • Custom script: call UnitMakeAbilityPermanent(GetTriggerUnit(), true, 'A002')
              • Custom script: call UnitMakeAbilityPermanent(GetTriggerUnit(), true, 'A024')
            • Else - Actions
  • Blink will change if town hall is constructed
    • Events
      • Unit - A unit Finishes construction
      • Unit - A unit Finishes an upgrade
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Town Hall (2)
          • (Unit-type of (Triggering unit)) Equal to Town Hall (3)
          • (Unit-type of (Triggering unit)) Equal to Town Hall (4)
    • Actions
      • Set UnitGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Builder (Male)
                  • (Unit-type of (Picked unit)) Equal to Builder (Female)
            • Then - Actions
              • Unit - Remove Blink [Human]Q disabled from (Picked unit)
              • Unit - Remove Blink [Human]W disabled from (Picked unit)
              • Unit - Add Blink [Human]Q to (Picked unit)
              • Unit - Add Blink [Human]W to (Picked unit)
              • Custom script: call UnitMakeAbilityPermanent(GetTriggerUnit(), true, 'A06A')
              • Custom script: call UnitMakeAbilityPermanent(GetTriggerUnit(), true, 'A019')
            • Else - Actions
      • Set PlayerGroup = (Player group((Triggering player)))
      • Game - Display to PlayerGroup the text: (Strings_PlayerColors[(Player number of (Owner of (Triggering unit)))] + ((Name of (Owner of (Triggering unit))) + (|r + your Town Hall was built and Blink now cost |cffffcc001|r mana.)))
      • Custom script: call DestroyForce(udg_PlayerGroup)
      • Custom script: call DestroyGroup(udg_UnitGroup)
      • Trigger - Turn on Blink will change if town hall is constructed2 <gen>
  • Blink will change if town hall is constructed2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Change Gender
    • Actions
      • Set UnitGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Builder (Male)
                  • (Unit-type of (Picked unit)) Equal to Builder (Female)
            • Then - Actions
              • Unit - Remove Blink [Human]Q disabled from (Picked unit)
              • Unit - Remove Blink [Human]W disabled from (Picked unit)
              • Unit - Add Blink [Human]Q to (Picked unit)
              • Unit - Add Blink [Human]W to (Picked unit)
              • Custom script: call UnitMakeAbilityPermanent(GetTriggerUnit(), true, 'A06A')
              • Custom script: call UnitMakeAbilityPermanent(GetTriggerUnit(), true, 'A019')
            • Else - Actions
Wrda's way
nothing happens at all
  • Blink will change if town hall is destroyed
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Town Hall (2)
      • (Unit-type of (Dying unit)) Equal to Town Hall (3)
      • (Unit-type of (Dying unit)) Equal to Town Hall (4)
    • Actions
      • Set Integer_TownHall = (Integer_TownHall + 1)
      • Set UnitGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Builder (Male)
                  • (Unit-type of (Picked unit)) Equal to Builder (Female)
              • Integer_TownHall Equal to 3
            • Then - Actions
              • Unit - Remove Blink [Human]Q from (Picked unit)
              • Unit - Remove Blink [Human]W from (Picked unit)
              • Unit - Add Blink [Human]Q disabled to (Picked unit)
              • Unit - Add Blink [Human]W disabled to (Picked unit)
              • Custom script: call UnitMakeAbilityPermanent(GetTriggerUnit(), true, 'A002')
              • Custom script: call UnitMakeAbilityPermanent(GetTriggerUnit(), true, 'A024')
            • Else - Actions
      • Set PlayerGroup = (Player group((Triggering player)))
      • Game - Display to PlayerGroup the text: (Strings_PlayerColors[(Player number of (Owner of (Dying unit)))] + ((Name of (Owner of (Dying unit))) + (|r + your Town Hall was destroyed and Blink now cost |cffffcc0010|r mana.)))
      • Custom script: call DestroyForce(udg_PlayerGroup)
      • Custom script: call DestroyGroup(udg_UnitGroup)
      • Trigger - Turn on Blink will change if town hall is destroyed2 <gen>
Last-Chance's method
So I give the level two to the first ability, and unit classification for all town hall is Mechanical, but still the same thing...
1.jpg

2.jpg

3.jpg

  • Blink will change if town hall is destroyed
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Dying unit)) Equal to Town Hall (2)
          • (Unit-type of (Dying unit)) Equal to Town Hall (3)
          • (Unit-type of (Dying unit)) Equal to Town Hall (4)
    • Actions
      • Set UnitGroup = (Units owned by (Owner of (Dying unit)) matching (((Matching unit) is Mechanical) Equal to True))
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Builder (Male)
                  • (Unit-type of (Picked unit)) Equal to Builder (Female)
              • (Number of units in UnitGroup) Greater than 0
              • (Level of Blink [Human]Q for (Picked unit)) Equal to 2
              • (Level of Blink [Human]W for (Picked unit)) Equal to 2
            • Then - Actions
              • Set Integer_Blink = 2
              • Unit - Add Blink [Human]Q to (Picked unit)
              • Unit - Add Blink [Human]W to (Picked unit)
            • Else - Actions
      • Set PlayerGroup = (Player group((Triggering player)))
      • Game - Display to PlayerGroup the text: (Strings_PlayerColors[(Player number of (Owner of (Dying unit)))] + ((Name of (Owner of (Dying unit))) + (|r + your Town Hall was destroyed and Blink now cost |cffffcc0010|r mana.)))
      • Custom script: call DestroyForce(udg_PlayerGroup)
      • Custom script: call DestroyGroup(udg_UnitGroup)
      • Trigger - Turn on Blink will change if town hall is destroyed2 <gen>
 
Last edited:
Level 2
Joined
Jul 28, 2009
Messages
14
Right, so when your doing my method you'll need another group for the units that your giving blink to, at the moment your unit group will only contain the Town Halls so there isn't any Builder Males or Builder Females in it, so it won't affect any of your builders.
Make sure your also setting the level of Blink for the units your giving it to as well, so just add a
  • Unit - Set level of Blink[Human]Q for (Picked Unit) to Integer_Blink
in there
 
Status
Not open for further replies.
Top