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

[GUI] Sanctuary v1.0c

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
A simple spell I made using Bribe's GUI Unit Indexer.

Requires:
- GUI Unit Indexer

5y95ae.png




  • Sanctuary Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set SancSFX[1] = Abilities\Spells\NightElf\MoonWell\MoonWellCasterArt.mdl
      • Set SancSFX[2] = Abilities\Spells\Undead\DeathandDecay\DeathandDecayDamage.mdl


  • Sanctuary
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sanctuary
    • Actions
      • Set TempPoint = (Target point of ability being cast)
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at TempPoint facing (Random angle) degrees
      • Set ID = (Custom value of (Last created unit))
      • Set SancDummy[ID] = (Last created unit)
      • Set SancCaster[ID] = (Triggering unit)
      • Set SancPoint[ID] = (Position of SancDummy[ID])
      • Set SancLevel[ID] = (Level of Sanctuary for SancCaster[ID])
      • Set SancAOE[ID] = 350.00
      • Set SancDuration[ID] = (7.00 + (2.00 x (Real(SancLevel[ID]))))
      • Set SancVis[ID] = 100.00
      • Animation - Change SancDummy[ID]'s vertex coloring to (100.00%, 100.00%, 100.00%) with SancVis[ID]% transparency
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (SancReferenceGroup is empty) Equal to True
        • Then - Actions
          • Trigger - Turn on Sanctuary Loop <gen>
        • Else - Actions
      • Unit Group - Add SancDummy[ID] to SancReferenceGroup
      • Unit - Add a SancDuration[ID] second Generic expiration timer to SancDummy[ID]
      • Custom script: call RemoveLocation( udg_TempPoint )


  • Sanctuary Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in SancReferenceGroup and do (Actions)
        • Loop - Actions
          • Set ID = (Custom value of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (SancDummy[ID] is alive) Equal to True
            • Then - Actions
              • Set SancVis[ID] = (SancVis[ID] - 2.00)
              • Animation - Change SancDummy[ID]'s vertex coloring to (100.00%, 100.00%, 100.00%) with SancVis[ID]% transparency
              • Set TempGroup = (Units within SancAOE[ID] of SancPoint[ID] matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is dead) Equal to False)) and ((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) is Mechanical) Equal to False
              • Unit Group - Pick every unit in TempGroup and do (Actions)
                • Loop - Actions
                  • Set SancDamage[ID] = (((2.00 x (Real(SancLevel[ID]))) + (((Max life of (Picked unit)) x (0.70 + (0.20 x (Real(SancLevel[ID]))))) / 100.00)) x 0.03)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) belongs to an ally of (Owner of SancCaster[ID])) Equal to True
                      • (Percentage life of (Picked unit)) Less than 100.00
                    • Then - Actions
                      • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + SancDamage[ID])
                      • Special Effect - Create a special effect attached to the chest of (Picked unit) using SancSFX[1]
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked unit) is Undead) Equal to True
                        • Then - Actions
                          • Unit - Cause SancCaster[ID] to damage (Picked unit), dealing SancDamage[ID] damage of attack type Spells and damage type Normal
                          • Special Effect - Create a special effect attached to the overhead of (Picked unit) using SancSFX[2]
                          • Special Effect - Destroy (Last created special effect)
                        • Else - Actions
              • Custom script: call DestroyGroup( udg_TempGroup )
            • Else - Actions
              • Unit Group - Remove SancDummy[ID] from SancReferenceGroup
              • Custom script: call RemoveLocation( udg_SancPoint[udg_ID] )
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (SancReferenceGroup is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions






10/10/11 - Improved trigger as suggested. Changed the method of handling duration. Spell should be MUI now.


09/10/11 - Improved trigger as suggested. Modified spell slightly. Added variable for special effects.


08/10/11 - Minor code improvement.


08/10/11 - Spell released.



Special thanks to:
- Bribe for his GUI Unit Indexer


Keywords:
sanctuary, heal, damage, undead, unit, indexer
Contents

Sanctuary v1.0c (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. The spell is quite simple, maybe you could make it more original. The dummy doesn't need invulnerability, locust makes it invunlerable. SancLevel should be stored as a real, since...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

Maker, Sanctuary 1.0c, 17th Oct 2011

The spell is quite simple, maybe you could make it more original.

The dummy doesn't need invulnerability, locust makes it invunlerable.
SancLevel should be stored as a real, since you're not using it as an integer.
Try to calculate as much as you can outside the loop.
0.03 interval is too low for this.

Pharaoh_: Addressed a few points you should take care of.
 
Level 7
Joined
Jul 3, 2011
Messages
251
A rather simple spell but it works and i see no leaks. Good job.

However theese lines are not needed
  • Set SancEffect[ID2] = (Last created special effect)
  • Special Effect - Destroy SancEffect[ID2]
just use
  • Special Effect - Destroy Last Created Special Effect
 
SancDamage doesn't have to be an array variable.

Make the special effects' models configurable in the Map Initialization.

Don't use two unit groups for the enumerations, just use an if/then/else inside of them to check whether the (Picked unit) belongs to an ally; if it does, perform the X actions, else, perform the Y actions. Once again, they don't need to have an array installed.

The spell is too simple I'm afraid.
 
Level 7
Joined
Jul 3, 2011
Messages
251
You might want to try making a more advanced spell JsK, you know leak proofing and made this spell almost perfect for what it is supposed to do, this spell is just too simple to get approved though, and you wont really be able to improve it much more. Try a more complex spell.
 
You don't have to declare the strings'e effects every time the ability is cast. Move them to the Map Initialization so that they are loaded once.

Rename SancReal[] to SancDamage[].

You use TempPoint and SancPoint[]. The first one is not needed.

Set Art - Death time of your dummy unit to 0 and Combat - Death type to "Can't raise, does not decay".

Use a unit group to add units already affected by one instance, to prevent the spam of the special effect on them.

Check whether the allied units' life is not equal to the maximum life of the unit (or percentage life not equal to 100%), to prevent enumeration and effects' creation.

The spell is not 100% MUI. When you create two instances, the second one will expire before the first one. It replaces the duration with the first instance, runs it till the duration is over and then continues checking for the first one.
A simple display of SancDuration[ID] in the loop trigger can prove that.
 
Top