• 🏆 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] Can some one fix this please ?

Status
Not open for further replies.
Level 2
Joined
Dec 24, 2016
Messages
15
I want to create a passive spell that heal hp and mana each 8 seconds. Well i almost got it but i have a litte problem,
  • (Level of Holy Nova for Paladin) Equal to 1
  • (Level of Holy Nova for Paladin) Equal to 2
  • (Level of Holy Nova for Paladin) Equal to 3
  • (Level of Holy Nova for Paladin) Equal to 4
The trigger up ahead, how can i make the "Paladin" slot to the unit that have that ability (Unit that have ability also Paladin, a hero)
Anyway, here is the total trigger:

  • Holy Nova
    • Events
      • Time - Each 8 seconds of game time
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Holy Nova for Paladin) Equal to 1
      • Then - 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
                • ((Picked unit) has buff |c007d7d7dHoly Nova|r ) Equal to True
              • Then - Actions
                • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Orc\Disenchant\DisenchantSpecialArt.mdl
                • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 11.00)
                • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + 7.00)
                • Game - Display to (All players) the text: Test successful!
              • Else - Actions
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Holy Nova for Paladin) Equal to 2
      • Then - 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
                • ((Picked unit) has buff |c007d7d7dHoly Nova|r ) Equal to True
              • Then - Actions
                • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Orc\Disenchant\DisenchantSpecialArt.mdl
                • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 16.00)
                • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + 14.00)
                • Game - Display to (All players) the text: Test successful!
              • Else - Actions
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Holy Nova for Paladin) Equal to 3
      • Then - 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
                • ((Picked unit) has buff |c007d7d7dHoly Nova|r ) Equal to True
              • Then - Actions
                • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Orc\Disenchant\DisenchantSpecialArt.mdl
                • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 24.00)
                • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + 23.00)
                • Game - Display to (All players) the text: Test successful!
              • Else - Actions
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of Holy Nova for Paladin) Equal to 4
      • Then - 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
                • ((Picked unit) has buff |c007d7d7dHoly Nova|r ) Equal to True
              • Then - Actions
                • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Orc\Disenchant\DisenchantSpecialArt.mdl
                • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 32.00)
                • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + 35.00)
                • Game - Display to (All players) the text: Test successful!
              • Else - Actions
      • Else - Actions
 
Level 13
Joined
May 10, 2009
Messages
868
Every time a hero learns that spell, you add them to a specific unit group or a loop. With that, you check the units around those heroes, and heal them. So it would be something like this:

Trigger A:
A unit learns a spell, add them to a group/loop

Trigger B:
Loop every 8 seconds.
Use that unit group/loop
Check if your hero is alive
Use Unit Group - Pick Every units in range...
Check if unit is not an enemy, nor a structure, and isn't dead.
Heal them and add some special effects.


You should consider removing leaks from your spell. For now, it leaks unit groups, special effects, points.
 
Level 2
Joined
Dec 24, 2016
Messages
15
Every time a hero learns that spell, you add them to a specific unit group or a loop. With that, you check the units around those heroes, and heal them. So it would be something like this:

Trigger A:
A unit learns a spell, add them to a group/loop

Trigger B:
Loop every 8 seconds.
Use that unit group/loop
Check if your hero is alive
Use Unit Group - Pick Every units in range...
Check if unit is not an enemy, nor a structure, and isn't dead.
Heal them and add some special effects.


You should consider removing leaks from your spell. For now, it leaks unit groups, special effects, points.
Thanks ! That is a very useful hint, i will considered about doing it. But how ?
 
Level 13
Joined
May 10, 2009
Messages
868
All right.

