• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Is this spell MUI or not?

Status
Not open for further replies.
Level 2
Joined
Jun 13, 2020
Messages
16
Hai,I am still a newbie for trigger.I want to ask if my ability is the instant cast ability,did I need to make it MUI or it straight away become the MUI spell??

Rich (BB code):
  • Swift strike
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Execute strike
    • Actions
      • Set ItemCaster = (Casting unit)
      • Set SwiftStrike_TempPoint = (Target point of ability being cast)
      • Set SwiftStrike_TempUnit = (Target unit of ability being cast)
      • Unit - Move ItemCaster instantly to SwiftStrike_TempPoint, facing (Facing of ItemCaster) degrees
      • Unit - Cause ItemCaster to damage SwiftStrike_TempUnit, dealing (100.00 + ((Max life of Temp_Unit) x 0.10)) damage of attack type Chaos and damage type Normal
      • Unit Group - Pick every unit in (Units within 200.00 of SwiftStrike_TempPoint matching (((Matching unit) Not equal to SwiftStrike_TempUnit) and (((Matching unit) belongs to an enemy of (Owner of ItemCaster)) Equal to True))) and do (Actions)
        • Loop - Actions
          • Unit - Cause ItemCaster to damage (Picked unit), dealing ((100.00 + ((Max life of SwiftStrike_TempUnit) x 0.10)) x 1.00) damage of attack type Chaos and damage type Normal
          • Custom script: call RemoveLocation(udg_SwiftStrike_TempPoint)
 
Last edited:
Level 24
Joined
Feb 9, 2009
Messages
1,787
The location is destroyed at the first unit damaged in the unit group, move the custom script bottom of the trigger.

Also note an easier way to filter unitgroups via this tutorial.
Lastly (just my personal opinion~) try using this model in the unit group (or under the initial unit) by using these two lines:
  • Special Effect - Create a special effect attached to the chest of (Picked unit) using Ephemeral Cut Avocado
  • Special Effect - Destroy (Last created special effect)
 
Level 2
Joined
Jun 13, 2020
Messages
16
Can someone can review this trigger,I don't know why my trigger is not working.

