• 🏆 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!

Make MUI trigger with specific unit event?

Status
Not open for further replies.
Level 14
Joined
Aug 8, 2010
Messages
1,022
Hi! I wanna ask you guys how i can make a MUI trigger with a specific unit event or other event, but with the fuction "...Takes Damage" there is my spell (it works! And i can't believe that :D)
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set HashTblIceBarr = (Last created hashtable)
  • Trig1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ice Barrier
    • Actions
      • Unit Group - Add (Triggering unit) to IceBarrUnGroup
      • Hashtable - Save 1500.00 as 1 of (Key (Triggering unit)) in HashTblIceBarr
      • Hashtable - Save Handle Of(Casting unit) as 2 of (Key (Triggering unit)) in HashTblIceBarr
      • Trigger - Turn on Trig2 <gen>
      • Game - Display to (All players) the text: Trig started!
  • Trig2
    • Events
      • Unit - Lich 0000 <gen> Takes damage
    • Conditions
    • Actions
      • Unit Group - Pick every unit in IceBarrUnGroup and do (Actions)
        • Loop - Actions
          • Hashtable - Save ((Load 1 of (Key (Attacked unit)) from HashTblIceBarr) - (Damage taken)) as 1 of (Key (Attacked unit)) in HashTblIceBarr
          • Unit - Set life of (Load 2 of (Key (Attacked unit)) in HashTblIceBarr) to ((Life of (Load 2 of (Key (Attacked unit)) in HashTblIceBarr)) + (Damage taken))
          • Trigger - Run Trig3 <gen> (checking conditions)
          • Game - Display to (All players) the text: Trig runs
      • Unit - Set life of (Load 2 of (Key (Attacked unit)) in HashTblIceBarr) to ((Life of (Load 2 of (Key (Attacked unit)) in HashTblIceBarr)) + (Damage taken))
  • Trig3
    • Events
      • Unit - Lich 0000 <gen> Takes damage
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load 1 of (Key (Attacked unit)) from HashTblIceBarr) Greater than 0.00
        • Then - Actions
          • Do nothing
        • Else - Actions
          • Game - Display to (All players) the text: Trig stopped
          • Unit - Remove Frost Armor buff from (Load 2 of (Key (Attacked unit)) in HashTblIceBarr)
          • Trigger - Turn off Trig2 <gen>
Help = +rep!!!
 
Level 13
Joined
Oct 25, 2009
Messages
995
WARNING:If your caster die,and revive,how?(This not a warning =.= xD,only told)

EDIT:I just know o.o,
set the variables
  • Trig1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ice Barrier
    • Actions
      • Unit Group - Add (Triggering unit) to IceBarrUnGroup
      • Set Ice_Barrier_Caster = (Casting Unit)
      • Hashtable - Save 1500.00 as 1 of (Key (Triggering unit)) in HashTblIceBarr
      • Hashtable - Save Handle Of(Casting unit) as 2 of (Key (Triggering unit)) in HashTblIceBarr
      • Trigger - Turn on Trig2 <gen>
      • Game - Display to (All players) the text: Trig started!
,and use
  • Actions:
  • Trigger - Add to Trig2 the events (Unit- (Ice_Barrier_Caster) Takes damage.
  • Trigger - Add to Trig3 the events (Unit- (Ice_Barrier_Caster) Takes damage.
Open this for Full trigger(1 trigger 1 trigger slowly make really tired,sleep soon =.+)
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set HashTblIceBarr = (Last created hashtable)
  • Trig1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ice Barrier
    • Actions
      • Unit Group - Add (Triggering unit) to IceBarrUnGroup
      • Hashtable - Save 1500.00 as 1 of (Key (Triggering unit)) in HashTblIceBarr
      • Set Ice_Barrier_Caster = (Casting Unit)
      • Hashtable - Save Handle Of(Casting unit) as 2 of (Key (Triggering unit)) in HashTblIceBarr
      • Trigger - Turn on Trig2 <gen>
      • Trigger - Add to Trig2 the events (Unit- (Ice_Barrier_Caster) Takes damage.
      • Trigger - Add to Trig3 the events (Unit- (Ice_Barrier_Caster) Takes damage.
      • Game - Display to (All players) the text: Trig started!
  • Trig2
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in IceBarrUnGroup and do (Actions)
        • Loop - Actions
          • Hashtable - Save ((Load 1 of (Key (Attacked unit)) from HashTblIceBarr) - (Damage taken)) as 1 of (Key (Attacked unit)) in HashTblIceBarr
          • Unit - Set life of (Load 2 of (Key (Attacked unit)) in HashTblIceBarr) to ((Life of (Load 2 of (Key (Attacked unit)) in HashTblIceBarr)) + (Damage taken))
          • Trigger - Run Trig3 <gen> (checking conditions)
          • Game - Display to (All players) the text: Trig runs
      • Unit - Set life of (Load 2 of (Key (Attacked unit)) in HashTblIceBarr) to ((Life of (Load 2 of (Key (Attacked unit)) in HashTblIceBarr)) + (Damage taken))
  • Trig3
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load 1 of (Key (Attacked unit)) from HashTblIceBarr) Greater than 0.00
        • Then - Actions
          • Do nothing
        • Else - Actions
          • Game - Display to (All players) the text: Trig stopped
          • Unit - Remove Frost Armor buff from (Load 2 of (Key (Attacked unit)) in HashTblIceBarr)
          • Trigger - Turn off Trig2 <gen>
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You should combine trig 2 and 3.

You never have to save the handle of the unit for itself. Useless line:
  • Hashtable - Save Handle Of(Casting unit) as 2 of (Key (Triggering unit)) in HashTblIceBarr
Do nothing is not needed here.

Attacked unit -> triggering unit
  • Unit - Set life of (Load 2 of (Key (Attacked unit)) in Hash...
The logic of the spell is unclear to me. What happens now is that when any unit of the group is damaged, you give all units in the group some life and reduce their shield.
 
Level 13
Joined
Oct 25, 2009
Messages
995
You should combine trig 2 and 3.

You never have to save the handle of the unit for itself. Useless line:
  • Hashtable - Save Handle Of(Casting unit) as 2 of (Key (Triggering unit)) in HashTblIceBarr
Do nothing is not needed here.

Attacked unit -> triggering unit
  • Unit - Set life of (Load 2 of (Key (Attacked unit)) in Hash...
The logic of the spell is unclear to me. What happens now is that when any unit of the group is damaged, you give all units in the group some life and reduce their shield.

How did u get that christmas hat?(santa hat)
P/S:My trigger does it work?:goblin_boom:
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
...The logic of the spell is unclear to me. What happens now is that when any unit of the group is damaged, you give all units in the group some life and reduce their shield.
The logic is - 1st of all - there is no unit group. And the logic is that the spell is absorbing shield - it gives you life equal to the damage caused, so it is like absorbing, else - if attackers do damage to you - there is nothing absorbed. Got it? :wink:
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
The logic is - 1st of all - there is no unit group. And the logic is that the spell is absorbing shield - it gives you life equal to the damage caused, so it is like absorbing, else - if attackers do damage to you - there is nothing absorbed. Got it? :wink:

  • Unit Group - Pick every unit in IceBarrUnGroup
Currently what happens is that if are ten units that have the shield. If one of them takes damage, you give all ten units life back and reduce all their shields.
 
Status
Not open for further replies.
Top