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

Troll Regeration

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: deepstrasz
Troll2.jpg

  • Set Hash
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set TrollRegeneration = (Last created hashtable)
      • -------- Out Of Combat Time --------
      • Hashtable - Save 5 as 0 of 0 in TrollRegeneration
      • -------- Regeneration Per Level --------
      • Hashtable - Save 5 as 0 of 1 in TrollRegeneration
      • -------- Ability --------
      • Set TrollRegenAbil = Troll Regeneration
  • Aquirement
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • ((Triggering unit) is in RegenGroup) Equal to (==) False
      • (Learned Hero Skill) Equal to (==) Troll Regeneration
    • Actions
      • Unit Group - Add (Triggering unit) to RegenGroup
  • Movement
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in RegenGroup and do (Actions)
        • Loop - Actions
          • Custom script: set udg_TempUnit = GetEnumUnit()
          • Custom script: set udg_TempReal = GetUnitX(udg_TempUnit)
          • Custom script: set udg_TempReal2 = GetUnitY(udg_TempUnit)
          • Set TempInteger = (Key (Picked unit))
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Load 0 of (Key (Picked unit)) from TrollRegeneration) Equal to (==) 0
              • Then - Actions
                • Hashtable - Save TempReal as 1 of TempInteger in TrollRegeneration
                • Hashtable - Save TempReal2 as 2 of TempInteger in TrollRegeneration
                • Hashtable - Save 1 as 0 of TempInteger in TrollRegeneration
              • Else - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • TempReal Equal to (==) (Load 1 of TempInteger from TrollRegeneration)
                    • TempReal2 Equal to (==) (Load 2 of (Key (Picked unit)) from TrollRegeneration)
                  • Then - Actions
                    • Hashtable - Save False as 3 of TempInteger in TrollRegeneration
                  • Else - Actions
                    • Hashtable - Save True as 3 of TempInteger in TrollRegeneration
                • Hashtable - Save TempReal as 1 of TempInteger in TrollRegeneration
                • Hashtable - Save TempReal2 as 2 of TempInteger in TrollRegeneration
  • Unit Death
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in TrollRegeneration
  • Damage Periodic
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in RegenGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in DamageGroup) Equal to False
            • Then - Actions
              • Unit Group - Add (Picked unit) to DamageGroup
              • Trigger - Add to InCombat <gen> the event (Unit - (Picked unit) Takes damage)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 4 of (Key (Picked unit)) from TrollRegeneration) Equal to True
              • (Level of TrollRegenAbil for (Picked unit)) Greater than 0
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load 5 of (Key (Picked unit)) from TrollRegeneration) Equal to 0
                • Then - Actions
                  • Hashtable - Save False as 4 of (Key (Picked unit)) in TrollRegeneration
                • Else - Actions
                  • Hashtable - Save ((Load 5 of (Key (Picked unit)) from TrollRegeneration) - 1) as 5 of (Key (Picked unit)) in TrollRegeneration
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is Stunned) Equal to False
              • ((Picked unit) is Snared) Equal to False
              • ((Picked unit) is Sleeping) Equal to False
              • ((Picked unit) is Polymorphed) Equal to False
              • (Load 3 of (Key (Picked unit)) from TrollRegeneration) Equal to False
              • (Load 4 of (Key (Picked unit)) from TrollRegeneration) Equal to False
              • (Level of TrollRegenAbil for (Picked unit)) Greater than 0
              • (Max life of (Picked unit)) Greater than (Life of (Picked unit))
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Items\AIil\AIilTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Real(((Load 0 of 1 from TrollRegeneration) x (Level of Troll Regeneration for (Picked unit))))))
            • Else - Actions
  • InCombat
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of TrollRegenAbil for (Triggering unit)) Greater than 0
        • Then - Actions
          • Set TempInteger = (Key (Triggering unit))
          • Hashtable - Save True as 4 of TempInteger in TrollRegeneration
          • Hashtable - Save (Load 0 of 0 from TrollRegeneration) as 5 of TempInteger in TrollRegeneration
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of TrollRegenAbil for (Damage source)) Greater than 0
        • Then - Actions
          • Set TempInteger = (Key (Damage source))
          • Hashtable - Save True as 4 of TempInteger in TrollRegeneration
          • Hashtable - Save (Load 0 of 0 from TrollRegeneration) as 5 of TempInteger in TrollRegeneration
        • Else - Actions
A fully MUI GUI custom spell. Brought to you by maddeem =)
Credits are not required when using this resource. (Feel free to edit it)