Rich (BB code):
  • Ability Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- InnerBerserk --------
      • Set Unit_Type[1] = Fire hound (Level 1)
      • Set Unit_Type[2] = Fire hound (Level 2)
      • Set Unit_Type[3] = Fire hound (Level 3)
      • Set InnerBerserk_Buff[1] = buff(Lv.2)
      • Set InnerBerserk_Buff[2] = buff(Lv.3)
      • Set InnerBerserk_Buff[3] = buff(Lv.4)
      • Set InnerBerserk_Buff[4] = buff(Lv.5)
  • Inner Berserk
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) has buff Inner berserk ) Equal to True
    • Actions
      • Set InnerBerserk_Player = (Player number of (Owner of (Killing unit)))
      • Set InnerBerserk_Unit[InnerBerserk_Player] = (Killing unit)
      • Set InnerBerserk_TempPoint[InnerBerserk_Player] = (Position of InnerBerserk_Unit[InnerBerserk_Player])
      • Set InnerBerserk_Level[InnerBerserk_Player] = (Level of Inner berserk for InnerBerserk_Unit[InnerBerserk_Player])
      • Set InnerBerserk_UnitGroup[InnerBerserk_Player] = (Units owned by (Owner of InnerBerserk_Unit[InnerBerserk_Player]) matching (((Unit-type of (Matching unit)) Equal to |c00FF0000Flaming Sorceress|r) and ((Unit-type of (Matching unit)) Equal to Unit_Type[InnerBerserk_Level[InnerBerserk_Player]])))
      • Unit Group - Pick every unit in InnerBerserk_UnitGroup[InnerBerserk_Player] and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Buffer for (Owner of InnerBerserk_Unit[InnerBerserk_Player]) at InnerBerserk_TempPoint[InnerBerserk_Player] facing Default building facing degrees
          • Set InnerBerserk_UnitDummy[InnerBerserk_Player] = (Last created unit)
          • Unit - Add a 2.00 second Generic expiration timer to InnerBerserk_UnitDummy[InnerBerserk_Player]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Dying unit)) Equal to Gargolyte(Lv.2)
                  • (Unit-type of (Dying unit)) Equal to Ghoul(Lv.2)
                  • (Unit-type of (Dying unit)) Equal to Skeleton Warrior(Lv.2)
            • Then - Actions
              • Unit - Add InnerBerserk_Buff[1] to InnerBerserk_UnitDummy[InnerBerserk_Player]
              • Unit - Set level of InnerBerserk_Buff[1] for InnerBerserk_UnitDummy[InnerBerserk_Player] to InnerBerserk_Level[InnerBerserk_Player]
              • Unit - Order InnerBerserk_UnitDummy[InnerBerserk_Player] to Undead Necromancer - Unholy Frenzy (Picked unit)
            • Else - 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 (Dying unit)) Equal to Necromancer(Lv.3)
                  • (Unit-type of (Dying unit)) Equal to Chaos Flame(Lv.3)
                  • (Unit-type of (Dying unit)) Equal to Dead Spirit(Lv.3)
            • Then - Actions
              • Unit - Add InnerBerserk_Buff[2] to InnerBerserk_UnitDummy[InnerBerserk_Player]
              • Unit - Set level of InnerBerserk_Buff[2] for InnerBerserk_UnitDummy[BlazingPit_Player] to (Level of InnerBerserk_Buff[InnerBerserk_Player] for InnerBerserk_Unit[InnerBerserk_Player])
              • Unit - Order InnerBerserk_UnitDummy[InnerBerserk_Player] to Undead Necromancer - Unholy Frenzy (Picked unit)
            • Else - 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 (Dying unit)) Equal to Shadow Rider(Lv.4)
                  • (Unit-type of (Dying unit)) Equal to Lonely Ghost(Lv.4)
                  • (Unit-type of (Dying unit)) Equal to Banshee(Lv.4)
            • Then - Actions
              • Unit - Add InnerBerserk_Buff[3] to InnerBerserk_UnitDummy[InnerBerserk_Player]
              • Unit - Set level of InnerBerserk_Buff[3] for InnerBerserk_UnitDummy[BlazingPit_Player] to InnerBerserk_Level[InnerBerserk_Player]
              • Unit - Order InnerBerserk_UnitDummy[InnerBerserk_Player] to Undead Necromancer - Unholy Frenzy (Picked unit)
            • Else - 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 (Dying unit)) Equal to Shadow Destroyer(Lv.5)
                  • (Unit-type of (Dying unit)) Equal to Balnazzar(Lv.5)
                  • (Unit-type of (Dying unit)) Equal to Blazing Skeleton(Lv.5)
                  • (Unit-type of (Dying unit)) Equal to Frost Wyrm(Lv.5)
            • Then - Actions
              • Unit - Add InnerBerserk_Buff[4] to InnerBerserk_UnitDummy[InnerBerserk_Player]
              • Unit - Set level of InnerBerserk_Buff[4] for InnerBerserk_UnitDummy[BlazingPit_Player] to InnerBerserk_Level[InnerBerserk_Player]
              • Unit - Order InnerBerserk_UnitDummy[InnerBerserk_Player] to Undead Necromancer - Unholy Frenzy (Picked unit)
            • Else - Actions
  • Ability Turning off trigger
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Buffer
              • (Triggering unit) Equal to InnerBerserk_UnitDummy[(Integer A)]
            • Then - Actions
              • Custom script: call DestroyGroup(udg_InnerBerserk_UnitGroup[udg_InnerBerserk_Player])
              • Custom script: set udg_InnerBerserk_Player =0
            • Else - Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,542
I don't really understand what you're trying to do in these triggers. As far as I can tell none of these variables need Arrays and the "Turning off" trigger isn't needed either.

