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

Nature Drain v1.1 [GUI][MUI]

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Descriptions:
------------------------Level Description--------------------------
Drain nearby trees life and convert to the nearby units,if the units is near the trees,each tree will deals damage and heal to nearby enemy units and allies units,sometimes,the tree will up its root and entangle an enemy,last 3 second.
181889-albums4279-picture49583.jpg

Level 1Level 2Level 3Level 4
[Each tree deals 15 damage and heal 15 hit points,10% chance to entangle.Each tree deals 30 damage and heal 30 hit points,20% chance to entangle.Each tree deals 45 damage and heal 45 hit points,30% chance to entangle.Each tree deals 60 damage and heal 60 hit points,40% chance to entangle.
[tr]

  • ND Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Nature Drain
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ND_IndexSize Equal to 0
        • Then - Actions
          • Trigger - Turn on ND Loop <gen>
        • Else - Actions
      • -------- Set index to make the spell into MUI --------
      • Set ND_IndexSize = (ND_IndexSize + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ND_IndexSize Greater than ND_IndexMaxSize
        • Then - Actions
          • Set ND_Index[ND_IndexSize] = ND_IndexSize
          • Set ND_IndexMaxSize = ND_IndexSize
        • Else - Actions
      • Set ND_TempInt = ND_Index[ND_IndexSize]
      • -------- Create Caster variable --------
      • Set ND_Caster[ND_TempInt] = (Triggering unit)
      • -------- Set the integer to 0,[make sure the the time will increase 1 every 1 second.(Inside the ND LOOP)] --------
      • Set ND_Countdown[ND_TempInt] = 0
      • -------- Set the position or location of the caster --------
      • Set ND_CasterPoint = (Position of ND_Caster[ND_TempInt])
      • -------- Set the boolean,to make sure can turn off the trigger completely. --------
      • Set ND_Boolean[ND_TempInt] = True
      • -------- Set the damage of the unit deals and drain. --------
      • Set ND_Drain[ND_TempInt] = (15.00 x (Real((Level of Nature Drain for ND_Caster[ND_TempInt]))))
      • -------- Set chance to entangle the enemies. --------
      • Set ND_Chance[ND_TempInt] = (10 x (Level of Nature Drain for ND_Caster[ND_TempInt]))
      • Set ND_RandomInteger[ND_TempInt] = (Random integer number between 1 and 100)
      • -------- Create a dummy for entangle enemies. --------
      • Unit - Create 1 Dummy(Can be use on many spells) for (Owner of ND_Caster[ND_TempInt]) at ND_CasterPoint facing Default building facing degrees
      • Set ND_Dummy[ND_TempInt] = (Last created unit)
      • -------- Add ability of entangle to the dummy --------
      • Unit - Add Entangle to ND_Dummy[ND_TempInt]
      • Unit - Set level of Entangle for ND_Dummy[ND_TempInt] to (Level of Nature Drain for ND_Caster[ND_TempInt])
      • Unit - Add a 6.10 second Generic expiration timer to ND_Dummy[ND_TempInt]
      • Custom script: call RemoveLocation(udg_ND_CasterPoint)
  • ND Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer ND_Loop) from 1 to ND_IndexSize, do (Actions)
        • Loop - Actions
          • Set ND_TempInt = ND_Index[ND_Loop]
          • -------- Set the integer less than 3,every 1 second increase 1 integer,total is 3 second to make the integer into 3,then can off the trigger. --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ND_Countdown[ND_TempInt] Less than or equal to 3
            • Then - Actions
              • -------- Increase the time count --------
              • Set ND_Countdown[ND_TempInt] = (ND_Countdown[ND_TempInt] + 1)
              • -------- Set the position of the caster --------
              • Set ND_CasterPoint = (Position of ND_Caster[ND_TempInt])
              • -------- You can change this into another special effect --------
              • Special Effect - Create a special effect at ND_CasterPoint using Abilities\Spells\NightElf\EntangleMine\Roots.mdl
              • Special Effect - Destroy (Last created special effect)
              • -------- Set every range of 400 trees within caster --------
              • Destructible - Pick every destructible within 400.00 of ND_CasterPoint and do (Actions)
                • Loop - Actions
                  • -------- The trees must alive then can drain hp --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked destructible) is alive) Equal to True
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Destructible-type of (Picked destructible)) Equal to Ashenvale Tree Wall
                          • (Destructible-type of (Picked destructible)) Equal to Ashenvale Canopy Tree
                    • Then - Actions
                      • -------- Set the position of the tree --------
                      • Set ND_TreePoint = (Position of (Picked destructible))
                      • -------- Decrease the hit point of the trees --------
                      • Destructible - Set life of (Picked destructible) to ((Current life of (Picked destructible)) - ND_Drain[ND_TempInt])
                      • -------- Destroy the group --------
                      • Custom script: set bj_wantDestroyGroup=true
                      • Unit Group - Pick every unit in (Units within 400.00 of ND_TreePoint matching ((((Matching unit) belongs to an ally of (Owner of ND_Caster[ND_TempInt])) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is Magic Immune) Not equal to True)))) and do (Actions)
                        • Loop - Actions
                          • -------- Increase life of the allies unit --------
                          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + ND_Drain[ND_TempInt])
                          • Unit - Set life of ND_Caster[ND_TempInt] to ((Life of ND_Caster[ND_TempInt]) + ND_Drain[ND_TempInt])
                          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
                          • Special Effect - Destroy (Last created special effect)
                      • Custom script: set bj_wantDestroyGroup=true
                      • Unit Group - Pick every unit in (Units within 400.00 of ND_TreePoint matching ((((Matching unit) belongs to an enemy of (Owner of ND_Caster[ND_TempInt])) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and (((Matching unit) is alive) Equal to True)))) and do (Actions)
                        • Loop - Actions
                          • -------- Decrease life of the enemies --------
                          • Unit - Cause ND_Caster[ND_TempInt] to damage (Picked unit), dealing ND_Drain[ND_TempInt] damage of attack type Spells and damage type Normal
                          • -------- 1 to 100 lesser than or equal than 10/20/30/40,mean the chance --------
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ND_RandomInteger[ND_TempInt] Less than or equal to ND_Chance[ND_TempInt]
                            • Then - Actions
                              • Unit - Order ND_Dummy[ND_TempInt] to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
                            • Else - 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)
                      • -------- Play animation to the trees --------
                      • Animation - Play (Picked destructible)'s stand hit animation
                      • Custom script: call RemoveLocation(udg_ND_TreePoint)
                    • Else - Actions
              • Custom script: call RemoveLocation(udg_ND_CasterPoint)
            • Else - Actions
              • -------- Set the boolean to false for make sure the trigger won't rework again. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ND_Boolean[ND_IndexLoop] Equal to True
                • Then - Actions
                  • Set ND_Boolean[ND_IndexLoop] = False
                  • Set ND_Index[ND_Loop] = ND_Index[ND_IndexSize]
                  • Set ND_Index[ND_IndexSize] = ND_TempInt
                  • Set ND_IndexSize = (ND_IndexSize - 1)
                  • Set ND_Loop = (ND_Loop - 1)
                • Else - Actions
      • -------- Off trigger --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ND_IndexSize Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
