• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[Solved] How to add a buff to Magic Defense?

Status
Not open for further replies.
Level 5
Joined
Oct 29, 2020
Messages
82
I replaced Locust Swarm with Magic Defense as the heroic ability for Crypt lord. But I found that it didn't work when I added a buff directly at the "Stats - Buffs" of the Magic Defense Ability. Maybe it should be added via a trigger? I don't know how to write the right trigger. Any help?
 
Level 21
Joined
Feb 27, 2019
Messages
660
I believe it has to be triggered. First, create the event to detect when the ability or order is used.
  • Events
    • Unit - A unit Starts the effect of an ability
    • Unit - A unit Is issued an order with no target
In this case the ability one didnt work so I used the order.
To find the correct order leave the conditions blank and display a message in the actions.
  • Actions
    • Game - Display to (All players) the text: (String((Issued order)))
Now move on to the condition. When you have the correct orders they can be put in the condition. If you add the correct conditions the game message will still be displayed.
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Issued order) Equal to (Order(magicdefense))
        • (Issued order) Equal to (Order(magicundefense))
AFterwards add an If/then/else in the actions to see if the order was magicdefense or not and then add/remove the desired effect.
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Issued order) Equal to (Order(magicdefense))
      • Then - Actions
        • -------- Add effect --------
      • Else - Actions
        • -------- Remove effect --------
The effect can be added in different ways. Here is a couple.

1. It can be added directly with triggers, in which case you create the effect on the unit and set the effect to a variable. When magicundefense is ordered the effect should be destroyed. The order magicundefense happens automatically when the unit dies but that is not the case for most abilities. In those cases the effect has to be destroyed when the unit dies aswell.

2. The effect can be added with the help of abilities. You can use Item Armor Bonus (+1) to create a custom ability, remove the armor bonus, add the effect to Art - Target and add your desired attachment point. Add the ability under Then - Actions and remove it under Else - Actions in the If/then/else condition. This way works excellent with items, as you only need to add the ability to the item and it shows the effect when the item is worn.
 
Level 5
Joined
Oct 29, 2020
Messages
82
set the effect to a variable. When magicundefense is ordered the effect should be destroyed. The order magicundefense happens automatically when the unit dies but that is not the case for most abilities. In those cases the effect has to be destroyed when the unit dies aswell.
I believe it has to be triggered. First, create the event to detect when the ability or order is used.
  • Events
    • Unit - A unit Starts the effect of an ability
    • Unit - A unit Is issued an order with no target
In this case the ability one didnt work so I used the order.
To find the correct order leave the conditions blank and display a message in the actions.
  • Actions
    • Game - Display to (All players) the text: (String((Issued order)))
Now move on to the condition. When you have the correct orders they can be put in the condition. If you add the correct conditions the game message will still be displayed.
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Issued order) Equal to (Order(magicdefense))
        • (Issued order) Equal to (Order(magicundefense))
AFterwards add an If/then/else in the actions to see if the order was magicdefense or not and then add/remove the desired effect.
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Issued order) Equal to (Order(magicdefense))
      • Then - Actions
        • -------- Add effect --------
      • Else - Actions
        • -------- Remove effect --------
The effect can be added in different ways. Here is a couple.

1. It can be added directly with triggers, in which case you create the effect on the unit and set the effect to a variable. When magicundefense is ordered the effect should be destroyed. The order magicundefense happens automatically when the unit dies but that is not the case for most abilities. In those cases the effect has to be destroyed when the unit dies aswell.

2. The effect can be added with the help of abilities. You can use Item Armor Bonus (+1) to create a custom ability, remove the armor bonus, add the effect to Art - Target and add your desired attachment point. Add the ability under Then - Actions and remove it under Else - Actions in the If/then/else condition. This way works excellent with items, as you only need to add the ability to the item and it shows the effect when the item is worn.
Thank you. According to your guide, I've written two triggers, they almost work (please have a look at the attached pictures below), but I have a problem about setting the effect to a variable and destroying it. which type of variable is it? How to write the specific triggers? I'm new to this kind of triggers.
 

Attachments

  • on.PNG
    on.PNG
    8.7 KB · Views: 11
  • off.PNG
    off.PNG
    6.6 KB · Views: 11
Level 5
Joined
Oct 29, 2020
Messages
82
I believe it has to be triggered. First, create the event to detect when the ability or order is used.
  • Events
    • Unit - A unit Starts the effect of an ability
    • Unit - A unit Is issued an order with no target
In this case the ability one didnt work so I used the order.
To find the correct order leave the conditions blank and display a message in the actions.
  • Actions
    • Game - Display to (All players) the text: (String((Issued order)))
Now move on to the condition. When you have the correct orders they can be put in the condition. If you add the correct conditions the game message will still be displayed.
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Issued order) Equal to (Order(magicdefense))
        • (Issued order) Equal to (Order(magicundefense))
AFterwards add an If/then/else in the actions to see if the order was magicdefense or not and then add/remove the desired effect.
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Issued order) Equal to (Order(magicdefense))
      • Then - Actions
        • -------- Add effect --------
      • Else - Actions
        • -------- Remove effect --------
The effect can be added in different ways. Here is a couple.

1. It can be added directly with triggers, in which case you create the effect on the unit and set the effect to a variable. When magicundefense is ordered the effect should be destroyed. The order magicundefense happens automatically when the unit dies but that is not the case for most abilities. In those cases the effect has to be destroyed when the unit dies aswell.

2. The effect can be added with the help of abilities. You can use Item Armor Bonus (+1) to create a custom ability, remove the armor bonus, add the effect to Art - Target and add your desired attachment point. Add the ability under Then - Actions and remove it under Else - Actions in the If/then/else condition. This way works excellent with items, as you only need to add the ability to the item and it shows the effect when the item is worn.
Thank you so much for your guide.
I've solved this problem by 2 triggers with the help of the Armor Bonus Ability. It works perfectly. Other people who are also interested in this kind of topics can see them in the following attached pictures.
I am now just curious as to how to solve this problem purely by triggers like the first way you mentioned. If you had time, please tell me. If not, forget about it.
 

Attachments

  • on.PNG
    on.PNG
    8.8 KB · Views: 13
  • off.PNG
    off.PNG
    6.4 KB · Views: 11
Level 5
Joined
Oct 29, 2020
Messages
82
Adding a buff does nothing in wc3. Looks like you already figured that out, but just to be clear in case it wasn't. If you want the effect of something you have to cast the spell that gives the buff, not just 'give' the buff somehow.
I've solved this problem according to the way [db]east told me. Thank you all the same.
 
Status
Not open for further replies.
Top