Here's a much easier way of doing all of this:
  • Inner Berserk
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) has buff Inner Berserk) Equal to True
    • Actions
      • Set Variable InnerBerserk_Point = (Position of (Killing unit))
      • Unit - Create 1 Dummy for (Owner of (Killing unit)) at InnerBerserk_Point facing Default building facing degrees
      • Set Variable InnerBerserk_Dummy = (Last created unit)
      • Set Variable InnerBerserk_Level = (Level of Inner Berserk for (Killing unit))
      • Unit - Add a 0.50 second Generic expiration timer to InnerBerserk_Dummy
      • Set Variable InnerBerserk_Group = (Units owned by (Owner of (Killing unit)) matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Sorceress)).)
      • -------- --------
      • -------- Inner Berserk 1 (Else 2, Else 3, Else 4): --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to YourUnits1
        • Then - Actions
          • Unit - Add InnerBerserk_Buff[1] to InnerBerserk_Dummy
          • Unit - Set level of InnerBerserk_Buff[1] for InnerBerserk_Dummy to InnerBerserk_Level
          • Unit Group - Pick every unit in InnerBerserk_Group and do (Actions)
            • Loop - Actions
              • Unit - Order InnerBerserk_Dummy to Undead Necromancer - Unholy Frenzy (Picked unit)
        • Else - Actions
          • -------- Inner Berserk 2 --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Triggering unit)) Equal to YourUnits2
            • Then - Actions
              • Unit - Add InnerBerserk_Buff[2] to InnerBerserk_Dummy
              • Unit - Set level of InnerBerserk_Buff[2] for InnerBerserk_Dummy to InnerBerserk_Level
              • Unit Group - Pick every unit in InnerBerserk_Group and do (Actions)
                • Loop - Actions
                  • Unit - Order InnerBerserk_Dummy to Undead Necromancer - Unholy Frenzy (Picked unit)
            • Else - Actions
              • -------- Inner Berserk 3 --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Unit-type of (Triggering unit)) Equal to YourUnits3
                • Then - Actions
                  • Unit - Add InnerBerserk_Buff[3] to InnerBerserk_Dummy
                  • Unit - Set level of InnerBerserk_Buff[3] for InnerBerserk_Dummy to InnerBerserk_Level
                  • Unit Group - Pick every unit in InnerBerserk_Group and do (Actions)
                    • Loop - Actions
                      • Unit - Order InnerBerserk_Dummy to Undead Necromancer - Unholy Frenzy (Picked unit)
                • Else - Actions
                  • -------- Inner Berserk 4 --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Unit-type of (Triggering unit)) Equal to YourUnits4
                    • Then - Actions
                      • Unit - Add InnerBerserk_Buff[4] to InnerBerserk_Dummy
                      • Unit - Set level of InnerBerserk_Buff[4] for InnerBerserk_Dummy to InnerBerserk_Level
                      • Unit Group - Pick every unit in InnerBerserk_Group and do (Actions)
                        • Loop - Actions
                          • Unit - Order InnerBerserk_Dummy to Undead Necromancer - Unholy Frenzy (Picked unit)
                    • Else - Actions
      • -------- --------
      • -------- Clean up memory leaks: --------
      • Custom script: call DestroyGroup (udg_InnerBerserk_Group)
      • Custom script: call RemoveLocation (udg_InnerBerserk_Point)



But just for the sake of understanding, here's what's wrong with your current triggers:
1) Unit Group arrays need to be initialized by manually adjusting their Size. So if you have 6 players in your game, and their Player Numbers are 1 to 6, you'd want to set the Size to 6. Additionally, here's a way of handling Unit Groups while still using the default Size of 1 -> [Solved] - Unit Group[array] Question

2) In your "Turning off" trigger you do:
  • Custom script: call DestroyGroup(udg_InnerBerserk_UnitGroup[udg_InnerBerserk_Player])
But "udg_InnerBerserk_Player" is never Set. I assume you want this to be equal to (Integer A) instead.

3) This may not cause a problem in this particular case but don't use For each (Integer A), instead use your own Variable like:
  • For each (InnerBerserk_Loop) from 1 to 6, do (Actions)
This will help you avoid issues in the future.
 
Last edited:
Level 2
Joined
Jun 13, 2020
Messages
16
I don't really understand what you're trying to do in these triggers. As far as I can tell none of these variables need Arrays and the "Turning off" trigger isn't needed either.