Questions?
You can leave a message and tell me the bugs :p
Changelogs
v1.1 : Changed the indexes into Dynamic system(Hanky thanks for u :p),decrease the time and nothings...
Keywords:
Nature,Trees,Life Drain,Drain,Life
Contents

Nature Drain v1.0 (Map)

Reviews
12th Dec 2015 IcemanBo: For too long time as NeedsFix. Rejected. Needs better tree detection. The indexes aren't resetting. Set the dummy to can't raise, doesn't decay.

Moderator

M

Moderator

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

Maker, 4th Aug 2011, Nature Drain v1.1

Needs better tree detection.
The indexes aren't resetting.
Set the dummy to can't raise, doesn't decay.
 
Level 12
Joined
Aug 12, 2008
Messages
349
1- You don't need to store it into a unit group variable and destroy it if you're using bj_wantDestroyGroup function.
2-
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
    • ND_Index Equal to 0
  • Then - Actions
    • Set ND_Index2 = 0
    • Trigger - Turn off (This trigger)
Check only this after you decrease the index which is right below this trigger
  • Set ND_Index = (ND_Index - 1)
  • Set ND_Index = (ND_Index - 1)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ND_Index Equal to 0
    • Then - Actions
      • Set ND_Index2 = 0
      • Trigger - Turn off (This trigger)
3- Change dummy death type to "Can't raise, Does not decay"
4- Turn off the collision for the dummy

Overall, I love the ideas and I quite like the effects (i've been searching for this! :p) :D

EDIT: I just realised the spell is not that efficient as it runs once every 2 seconds. The second caster need to wait for a short duration before the effect comes out after the first caster cast.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Many things mentioned already, although I'll add few things:
It's an old inefficient indexing system. Recycles indexes only when all instances have ended. Great here would be Hanky's dynamic indexing or Bride's Unit Indexer (woah Bribe :DDD I still can't stop having fun with it) - although if we stick to this one spell is done pretty nice.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Picked destructible) is dead) Equal to True
    • Then - Actions
      • Animation - Play (Picked destructible)'s death animation
Isn't that silly? If destructible dies, death animation if played automaticaly.

Posters above told you that after using 'bj_wantDestroyGroup = true' you do not need to set/destroy group manualy all long as group you are manipulating is needed only temporary. How it should look:
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every int in (Units within 400.00 of ND_TreePoint matching (((Matching unit) belongs to an enemy of (Owner of ND_Caster[ND_IndexLoop])) Equal to True))
    • Loop - Actions
For smooth looping you should change periodic, 2.00 seconds creates delay at cast-loop action what makes spell looks sometimes not naturaly. Let it be a period between 0.03 - 0.1.

You shouldn't do such functions:
  • Custom script: set bj_wantDestroyGroup=true
  • Unit Group - Pick every unit in ND_UnitGroup and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is alive) Equal to True
          • ((Picked unit) is A structure) Not equal to True
          • ((Picked unit) is Magic Immune) Not equal to True
I recommend setting the requirenets for matching unit in group creation and adding just one but very important condition - ((Picked unit) Not equal to No unit. Try:
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every int in (Units within 400.00 of ND_TreePoint matching ((((Matching unit) belongs to an enemy of (Owner of ND_Caster[ND_IndexLoop])) and (((Picked unit) is alive) Equal to True) and (((Picked unit) is A structure) Not equal to True) and (((Picked unit) is Magic Immune) Not equal to TrueEqual to True))))
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Picked unit) Not equal to No unit
        • Then - Actions

Last thing that I want you to notice is that spell features almost no configurables meaning user has to manipulate the whole trigger himself to customize it, rather than leaving core alone and changing just few variables at the begining of the code.
 
Top