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

[Trigger] Passiv Spell Request

Status
Not open for further replies.
Level 5
Joined
Jul 17, 2010
Messages
140
What am i doing wrong here?

I want to add a specific stat or spell when the summoned unit is alive and it gets removed when its dead.
This need to work with differents summons, just as long a summoned unit is alive for this char the stat bonus will be there.

  • Demon Bond
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
      • (Level of Demon Bond (WL) for (Triggering unit)) Not equal to 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of living Imp units owned by (Owner of (Triggering unit))) Equal to 1
        • Then - Actions
          • Hero - Modify Strength of (Triggering unit): Add 20
        • Else - Actions
Thanks in advance!
-Dominic
 
Last edited by a moderator:
Level 8
Joined
Jan 28, 2016
Messages
486
The problem with your trigger is that you're trying to reference the triggering unit, which doesn't exist because you're using a periodic event instead of unit event. In this case, 'Triggering Unit' will return null, your condition will return false and the trigger actions will never run.

Assuming this is for only one hero, store the specific hero into a unit variable and use the variable instead of 'Triggering Unit' in your trigger above. That's it!

Also, you can use [TRIGGER][/TRIGGER] tags instead of [CODE][/CODE] tags to post triggers. There's also this guide if you want to check it out but you probably don't need it: How to easily post triggers.

P.S.: Damn these new lists; can't add text directly beneath them without turning into a new bullet point! **RAWR**
 
Level 2
Joined
Oct 8, 2015
Messages
14
True. If you want use Passive ability with cooldown - Best method! You should use this trigger.
  • Trigger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Level of Demon Bond (WL) for (Triggering unit)) Not equal to 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of living Imp units owned by (Owner of (Triggering unit))) Equal to 1
        • Then - Actions
          • Hero - Modify Strength of (Triggering unit): Add 20
        • Else - Actions
          • Do nothing
If you want fix your trigger you should do something like this.
  • Trigger 1
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Demon Bond (WL) for (Picked unit)) Not equal to 0
              • (Number of living Imp units owned by (Owner of (Picked unit))) Equal to 1
            • Then - Actions
              • Hero - Modify Strength of (Picked unit): Add 20
            • Else - Actions
              • Do nothing
 
Level 5
Joined
Jul 17, 2010
Messages
140
True. If you want use Passive ability with cooldown - Best method! You should use this trigger.
  • Trigger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Level of Demon Bond (WL) for (Triggering unit)) Not equal to 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of living Imp units owned by (Owner of (Triggering unit))) Equal to 1
        • Then - Actions
          • Hero - Modify Strength of (Triggering unit): Add 20
        • Else - Actions
          • Do nothing
If you want fix your trigger you should do something like this.
  • Trigger 1
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Demon Bond (WL) for (Picked unit)) Not equal to 0
              • (Number of living Imp units owned by (Owner of (Picked unit))) Equal to 1
            • Then - Actions
              • Hero - Modify Strength of (Picked unit): Add 20
            • Else - Actions
              • Do nothing

But with this trigger does it not add 20 str every time the hero summons the imp unit?
 
Level 8
Joined
Jan 28, 2016
Messages
486
But with this trigger does it not add 20 str every time the hero summons the imp unit?

Yes it will and the second trigger will add 20 strength every 2 seconds as long as there is an Imp alive.

They always say you should create spells that are MUI but if you only need this for a one specific hero (Eg: a boss in a campaign), then try the following triggers. If you need them to be MUI, we can work that out later.
You can remove the learn trigger and make the passive ability based on Attribute Bonus (Aamk) which can provide the bonus strength instead.

  • Demonic Bond Learn
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Demonic Bond
      • (Level of Demonic Bond for (Triggering unit)) Equal to 1
    • Actions
      • Set Demon King = (Triggering unit)
      • Hero - Modify Strength of Demon King: Add 20
  • Demonic Bond Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Imp
      • (Number of units in UnitGroupImp) Equal to 0
      • (Owner of (Triggering unit)) Equal to (Owner of Demon King)
    • Actions
      • Hero - Modify Strength of Demon King: Subtract 20
  • Demonic Bond Summon
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
      • (Owner of (Triggering unit)) Equal to (Owner of Demon King)
    • Actions
      • Unit Group - Add (Triggering unit) to UnitGroupImp
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in UnitGroupImp) Equal to 1
        • Then - Actions
          • Hero - Modify Strength of Demon King: Add 20
        • Else - Actions
 