Here's a much easier way of doing all of this:
  • Inner Berserk
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) has buff Inner Berserk) Equal to True
    • Actions
      • Set Variable InnerBerserk_Point = (Position of (Killing unit))
      • Unit - Create 1 Dummy for (Owner of (Killing unit)) at InnerBerserk_Point facing Default building facing degrees
      • Set Variable InnerBerserk_Dummy = (Last created unit)
      • Set Variable InnerBerserk_Level = (Level of Inner Berserk for (Killing unit))
      • Set Variable InnerBerserk_Group = (Units owned by (Owner of (Killing unit)) matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Sorceress)).)
      • -------- --------
      • -------- Inner Berserk 1 (Else 2, Else 3, Else 4): --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to YourUnits1
        • Then - Actions
          • Unit - Add InnerBerserk_Buff[1] to InnerBerserk_Dummy
          • Unit - Set level of InnerBerserk_Buff[1] for InnerBerserk_Dummy to InnerBerserk_Level
          • Unit Group - Pick every unit in InnerBerserk_Group and do (Actions)
            • Loop - Actions
              • Unit - Order InnerBerserk_Dummy to Undead Necromancer - Unholy Frenzy (Picked unit)
        • Else - Actions
          • -------- Inner Berserk 2 --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Triggering unit)) Equal to YourUnits2
            • Then - Actions
              • Unit - Add InnerBerserk_Buff[2] to InnerBerserk_Dummy
              • Unit - Set level of InnerBerserk_Buff[2] for InnerBerserk_Dummy to InnerBerserk_Level
              • Unit Group - Pick every unit in InnerBerserk_Group and do (Actions)
                • Loop - Actions
                  • Unit - Order InnerBerserk_Dummy to Undead Necromancer - Unholy Frenzy (Picked unit)
            • Else - Actions
              • -------- Inner Berserk 3 --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Unit-type of (Triggering unit)) Equal to YourUnits3
                • Then - Actions
                  • Unit - Add InnerBerserk_Buff[3] to InnerBerserk_Dummy
                  • Unit - Set level of InnerBerserk_Buff[3] for InnerBerserk_Dummy to InnerBerserk_Level
                  • Unit Group - Pick every unit in InnerBerserk_Group and do (Actions)
                    • Loop - Actions
                      • Unit - Order InnerBerserk_Dummy to Undead Necromancer - Unholy Frenzy (Picked unit)
                • Else - Actions
                  • -------- Inner Berserk 4 --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Unit-type of (Triggering unit)) Equal to YourUnits4
                    • Then - Actions
                      • Unit - Add InnerBerserk_Buff[4] to InnerBerserk_Dummy
                      • Unit - Set level of InnerBerserk_Buff[4] for InnerBerserk_Dummy to InnerBerserk_Level
                      • Unit Group - Pick every unit in InnerBerserk_Group and do (Actions)
                        • Loop - Actions
                          • Unit - Order InnerBerserk_Dummy to Undead Necromancer - Unholy Frenzy (Picked unit)
                    • Else - Actions
      • -------- --------
      • -------- Clean up memory leaks: --------
      • Custom script: call DestroyGroup (udg_InnerBerserk_Group)
      • Custom script: call RemoveLocation (udg_InnerBerserk_Point)



But just for the sake of understanding, here's what's wrong with your current triggers:
1) Unit Group arrays need to initialized by manually adjusting their Size. So if you have 6 players in your game, and their Player Numbers are 1 to 6, you'd want to set the Size to 6. Additionally, here's a way of handling Unit Groups while still using the default Size of 1 -> [Solved] - Unit Group[array] Question

2) In your "Turning off" trigger you do:
  • Custom script: call DestroyGroup(udg_InnerBerserk_UnitGroup[udg_InnerBerserk_Player])
But "udg_InnerBerserk_Player" is never Set. I assume you wanted this to be equal to (Integer A) instead.

3) This may not cause a problem in this particular case but don't use For each (Integer A), instead use your own Variable like:
  • For each (InnerBerserk_Loop) from 1 to 6, do (Actions)
This will help you avoid issues in the future
Sry for not explaining my ability first
My ability is very simple and it is passive skill.Just when the unit with specific ability(which have specific buff) kill the specific units,it and it's units will get specific buff.
So,I want to ask if player 1 and player 2 unit with different levels of Inner_Berserk ability kill the enemy at the same time,will this cause any problems/bugs to my trigger by not using any index to store the information of each unit?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,542
No worries, that new trigger I posted should work perfectly for you.

So there's no need to use Arrays in a trigger like this. The method you're using with Player Numbers is useful for keeping track of information between different triggers. But in the case of your trigger, all of the important information is already provided to you (dying unit, killing unit), therefore you don't need to keep track of it on a per-player basis. You can instead do what I did in my trigger and keep track of the information using non-array variables.

In situations like this people often use "temp" (aka temporary) variables, which are basically reusable variables that will be used throughout all of your triggers. Now I should mention that there's some possible issues with using "temp" variables, so if you're feeling uncertain about using them then just create and use new variables instead.

Here's some more important things to understand:
1) A unit cannot be killed by more than 1 unit. So 2 players can't "kill the enemy at the same time".

2) Units don't actually die at the "same time". Everything is ordered sequentially.
So if multiple units are killed at the "same time", your Inner Berserk trigger will run once for each dying unit.

In other words, if your Inner Berserk Hero casts War Stomp and kills 3 nearby enemy units, the Event "A unit dies" would happen 3 times, once for each dying unit. This means that your Inner Berserk trigger would run 3 times, once for each dying unit. You can think of it like 3 instances of the trigger are created. These separate instances of the Inner Berserk trigger would not interfere with one another because their Events/Conditions/Actions happen sequentially. One trigger runs, then the next trigger runs, and then finally the last trigger runs.


Edit: If you do use the trigger I made, make sure your Dummy unit is setup correctly. If done properly, a single Dummy unit should be able to cast an ability on any number of units at the same time. Read my last post about Dummys in this thread: [Solved] - Pretty please help making GUI dummy/buff system MUI?
 
Last edited:
Status
Not open for further replies.
Top