Please, give better names to those variables as the current ones are very generic. It's better to avoid problems related to variable names in your map - That Includes trigger names too.

  • Aura Initialization
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- Since the following variables have a constant value, you need to run them only once. --------
      • -------- - --------
      • -------- Level 1 --------
      • Set Aura_AoE[1] = 800.00
      • Set Aura_HP_Amount[1] = 11.00
      • Set Aura_MP_Amount[1] = 7.00
      • -------- Level 2 --------
      • Set Aura_AoE[2] = 840.00
      • Set Aura_HP_Amount[2] = 16.00
      • Set Aura_MP_Amount[2] = 14.00
      • -------- Level 3 --------
      • Set Aura_AoE[3] = 880.00
      • Set Aura_HP_Amount[3] = 24.00
      • Set Aura_MP_Amount[3] = 23.00
      • -------- Level 4 --------
      • Set Aura_AoE[4] = 920.00
      • Set Aura_HP_Amount[4] = 32.00
      • Set Aura_MP_Amount[4] = 35.00
      • -------- Special Effect --------
      • Set Aura_SFX_Attach = origin
      • Set Aura_SFX_Path = Abilities\Spells\Undead\VampiricAura\VampiricAuraTarget.mdl
      • -------- Note that I'm not using the previous special effect that you used in your triggers, because it requires some duration in order to be displayed (create special effect, wait, then remove it).
  • Aura Learn
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Aura
      • (Level of Aura for (Triggering unit)) Equal to 1
    • Actions
      • -------- Only register a unit here when it's its first time assigning points to this ability. Otherwise, you'd be adding it multiple times to the loop, which would also stack the amount of regeneration given other units nearby, and itself too. --------
      • Set Aura_Source[Aura_SourceCount] = (Triggering unit)
      • Set Aura_SourceCount = (Aura_SourceCount + 1)
  • Aura Loop
    • Events
      • Time - Every 8.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Aura_Loop) from 0 to (Aura_SourceCount - 1), do (Actions)
        • Loop - Actions
          • -------- We should only consider healing units whenever the owner of ability is alive. We don't want a dead hero healing units nearby. Do we? --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Aura_Source[Aura_Loop] is dead) Equal to False
            • Then - Actions
              • Set tmp_int = (Level of Aura for Aura_Source[Aura_Loop])
              • Set tpoint = (Position of Aura_Source[Aura_Loop])
              • -------- The loop above only gives us the heroes that possess the healing aura ability. Now, we need to check for units around them, and apply your desired effects. (this sounds weird) --------
              • Custom script: set bj_wantDestroyGroup = true
              • -------- The custom script above makes sure the following Unit Group be removed as soon as it finishes enumerating all nearby units. --------
              • Unit Group - Pick every unit in (Units within Aura_AoE[tmp_int] of tpoint) and do (Actions)
                • Loop - Actions
                  • Set tmp_unit = (Picked unit)
                  • -------- Select below the allowed units that are going to be healed by this spell. --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (tmp_unit is dead) Equal to False
                      • (tmp_unit is A structure) Equal to False
                      • (tmp_unit belongs to an ally of (Owner of Aura_Source[Aura_Loop])) Equal to True
                    • Then - Actions
                      • -------- Currently, only units considered as "Alive", "Not a Structure", and "Ally" can be healed by the ability. --------
                      • Unit - Set life of tmp_unit to ((Life of tmp_unit) + Aura_HP_Amount[tmp_int])
                      • Unit - Set mana of tmp_unit to ((Mana of tmp_unit) + Aura_MP_Amount[tmp_int])
                      • Special Effect - Create a special effect attached to the Aura_SFX_Attach of tmp_unit using Aura_SFX_Path
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
              • -------- We need to remove the point stored in the variable "tpoint", because we don't need it anymore. If we don't do that, it's going to take some memory ram and won't release it until you close the game, which is not good. The same goes for the special effect above --------
              • Custom script: call RemoveLocation(udg_tpoint)
            • Else - Actions
              • -------- Leave this field empty as you don't need to do anything to dead heroes. (Yeah, "Do Nothing" function does its name perfectly - Avoid it.) --------

EDIT:
Just attach the map for him, would save him a lot of time and trouble.

Indeed. I completely forgot the existence of that thing when I wrote this comment.

OFF: Your signature tricked me.
 

Attachments

  • Aura.w3x
    19.8 KB · Views: 38
Last edited:
Status
Not open for further replies.
Top