Keywords:
Troll, Regeneration, combat, movement, nature
Contents

Troll Reneration (Map)

Reviews
12th Dec 2015 IcemanBo: For too long time as NeedsFix. Rejected. Use variables, not hashtable: -------- Out Of Combat Time -------- Hashtable - Save 5 as 0 of 0 in TrollRegeneration -------- Regeneration Per Level...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: For too long time as NeedsFix. Rejected.

Maker, 16th Oct 2011, Troll Regeration

Use variables, not hashtable:
  • -------- Out Of Combat Time --------
  • Hashtable - Save 5 as 0 of 0 in TrollRegeneration
  • -------- Regeneration Per Level --------
  • Hashtable - Save 5 as 0 of 1 in TrollRegeneration
Movement and Damage periodic triggers should be initially off. And turned off when there are no alive units with the ability.
Forgot to use TempInteger:
  • (Load 0 of (Key (Picked unit)) from TrollRegeneration) Equal to (==) 0
  • TempReal2 Equal to (==) (Load 2 of (Key (Picked unit)) from TrollRegeneration)
Unit Death should be initially off.
Don't use set bj_wantDestroyGroup = true in Damage Periodic.
Don't do the event addition thing in Unit Death trigger.
Delete this : (Level of TrollRegenAbil for (Picked unit)) Greater than (>) 0
The other condition can't be true if the unit doesn't have the ability.
 
Here's a tip, for your movement trigger:

Create a unit variable called 'temp' and set in custom script to:
  • Custom script: set udg_temp = GetEnumUnit()
And use that variable instead of GetEnumUnit() for the 2 lines (GetUnitX/Y)

Also,
Create an integer variable and set it to:
  • Custom script: set udg_Integer = GetHandleId(udg_temp)
Then use that integer instead of using Key(Picked Unit) in the rest of the trigger.


In your DamagePeriodic trigger, instead of setting a group then enumerating and destroying it,
you shiould put this:
  • Custom script: set bj_wantDestroyGroup = true
Then, you'd "Pick every unit in (Entire Map) .....

This is for efficiency.

In your InCombat trigger, you should use a temp unit variable,
set it to (Damage Source),
use it as (Damage Source),
set it to (Triggering Unit),
use it as (Triggering Unit).

This means you should also change the order of the actions.

Also, in your DamagePeridic trigger, why are you adding all units in TempGroup to DamageGroup if they were supposed to be in DamageGroup initially to be in TempGroup?

Btw, how does this ability work?
It fires for all units on the map?
 
Also, in your DamagePeridic trigger, why are you adding all units in TempGroup to DamageGroup if they were supposed to be in DamageGroup initially to be in TempGroup?

Btw, how does this ability work?
It fires for all units on the map?

@Also, in your DamagePeridic trigger, why are you adding all units in TempGroup to DamageGroup if they were supposed to be in DamageGroup initially to be in TempGroup?
The temp group was checking to see if the unit is in damage group, if the unit is not it adds the unit to the damage unit group. (idk what you were thinking xD)

@Btw, how does this ability work?
It fires for all units on the map?
The ability works like this: If a unit with this spell is not moving or hasn't been attacked in the past 5 seconds, that unit has bonus regeneration. I thought something like this would be useful for an rpg. Hope that answered your second question.

I have updated it to your requests.
 
The temp group was checking to see if the unit is in damage group, if the unit is not it adds the unit to the damage unit group. (idk what you were thinking xD)

Yeah I just noticed that you used (Is In DamageGroup Equal to [highlight]False[/code]) :p

edit
For the second "Pick every unit .." in the Periodic trigger, you don't have to add that "Is In DamageGroup condition" because at that point, every unit in the map will be in the group :p
Same for the 3rd "Pick every unit.."
And in the third one, are you checking if the unit is alive? (I'm only reffering to the posted code as always :p)
 
"You're still doing a very inefficient unit detection. You loop from 1 to 12 and filter too many units.
Only use units that have the ability, don't detect them every 0.03 seconds. Create a group for them, never destroy the group."

I'll fix the amount of units it goes though. But as for not detecting them every .03 seconds, that could be bad an cause some issues. Since usual triggers (That move units) are in a 0.03 periodic event as well. If it is 0.06 then it could save the unit as not moving and a unit could regenerate in air. Which is not good. Of course, if you have any suggestions on how to fix such a problem please supply them.

Ok I fixed what you have required to be fixed.
 
Top