Drain v1.0

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Pretty groovy spell. Temporarily steals strength and deals damage, like the decay ability from DotA, all configurable and what not.

The interesting thing is that this works around saving over its own data by saving the handles to dummy units, so it doesn't end up "forgetting" a cast if you cast it again. If it was saved to the caster, it would write over itself with the handles and goof everything up.

  • Configurables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hashtable = (Last created hashtable)
      • -------- Variables --------
      • -------- Special Effect on point --------
      • Set Art = Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
      • -------- Special Effect on unit --------
      • Set TargetArt = Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
      • -------- Area Of Effect --------
      • -------- Make sure this corresponds with AoE in object editor --------
      • Set AreaOfEffect[1] = 300.00
      • Set AreaOfEffect[2] = 300.00
      • Set AreaOfEffect[3] = 300.00
      • -------- Duration --------
      • Set Duration[1] = 20.00
      • Set Duration[2] = 20.00
      • Set Duration[3] = 20.00
      • -------- Damage --------
      • -------- This is dealt to all to all units in the AoE --------
      • Set Damage[1] = 80.00
      • Set Damage[2] = 100.00
      • Set Damage[3] = 120.00
      • -------- Amount of Strength stolen --------
      • -------- Only applied to heroes --------
      • Set StrengthSapAmount[1] = 3
      • Set StrengthSapAmount[2] = 3
      • Set StrengthSapAmount[3] = 3
  • Drain
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Drain
    • Actions
      • Set Caster = (Triggering unit)
      • Set Level = (Level of Drain for Caster)
      • Set Point1 = (Target point of ability being cast)
      • Special Effect - Create a special effect at Point1 using Art
      • Special Effect - Destroy (Last created special effect)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within AreaOfEffect[Level] of Point1 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of Caster)) Equal to True)))) and do (Actions)
        • Loop - Actions
          • Set Target = (Picked unit)
          • Special Effect - Create a special effect attached to the origin of Target using TargetArt
          • Special Effect - Destroy (Last created special effect)
          • Unit - Cause Caster to damage Target, dealing Damage[Level] damage of attack type Spells and damage type Normal
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Target is A Hero) Equal to True
            • Then - Actions
              • Hero - Modify Strength of Caster: Add StrengthSapAmount[Level]
              • Hero - Modify Strength of Target: Subtract StrengthSapAmount[Level]
              • Unit - Create 1 Dummy for (Owner of Caster) at Point1 facing Default building facing degrees
              • Set Dummy = (Last created unit)
              • Unit Group - Add Dummy to DrainGroup
              • Custom script: set udg_Integer = GetHandleId(udg_Dummy)
              • Hashtable - Save Duration[Level] as 1 of Integer in Hashtable
              • Hashtable - Save Handle OfCaster as 2 of Integer in Hashtable
              • Hashtable - Save Handle OfTarget as 3 of Integer in Hashtable
              • Hashtable - Save Level as 4 of Integer in Hashtable
              • Trigger - Turn on Drain Loop <gen>
            • Else - Actions
      • Custom script: call RemoveLocation(udg_Point1)
  • Drain Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DrainGroup and do (Actions)
        • Loop - Actions
          • Set Dummy = (Picked unit)
          • Custom script: set udg_Integer = GetHandleId(udg_Dummy)
          • Set Real = (Load 1 of Integer from Hashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Real Greater than 0.00
            • Then - Actions
              • Hashtable - Save (Real - 1.00) as 1 of Integer in Hashtable
            • Else - Actions
              • Set Level = (Load 4 of Integer from Hashtable)
              • Hero - Modify Strength of (Load 2 of Integer in Hashtable): Subtract StrengthSapAmount[Level]
              • Hero - Modify Strength of (Load 3 of Integer in Hashtable): Add StrengthSapAmount[Level]
              • Unit Group - Remove Dummy from DrainGroup
              • Unit - Remove Dummy from the game
              • Hashtable - Clear all child hashtables of child Integer in Hashtable
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in DrainGroup) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
Keywords:
drain, decay, sap, swagger
Contents

Drain v1.0 (Map)

Reviews
08:13, 3rd Sep 2015 BPower: See what IcemanBo and I posted in the thread comments. The hashtable is not a good solution for this spell. it's too costly here.

Moderator

M

Moderator

08:13, 3rd Sep 2015
BPower:
See what IcemanBo and I posted in the thread comments.
The hashtable is not a good solution for this spell. it's too costly here.
 
Level 16
Joined
Apr 4, 2011
Messages
997
Pretty simple stuff, but I didn't see one like it :p

I have once again fallen prey to sinking all of my spare time into making a map, so yes I guess I am back. There might be some neat spells and maybe even a finished map one day, but I'll probably get lazy and give up like I usually do.

Neat.
 
Level 16
Joined
Apr 4, 2011
Messages
997
I feel like the name is misleading, I thought it was a drain system. Maybe "Stat Drain" would be a better name?

Useful spell.

The name isn't misleading in the least. You are draining stats from the hero. I think you are used to the word drain meaning "leeching life over time".

  • Trigger - Turn on Drain Loop <gen>
You forgot to put this on ITE

This is not supposed to be initially on in the editor. It is only on when it needs to be on. The loop only turns on if a hero is caught in the cast, which is the only time the loop needs to be on. It is more efficient that way.

Simple yet intuitive, nicely done.
Though I hate the Hashtable, it kinda cost for using a Hashtable (from 256 limit) just for a spell, but that's a preference.

Thank you. Unfortunately there is a hashtable limit, but I doubt anyone would hit it. Even so, it is pretty easy to merge multiple spells onto a single hashtable.
 
Level 19
Joined
Mar 18, 2012
Messages
1,717
You should use a variable for the spell id.

Please use a prefix for your variable, which should use between 2-3 characters.
This important in public resources to avoid code conflicts, when importing a spell.
Example: DR_Damage, DR_Duration, DR_Art ...

The way you handle MUI is simple, but not very efficient. Also it requires the use of an
hashtable. I would recommend a simple allocation module for this spell.
You can check out the dynamic indexing tutorial in my signature. ( by PurgeandFire )
It's a well illustrated tutorial and easy to understand.

Simple, but useful concept, but the spell requires some work before beeing approve-able.
I also have to scan our database, if an equal spell already exists there.
I can't check the testmap today. :/
 
Level 16
Joined
Apr 4, 2011
Messages
997
You should use a variable for the spell id.

Please use a prefix for your variable, which should use between 2-3 characters.
This important in public resources to avoid code conflicts, when importing a spell.
Example: DR_Damage, DR_Duration, DR_Art ...

The way you handle MUI is simple, but not very efficient. Also it requires the use of an
hashtable. I would recommend a simple allocation module for this spell.
You can check out the dynamic indexing tutorial in my signature. ( by PurgeandFire )
It's a well illustrated tutorial and easy to understand.

Simple, but useful concept, but the spell requires some work before beeing approve-able.
I also have to scan our database, if an equal spell already exists there.
I can't check the testmap today. :/

Hmmm are hashtables no longer an acceptable method for spells here? Or is it simply preferred to have everything on indexing?
 
Hashtables is a very powerful tool, but rarely really needed for simple things.
It won't have any benefits by using hashtable, but dynamic indexing will be faster.
We're not enemies of hashtable usage per se, but it has no bonus sometimes.
It may be more unreadable with all these save/load lines, as well, so might endup in a longer lookup.

- Make damage- and attacktype configurable.
- Add import instructions.

To this:
  • Trigger - Turn on Drain Loop <gen>
You forgot to put this on ITE
I think he meant that you should only turn it on when it's not turned on already.
 
Top