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

Cloud Spiral V2.4 [MUI][Unit Indexer]

  • Like
Reactions: D074M4N
Cloud Spiral - A Spell Template for those new to GUI

Spins cloud around the caster, damaging all units within area of the clouds.

75 Damage,
Each Level adds +1.70 seconds to duration.

  • Unit Indexer
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: call ExecuteFunc("InitializeUnitIndexer")
      • Custom script: endfunction
      • -------- --------
      • -------- This is the most important function - it provides an index for units as they enter the map --------
      • -------- --------
      • Custom script: function IndexUnit takes nothing returns boolean
      • -------- --------
      • -------- You can use the boolean UnitIndexerEnabled to protect some of your undesirable units from being indexed --------
      • -------- Example: --------
      • -------- Set UnitIndexerEnabled = False --------
      • -------- Unit - Create 1 Dummy for (Triggering player) at TempLoc facing 0.00 degrees --------
      • -------- Set UnitIndexerEnabled = True --------
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitIndexerEnabled Equal to True
        • Then - Actions
          • -------- --------
          • -------- Generate a unique integer index for this unit --------
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UDexRecycle Equal to 0
            • Then - Actions
              • Set UDex = (UDexGen + 1)
              • Set UDexGen = UDex
            • Else - Actions
              • Set UDex = UDexRecycle
              • Set UDexRecycle = UDexNext[UDex]
          • -------- --------
          • -------- Link index to unit, unit to index --------
          • -------- --------
          • Set UDexUnits[UDex] = (Matching unit)
          • Unit - Set the custom value of UDexUnits[UDex] to UDex
          • -------- --------
          • -------- Use a doubly-linked list to store all active indexes --------
          • -------- --------
          • Set UDexPrev[UDexNext[0]] = UDex
          • Set UDexNext[UDex] = UDexNext[0]
          • Set UDexNext[0] = UDex
          • -------- --------
          • -------- Fire index event for UDex --------
          • -------- --------
          • Set UnitIndexEvent = 1.00
          • Set UnitIndexEvent = 0.00
        • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • -------- --------
      • -------- The next function is called each time a unit enters the map --------
      • -------- --------
      • Custom script: function IndexNewUnit takes nothing returns boolean
      • Custom script: local integer pdex
      • Custom script: local integer ndex
      • -------- --------
      • -------- Process to give each unit a custom value for use as array indices --------
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UDexWasted Equal to 15
        • Then - Actions
          • -------- --------
          • -------- Deindex all potentially-removed units for every (15) units created --------
          • -------- --------
          • Custom script: set pdex = udg_UDex
          • Set UDex = UDexNext[0]
          • Custom script: loop
          • Custom script: exitwhen udg_UDex == 0
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of UDexUnits[UDex]) Equal to 0
            • Then - Actions
              • -------- --------
              • -------- Fire deindex event for UDex --------
              • -------- --------
              • Set UnitIndexEvent = 2.00
              • Set UnitIndexEvent = 0.00
              • -------- --------
              • -------- Remove index from linked list --------
              • -------- --------
              • Custom script: set ndex = udg_UDexNext[udg_UDex]
              • Custom script: set udg_UDexNext[udg_UDexPrev[udg_UDex]] = ndex
              • Custom script: set udg_UDexPrev[ndex] = udg_UDexPrev[udg_UDex]
              • Set UDexPrev[UDex] = 0
              • -------- --------
              • -------- Prepare index to be recycled --------
              • -------- --------
              • Set UDexUnits[UDex] = No unit
              • Set UDexNext[UDex] = UDexRecycle
              • Set UDexRecycle = UDex
              • Custom script: set udg_UDex = ndex
            • Else - Actions
              • Set UDex = UDexNext[UDex]
          • Custom script: endloop
          • Custom script: set udg_UDex = pdex
          • Set UDexWasted = 0
        • Else - Actions
          • Set UDexWasted = (UDexWasted + 1)
      • -------- --------
      • -------- Handle the entering unit (Matching unit) --------
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Custom value of (Matching unit)) Equal to 0
        • Then - Actions
          • Custom script: call IndexUnit()
        • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • -------- --------
      • -------- The next function initializes the core of the system --------
      • -------- --------
      • Custom script: function InitializeUnitIndexer takes nothing returns nothing
      • Custom script: local integer i = 0
      • Custom script: local region re = CreateRegion()
      • Custom script: local rect r = GetWorldBounds()
      • Set UnitIndexerEnabled = True
      • Custom script: call RegionAddRect(re, r)
      • Custom script: call TriggerRegisterEnterRegion(CreateTrigger(), re, Filter(function IndexNewUnit))
      • Custom script: call RemoveRect(r)
      • Custom script: set re = null
      • Custom script: set r = null
      • Custom script: loop
      • Custom script: call GroupEnumUnitsOfPlayer(bj_lastCreatedGroup, Player(i), Filter(function IndexUnit))
      • Custom script: set i = i + 1
      • Custom script: exitwhen i == 16
      • Custom script: endloop
      • -------- --------
      • -------- This is the "Unit Indexer Initialized" event --------
      • -------- --------
      • Set UnitIndexEvent = 3.00
      • Set UnitIndexEvent = 0.00
  • Cloud Spiral Int
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Cloudspiral
    • Actions
      • -------- --------
      • -------- VARIABLE START --------
      • Set Key = (Custom value of (Triggering unit))
      • Set SpellIndex = (SpellIndex + 1)
      • Set Caster[Key] = (Triggering unit)
      • Set SpellPower[Key] = (Level of Cloudspiral for Caster[Key])
      • Set Damage[Key] = 75.00
      • Set TimeInterval[Key] = 0.00
      • Set TimeCompletion[Key] = ((Real(SpellPower[Key])) x 1.20)
      • Set SpellRan[Key] = True
      • Set Distance[Key] = 0.00
      • Set Angle[Key] = 0.00
      • Unit Group - Add Caster[Key] to SpellGroup
      • Trigger - Turn on Cloud Spiral loop <gen>
      • -------- --------
      • -------- VARIABLE FINISH --------
  • Cloud Spiral loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CS_SpellGroup and do (Actions)
        • Loop - Actions
          • Set TempKey = (Custom value of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (CS_Caster[TempKey] is dead) Equal to True
                  • (CS_Caster[TempKey] has buff Stunned (Pause)) Equal to True
                  • CS_TimeInterval[TempKey] Greater than or equal to CS_TimeCompletion[TempKey]
            • Then - Actions
              • Set CS_SpellRan[TempKey] = False
              • Unit Group - Remove CS_Caster[TempKey] from CS_SpellGroup
              • Set CS_SpellIndex = (CS_SpellIndex - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CS_SpellIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
              • -------- --------
              • Set CS_TimeInterval[TempKey] = (CS_TimeInterval[TempKey] + 0.03)
              • Set CS_Distance[TempKey] = (CS_Distance[TempKey] + 2.50)
              • Set CS_Angle[TempKey] = (CS_Angle[TempKey] + 11.25)
              • Set TempPoint = (Position of CS_Caster[TempKey])
              • Set TempPoint2 = (TempPoint offset by CS_Distance[TempKey] towards CS_Angle[TempKey] degrees)
              • -------- --------
              • Set UnitIndexerEnabled = False
              • Unit - Create 1 CS_DummyCloud for (Owner of CS_Caster[TempKey]) at TempPoint2 facing Default building facing degrees
              • Set UnitIndexerEnabled = True
              • Unit - Add a CS_TimeCompletion[TempKey] second Generic expiration timer to (Last created unit)
              • Set TempGroup = (Units within 50.00 of TempPoint2 matching (((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is dead) Not equal to True)) and (((Matching unit) belongs to an ally of (Owner of CS_Caster[TempKey])) Not equal to True)))
              • Unit Group - Pick every unit in TempGroup and do (Actions)
                • Loop - Actions
                  • Unit - Cause CS_Caster[TempKey] to damage (Picked unit), dealing CS_Damage[TempKey] damage of attack type Spells and damage type Normal
              • -------- --------
              • Custom script: call RemoveLocation(udg_TempPoint)
              • Custom script: call RemoveLocation(udg_TempPoint2)
              • Custom script: call DestroyGroup(udg_TempGroup)
  • Preload Spell
    • Events
      • Game - UnitIndexEvent becomes Equal to 3.00
    • Conditions
    • Actions
      • Set UnitIndexerEnabled = False
      • Set TempPoint = (Center of (Playable map area))
      • Unit - Create 1 CS_DummyCloud for (Owner of CS_Caster[TempKey]) at TempPoint2 facing Default building facing degrees
      • Set TempUnit = (Last created unit)
      • -------- --------
      • -------- To preload abilities and/or buffs, just add them to TempUnit --------
      • -------- --------
      • Unit - Add Cloudspiral to TempUnit
      • -------- --------
      • -------- The dummy unit's task is now done, it can be removed from the game --------
      • -------- --------
      • Unit - Remove TempUnit from the game
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Set UnitIndexerEnabled = True
Credits

Credits to Bribe for his Unit Indexer Which allows the use of Indexing for units in GUI; for those just getting use to GUI.
Instructions on how to move into your map :

This spell uses a Unit indexing system, (not created by me)
1. Copy Custom Map script, Top part of triggers
2. Copy Unit Indexer (gen)
3. Copy Abilitiy (Cloudspin) and Unit (Cloudspin Dummy)
4. Copy Cloud Spin int and Cloud Spin loop (gen) and Preload Spell <gen>


Minor change to layout of triggers, so that spell shall stop if caster is dead or stunned.
Added Integer, to detect when no spells are running to turn off the trigger.
Changed back to TempPoint and TempPoint2,
Removed CS_CasterPoint. Fixed minor bugs.
Changed the hotkey,
Fixed the same trigger (changed loop order)
Increased Duration of spell to 1.7 with a increase of 1.7.
Changed the hotkey... again
Added new Unit Indexer.
Fixed the Cant Raise Does Not Decay for Dummy
- Made it so the CloudSpin Dummy units do not get a customvalue, this will cut down on the increase of customvalue.
Added new Trigger "Preload Spell"
Keywords:
cloud, spin, spell, damage, time, loop, spiral, unit, enemy, mui, gui, triggers,
Contents

Cloudspin V2.4 (Map)

Reviews
Approved. Could be useful ability in custom maps.

Moderator

M

Moderator

Maker, 3rd Aug 2011, Cloud Spiral V2.2

Approved. Could be useful ability in custom maps.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240

*The first level AoE is really small, I was standing right next to a spider and the spell didn't damage it.
*Remove invulnerability from the dummy, it has Locus which makes it invulnerable.
*Set dummy to Can't raise, does not decay. That way it gets removed from the game sooner.
*Reduce the sight range of dummies.
*Do SpellIndex Equal to 0 check only after you subtract from SpellIndex, not during every loop
*Filter out dead units in the unit group pick.
*Uinits with locust do not have collision, you don't need to turn it off.
*Change the variable names, they are too generic. Give them CS prefix for example.
 

*The first level AoE is really small, I was standing right next to a spider and the spell didn't damage it.
*Remove invulnerability from the dummy, it has Locus which makes it invulnerable.
*Set dummy to Can't raise, does not decay. That way it gets removed from the game sooner.
*Reduce the sight range of dummies.
*Do SpellIndex Equal to 0 check only after you subtract from SpellIndex, not during every loop
*Filter out dead units in the unit group pick.
*Uinits with locust do not have collision, you don't need to turn it off.
*Change the variable names, they are too generic. Give them CS prefix for example.

Thankyou for your feedback,
i have jsut updated all that you have suggested, tell me if any other "Simple errors" remain that i did not spot.
 
Use the update button instead of deleting the spell everytime and uploading a new one. Yes the update button does work, click refresh after you update to see the changes, THW is weird like that, were it won't update a page with new information until it gets refreshed.

I know just sometimes i upload, and refresh and the changes are still not made. Only done it too me once so far...
Anyways, any feedback on the spell?
 
Level 7
Joined
Feb 14, 2011
Messages
101
Why I think CS_CasterPoint[Key] is referring to Center of (Playable map area) ???
When I use this spell, the spiral is made at Center of (Playable map area)!!! Can u fix this plz???
I have replaced the function:
  • Set TempPoint = (CS_CasterPoint[TempKey] offset by CS_Distance[TempKey] towards CS_Angle[TempKey] degrees)
with:
  • Set TempPoint = ((Position of CS_Caster[Key]) offset by CS_Distance[TempKey] towards CS_Angle[TempKey] degrees)
and it succeeded. That's maybe because you have set 'CS_CasterPoint[Key]' then used 'CS_CasterPoint[TempKey]'
You didn't remove 'CS_CasterPoint[Key]'

You didn't set 'CS_CasterPoint[TempKey]' to use

Maybe if you put this function in Cloud Spiral Loop:
  • Set CS_CasterPoint[TempKey] = (Position of CS_Caster[Key])
That will fix the problem.
Don't forget removing locations...

Anyway, it's nice spell!
 
Why I think CS_CasterPoint[Key] is referring to Center of (Playable map area) ???
When I use this spell, the spiral is made at Center of (Playable map area)!!! Can u fix this plz???
I have replaced the function:
  • Set TempPoint = (CS_CasterPoint[TempKey] offset by CS_Distance[TempKey] towards CS_Angle[TempKey] degrees)
with:
  • Set TempPoint = ((Position of CS_Caster[Key]) offset by CS_Distance[TempKey] towards CS_Angle[TempKey] degrees)
and it succeeded. That's maybe because you have set 'CS_CasterPoint[Key]' then used 'CS_CasterPoint[TempKey]'
You didn't remove 'CS_CasterPoint[Key]'

You didn't set 'CS_CasterPoint[TempKey]' to use

Maybe if you put this function in Cloud Spiral Loop:
  • Set CS_CasterPoint[TempKey] = (Position of CS_Caster[Key])
That will fix the problem.
Don't forget removing locations...

Anyway, it's nice spell!

Thanks for the feedback,
i have completely removed, CasterPoint. And just added TempPoints.
So that it will be easy to remove the locations without any leaks.
 
The updated Unit Indexer is much easier to install if you'd prefer the easiest setup possible. It doesn't require the map header script any more and would encourage more downloads for the spells that use it.

Thanks for that,
Updated the spell to use the newly updated Indexer.
Will possibly make different systems/spells using your system to advertise it.
 
Top