Level 11
Joined
May 16, 2016
Messages
730
What am i doing wrong here?

I want to add a specific stat or spell when the summoned unit is alive and it gets removed when its dead.
This need to work with differents summons, just as long a summoned unit is alive for this char the stat bonus will be there
Here is a template for you how to do it right.
 

Attachments

  • SUMMON WITH BONUSES.w3x
    16.9 KB · Views: 28
Level 5
Joined
Jul 17, 2010
Messages
140
Yes it will and the second trigger will add 20 strength every 2 seconds as long as there is an Imp alive.

They always say you should create spells that are MUI but if you only need this for a one specific hero (Eg: a boss in a campaign), then try the following triggers. If you need them to be MUI, we can work that out later.
You can remove the learn trigger and make the passive ability based on Attribute Bonus (Aamk) which can provide the bonus strength instead.

  • Demonic Bond Learn
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Demonic Bond
      • (Level of Demonic Bond for (Triggering unit)) Equal to 1
    • Actions
      • Set Demon King = (Triggering unit)
      • Hero - Modify Strength of Demon King: Add 20
  • Demonic Bond Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Imp
      • (Number of units in UnitGroupImp) Equal to 0
      • (Owner of (Triggering unit)) Equal to (Owner of Demon King)
    • Actions
      • Hero - Modify Strength of Demon King: Subtract 20
  • Demonic Bond Summon
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
      • (Owner of (Triggering unit)) Equal to (Owner of Demon King)
    • Actions
      • Unit Group - Add (Triggering unit) to UnitGroupImp
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in UnitGroupImp) Equal to 1
        • Then - Actions
          • Hero - Modify Strength of Demon King: Add 20
        • Else - Actions
If this should be Mui how is the trigger then?
 
If you still on this and Fruit Forest's Template was not the thing you were looking for, a Version which adds 20 Str on Summon to summoner on death of summoning takes it away again.
Allows to be setuped for different Summoning-Unit-Types-
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtabel - Create a hashtable
      • Set Hashtable = (Last created hashtable)
      • Set Imp_Types[0] = Imp (Level 1)
      • Set Imp_Types[1] = Imp (Level 2)
      • Set Imp_Types[2] = Imp (Level 3)
      • -------- You can add here more, but increase the Number and the "Imp_Types_Last" according --------
      • Set Imp_Types_Last = 2
  • Summon
    • Events
      • Unit - A unit Summons an Unit
    • Conditions
    • Actions
      • For each (Integer A) from 0 to Imp_Types_Last, do (Actions)
        • Schleifen - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal Imp_Types[(Integer A)]
            • Then - Actions
              • Hashtabelle - Save Handle Of(Summoning unit) as 0 of (Key (Summoned unit)) in Hashtable
              • Hero - Modify Strenght of (Summoning unit): Add 20
              • Skip remaining actions
            • Else - Actions
  • End
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer A) from 0 to Imp_Types_Last, do (Actions)
        • Schleifen - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal Imp_Types[(Integer A)]
            • Then - Actions
              • Hero - Modify Strenght of (Load 0 of (Key (Triggering unit)) in Hashtable): Entfernen 20
              • Hashtabelle - Clear all child hashtables of child (Key (Triggering unit)) in Hashtable
              • Skip remaining actions
            • Else - Actions
 
Level 11
Joined
May 16, 2016
Messages
730
If you still on this and Fruit Forest's Template was not the thing you were looking for, a Version which adds 20 Str on Summon to summoner on death of summoning takes it away again.
Allows to be setuped for different Summoning-Unit-Types-
If' I'm not mistaken you can't get ID by using of Key(Unit) because it works only in 1.24 or less version
 
Status
Not open for further replies.
Top