• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Spell] Help to make a spell

Status
Not open for further replies.
Level 4
Joined
May 18, 2011
Messages
67
hello hive, i was just wondering is the ability DEVOTION of a Crusader/Paladin in Ragnarok possible in WC? if its so how thanks for the reply in advance....
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
hope this help.

Triggers
  • Damage Engine
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
      • Game - UnitIndexEvent becomes Equal to 2.00
    • Conditions
    • Actions
      • -------- Copy the Cheat Death Ability from Object Editor into your map and set the following variable respectively: --------
      • Set DamageBlockingAbility = Cheat Death Ability (+500,000)
      • -------- - --------
      • Set DamageTypeSpell = 1
      • Set DamageTypeDOT = 2
      • Set DamageTypeRanged = 3
      • -------- - --------
      • Custom script: call ExecuteFunc("InitDamageEvent")
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DmgEvFilter takes nothing returns boolean
      • -------- - --------
      • -------- The next conditions let you filter out unwanted units. By default, units with Locust will not pass the check. --------
      • -------- - --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TempUnit is A structure) Equal to False
        • Then - Actions
          • Custom script: return true
        • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DmgEvRemoveAbilities takes nothing returns nothing
      • Custom script: local real r
      • Custom script: loop
      • Set DmgEvN = (DmgEvN - 1)
      • Custom script: set r = GetWidgetLife(udg_DmgEvStack[udg_DmgEvN])
      • Unit - Remove DamageBlockingAbility from DmgEvStack[DmgEvN]
      • Custom script: call SetWidgetLife(udg_DmgEvStack[udg_DmgEvN], r)
      • Set DmgEvStack[DmgEvN] = No unit
      • Custom script: exitwhen udg_DmgEvN == 0
      • Custom script: endloop
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DmgEvSetVars takes nothing returns nothing
      • Set DamageEventAmount = (Damage taken)
      • Set DamageEventSource = (Damage source)
      • Set DamageEventTarget = (Triggering unit)
      • Custom script: endfunction
      • Custom script:
      • Custom script: function FireDmgEv takes nothing returns nothing
      • Custom script: local boolean b = GetUnitAbilityLevel(udg_DamageEventTarget, udg_DamageBlockingAbility) > 0
      • Custom script: local real life = 0
      • Custom script: local real pain = 0
      • Custom script: if b then
      • Custom script: set life = GetWidgetLife(udg_DamageEventTarget)
      • Unit - Remove DamageBlockingAbility from DamageEventTarget
      • Custom script: call SetWidgetLife(udg_DamageEventTarget, life)
      • Custom script: set pain = GetWidgetLife(udg_DamageEventTarget)
      • Custom script: endif
      • Set DamageEventPrevAmt = DamageEventAmount
      • Set DamageEventExplodesUnit = False
      • Set DamageEventOverride = False
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventAmount Equal to 0.00
        • Then - Actions
          • Set DamageEvent = 2.00
        • Else - Actions
          • Set DamageModifierEvent = 1.00
          • Set DamageEvent = 1.00
      • Custom script: if b then
      • Unit - Add DamageBlockingAbility to DamageEventTarget
      • Custom script: call SetWidgetLife(udg_DamageEventTarget, life + GetWidgetLife(udg_DamageEventTarget) - pain)
      • Custom script: endif
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventAmount Not equal to DamageEventPrevAmt
        • Then - Actions
          • Set DmgEvLife = ((Life of DamageEventTarget) + (DamageEventPrevAmt - DamageEventAmount))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DamageEventAmount Greater than DamageEventPrevAmt
            • Then - Actions
              • Unit - Set life of DamageEventTarget to (Max(0.41, DmgEvLife))
              • Custom script: if udg_DmgEvLife <= .405 then
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DamageEventExplodesUnit Equal to True
                • Then - Actions
                  • Unit - Make DamageEventTarget Explode on death
                • Else - Actions
              • Trigger - Turn off DamageEventTrigger
              • Custom script: call UnitDamageTarget(udg_DamageEventSource, udg_DamageEventTarget, 999, false, false, null, null, null)
              • Trigger - Turn on DamageEventTrigger
              • Custom script: endif
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Max life of DamageEventTarget) Less than DmgEvLife
                • Then - Actions
                  • Unit - Add DamageBlockingAbility to DamageEventTarget
                  • Set DmgEvStack[DmgEvN] = DamageEventTarget
                  • Set DmgEvN = (DmgEvN + 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DmgEvN Equal to 1
                    • Then - Actions
                      • Custom script: call TimerStart(udg_DmgEvTimer, 0, false, function DmgEvRemoveAbilities)
                    • Else - Actions
                • Else - Actions
              • Unit - Set life of DamageEventTarget to DmgEvLife
        • Else - Actions
      • Custom script: endfunction
      • Custom script:
      • Custom script: function FireRecursiveDmgEv takes nothing returns nothing
      • Custom script: local real d = udg_DamageEventAmount
      • Custom script: local unit s = udg_DamageEventSource
      • Custom script: local unit t = udg_DamageEventTarget
      • Custom script: local integer ptype = udg_DmgTypPrev
      • Custom script: local boolean explode = udg_DamageEventExplodesUnit
      • Custom script: local boolean override = udg_DamageEventOverride
      • Custom script: local real prev = udg_DamageEventPrevAmt
      • Custom script: call DmgEvSetVars()
      • Custom script: if udg_DamageEventTarget != t or udg_DamageEventSource != s or udg_DamageEventAmount != d or udg_DamageEventType != ptype then
      • Set DamageEvent = 0.00
      • Set DamageModifierEvent = 0.00
      • Custom script: call FireDmgEv()
      • -------- - --------
      • -------- Delete the next three lines to disable the in-game recursion crash warnings --------
      • -------- - --------
      • Custom script: else
      • Cinematic - Clear the screen of text messages for (All players)
      • Game - Display to (All players) for 999.00 seconds the text: WARNING: Recursion ...
      • -------- - --------
      • Custom script: endif
      • Custom script: set udg_DamageEventOverride = override
      • Custom script: set udg_DamageEventExplodesUnit = explode
      • Custom script: set udg_DamageEventPrevAmt = prev
      • Custom script: set udg_DmgTypPrev = ptype
      • Custom script: set udg_DamageEventAmount = d
      • Custom script: set udg_DamageEventSource = s
      • Custom script: set udg_DamageEventTarget = t
      • Custom script: set s = null
      • Custom script: set t = null
      • Custom script: endfunction
      • Custom script:
      • Custom script: function OnDmgEv takes nothing returns boolean
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEvent Equal to 0.00
        • Then - Actions
          • Set DmgTypPrev = DamageEventType
          • Custom script: call DmgEvSetVars()
          • Custom script: call FireDmgEv()
          • Set DamageModifierEvent = 0.00
          • Set DamageEvent = 0.00
          • Set DamageEventType = 0
        • Else - Actions
          • Custom script: call FireRecursiveDmgEv()
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function CreateDmgEv takes nothing returns nothing
      • Custom script: set udg_DamageEventTrigger = CreateTrigger()
      • Custom script: call TriggerAddCondition(udg_DamageEventTrigger, Filter(function OnDmgEv))
      • Custom script: endfunction
      • Custom script:
      • Custom script: function SetupDmgEv takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitIndexEvent Equal to 1.00
        • Then - Actions
          • Set TempUnit = UDexUnits[UDex]
          • Custom script: if GetUnitAbilityLevel(udg_TempUnit, 'Aloc') == 0 and DmgEvFilter() then
          • Set UnitDamageRegistered[UDex] = True
          • Trigger - Add to DamageEventTrigger the event (Unit - TempUnit Takes damage)
          • Custom script: endif
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UnitDamageRegistered[UDex] Equal to True
            • Then - Actions
              • Set UnitDamageRegistered[UDex] = False
              • Set DamageEventsWasted = (DamageEventsWasted + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DamageEventsWasted Equal to 15
                • Then - Actions
                  • Set DamageEventsWasted = 0
                  • Custom script: call DestroyTrigger(udg_DamageEventTrigger)
                  • Custom script: call CreateDmgEv()
                  • 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
                      • UnitDamageRegistered[UDex] Equal to True
                    • Then - Actions
                      • Trigger - Add to DamageEventTrigger the event (Unit - UDexUnits[UDex] Takes damage)
                    • Else - Actions
                  • Set UDex = UDexNext[UDex]
                  • Custom script: endloop
                  • Custom script: set udg_UDex = pdex
                • Else - Actions
            • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function InitDamageEvent takes nothing returns nothing
      • Custom script: call CreateDmgEv()
      • Custom script: call TriggerAddCondition(GetTriggeringTrigger(), Filter(function SetupDmgEv))
      • Set UnitIndexerEnabled = False
      • Custom script: set udg_TempUnit = CreateUnit(Player(15), 'uloc', 0, 0, 0)
      • Set UnitIndexerEnabled = True
      • Unit - Add DamageBlockingAbility to TempUnit
      • Unit - Remove TempUnit from the game
      • Countdown Timer - Start DmgEvTimer as a One-shot timer that will expire in 0.00 seconds
      • Trigger - Run (This trigger) (checking conditions)
  • Unit Indexer
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: call ExecuteFunc("InitializeUnitIndexer")
      • Custom script: endfunction
      • Custom script:
      • Custom script: function ClearUnitIndex takes nothing returns nothing
      • 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
          • Set UnitIndexLock[UDex] = (UnitIndexLock[UDex] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UnitIndexLock[UDex] Equal to 0
            • Then - Actions
              • Set UDexNext[UDexPrev[UDex]] = UDexNext[UDex]
              • Set UDexPrev[UDexNext[UDex]] = UDexPrev[UDex]
              • Set UDexPrev[UDex] = 0
              • Set UnitIndexEvent = 0.00
              • Set UnitIndexEvent = 2.00
              • Set UnitIndexEvent = 0.00
              • Set UDexUnits[UDex] = No unit
              • Set UDexNext[UDex] = UDexRecycle
              • Set UDexRecycle = UDex
            • Else - Actions
        • Else - Actions
      • Custom script: endfunction
      • Custom script:
      • Custom script: function IndexUnit takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • Custom script: local integer ndex
      • -------- - --------
      • -------- You can customize the following block - if conditions are false the (Matching unit) won't be indexed. --------
      • -------- - --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitIndexerEnabled Equal to True
          • (Custom value of (Matching unit)) Equal to 0
        • Then - Actions
          • Set UDexWasted = (UDexWasted + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UDexWasted Equal to 15
            • Then - Actions
              • Set UDexWasted = 0
              • Set UDex = UDexNext[0]
              • Custom script: loop
              • Custom script: exitwhen udg_UDex == 0
              • Custom script: set ndex = udg_UDexNext[udg_UDex]
              • Custom script: call ClearUnitIndex()
              • Custom script: set udg_UDex = ndex
              • Custom script: endloop
            • Else - Actions
          • 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]
          • Set UDexUnits[UDex] = (Matching unit)
          • Unit - Set the custom value of UDexUnits[UDex] to UDex
          • Set UDexPrev[UDexNext[0]] = UDex
          • Set UDexNext[UDex] = UDexNext[0]
          • Set UDexNext[0] = UDex
          • Set UnitIndexLock[UDex] = 1
          • Set UnitIndexEvent = 0.00
          • Set UnitIndexEvent = 1.00
          • Set UnitIndexEvent = 0.00
          • Custom script: set udg_UDex = pdex
        • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function InitializeUnitIndexer takes nothing returns nothing
      • Custom script: local integer i = 16
      • Custom script: local boolexpr b = Filter(function IndexUnit)
      • Custom script: local region re = CreateRegion()
      • Custom script: local trigger t = GetTriggeringTrigger()
      • Custom script: local rect r = GetWorldBounds()
      • Custom script: call RegionAddRect(re, r)
      • Custom script: call TriggerRegisterEnterRegion(t, re, b)
      • Custom script: call TriggerClearActions(t)
      • Custom script: call TriggerAddAction(t, function ClearUnitIndex)
      • Set UnitIndexerEnabled = True
      • Custom script: loop
      • Custom script: set i = i - 1
      • Custom script: call GroupEnumUnitsOfPlayer(bj_lastCreatedGroup, Player(i), b)
      • Custom script: exitwhen i == 0
      • Custom script: endloop
      • Custom script: call RemoveRect(r)
      • Custom script: set re = null
      • Custom script: set r = null
      • Custom script: set t = null
      • Custom script: set b = null
      • Set UnitIndexEvent = 3.00
      • Set UnitIndexEvent = 0.00
  • Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set hash = (Last created hashtable)
  • Devotion Init
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Devotion
    • Actions
      • Set tempPoint = (Position of (Triggering unit))
      • Set tempPoint2 = (Position of (Target unit of ability being cast))
      • Set DevotionDuration = 25.00
      • Set DevotionTarget = (Target unit of ability being cast)
      • Special Effect - Create a special effect attached to the overhead of (Target unit of ability being cast) using Abilities\Spells\Items\StaffOfSanctuary\Staff_Sanctuary_Target.mdl
      • Set DevotionEffect = (Last created special effect)
      • Lightning - Create a Spirit Link lightning effect from source tempPoint to target tempPoint2
      • Set DevotionLightning = (Last created lightning effect)
      • Unit - Create 1 Dummy (1) for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Hashtable - Save Handle OfDevotionLightning as 0 of (Key (Triggering unit)) in hash
      • Hashtable - Save Handle OfDevotionTarget as 1 of (Key (Triggering unit)) in hash
      • Hashtable - Save Handle OfDevotionEffect as 2 of (Key (Triggering unit)) in hash
      • Hashtable - Save DevotionDuration as 3 of (Key (Triggering unit)) in hash
      • Unit Group - Add (Triggering unit) to DevotionGroup
      • Set DevotionCount = (DevotionCount + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Devotion Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Devotion Loop <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Devotion Link <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Devotion Link <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Devotion Stop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Devotion Stop <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_tempPoint)
      • Custom script: call RemoveLocation(udg_tempPoint2)
  • Devotion Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DevotionGroup and do (Actions)
        • Loop - Actions
          • Set DevotionLightning = (Load 0 of (Key (Picked unit)) in hash)
          • Set DevotionTarget = (Load 1 of (Key (Picked unit)) in hash)
          • Set DevotionEffect = (Load 2 of (Key (Picked unit)) in hash)
          • Set DevotionDuration = (DevotionDuration - 0.03)
          • Set DevotionCasterPoint = (Position of (Picked unit))
          • Set DevotionTargetPoint = (Position of DevotionTarget)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (DevotionTarget is dead) Equal to False
            • Then - Actions
              • Lightning - Move DevotionLightning to source DevotionCasterPoint and target DevotionTargetPoint
            • Else - Actions
              • Lightning - Destroy DevotionLightning
              • Special Effect - Destroy DevotionEffect
              • Set DevotionCount = (DevotionCount - 1)
              • Unit Group - Remove (Picked unit) from DevotionGroup
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in hash
              • Custom script: call RemoveLocation(udg_DevotionCasterPoint)
              • Custom script: call RemoveLocation(udg_DevotionTargetPoint)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to False
            • Then - Actions
              • Lightning - Move DevotionLightning to source DevotionCasterPoint and target DevotionTargetPoint
            • Else - Actions
              • Lightning - Destroy DevotionLightning
              • Special Effect - Destroy DevotionEffect
              • Set DevotionCount = (DevotionCount - 1)
              • Unit Group - Remove (Picked unit) from DevotionGroup
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in hash
              • Custom script: call RemoveLocation(udg_DevotionCasterPoint)
              • Custom script: call RemoveLocation(udg_DevotionTargetPoint)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DevotionDuration Less than or equal to 0.00
            • Then - Actions
              • Lightning - Destroy DevotionLightning
              • Special Effect - Destroy DevotionEffect
              • Set DevotionCount = (DevotionCount - 1)
              • Unit Group - Remove (Picked unit) from DevotionGroup
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in hash
              • Custom script: call RemoveLocation(udg_DevotionCasterPoint)
              • Custom script: call RemoveLocation(udg_DevotionTargetPoint)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DevotionCount Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Trigger - Turn off Devotion Link <gen>
          • Trigger - Turn off Devotion Stop <gen>
        • Else - Actions
  • Devotion Link
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DevotionGroup and do (Actions)
        • Loop - Actions
          • Set DevotionTarget = (Load 1 of (Key (Picked unit)) in hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DamageEventTarget Equal to DevotionTarget
            • Then - Actions
              • Unit - Cause DamageEventSource to damage (Picked unit), dealing DamageEventAmount damage of attack type Spells and damage type Normal
              • Set DamageEventAmount = 0.00
            • Else - Actions
  • Devotion Stop
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Devotion
    • Actions
      • Unit Group - Pick every unit in DevotionGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to (Picked unit)
            • Then - Actions
              • Set DevotionLightning = (Load 0 of (Key (Picked unit)) in hash)
              • Set DevotionEffect = (Load 2 of (Key (Picked unit)) in hash)
              • Special Effect - Destroy DevotionEffect
              • Lightning - Destroy DevotionLightning
              • Unit Group - Remove (Picked unit) from DevotionGroup
              • Set DevotionCount = (DevotionCount - 1)
              • Trigger - Turn off Devotion Loop <gen>
              • Trigger - Turn off Devotion Link <gen>
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in hash
              • Custom script: call RemoveLocation(udg_DevotionCasterPoint)
              • Custom script: call RemoveLocation(udg_DevotionTargetPoint)
            • Else - Actions


You can configure :
- DevotionEffect (it's special effect, currently i put sanctuary)
- DevotionLightning (it's lightning, currently i put Spirit Link)
- DevotionDuration (how long the Devotion will last)
- I don't know, there isn't anything else to configure

Drawbacks (or should i call it a feature ?) :
- If you move, attack, stop, patrol, etc. this ability will also stop.
- When you cast this to a unit, and then cast this to another unit. the previous unit will not affected by Devotion anymore.

Things you should remember :
- Damage Engine (you already have it, so no need to import it anymore.
- Unit Indexer (the same ^)
- Hashtable (if in your map had already have a hashtable, no need to create a new one, just use the existing one [you just need ONE Hashtable for every spells and systems])
- I based the ability of Channel with Unit Target

sorry i can't make it configurable... i'm not a spell maker.

Test map :
 

Attachments

  • Devotion.w3x
    33.6 KB · Views: 38
Last edited:
Level 4
Joined
May 18, 2011
Messages
67
hope this help.

Triggers
  • Damage Engine
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
      • Game - UnitIndexEvent becomes Equal to 2.00
    • Conditions
    • Actions
      • -------- Copy the Cheat Death Ability from Object Editor into your map and set the following variable respectively: --------
      • Set DamageBlockingAbility = Cheat Death Ability (+500,000)
      • -------- - --------
      • Set DamageTypeSpell = 1
      • Set DamageTypeDOT = 2
      • Set DamageTypeRanged = 3
      • -------- - --------
      • Custom script: call ExecuteFunc("InitDamageEvent")
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DmgEvFilter takes nothing returns boolean
      • -------- - --------
      • -------- The next conditions let you filter out unwanted units. By default, units with Locust will not pass the check. --------
      • -------- - --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TempUnit is A structure) Equal to False
        • Then - Actions
          • Custom script: return true
        • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DmgEvRemoveAbilities takes nothing returns nothing
      • Custom script: local real r
      • Custom script: loop
      • Set DmgEvN = (DmgEvN - 1)
      • Custom script: set r = GetWidgetLife(udg_DmgEvStack[udg_DmgEvN])
      • Unit - Remove DamageBlockingAbility from DmgEvStack[DmgEvN]
      • Custom script: call SetWidgetLife(udg_DmgEvStack[udg_DmgEvN], r)
      • Set DmgEvStack[DmgEvN] = No unit
      • Custom script: exitwhen udg_DmgEvN == 0
      • Custom script: endloop
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DmgEvSetVars takes nothing returns nothing
      • Set DamageEventAmount = (Damage taken)
      • Set DamageEventSource = (Damage source)
      • Set DamageEventTarget = (Triggering unit)
      • Custom script: endfunction
      • Custom script:
      • Custom script: function FireDmgEv takes nothing returns nothing
      • Custom script: local boolean b = GetUnitAbilityLevel(udg_DamageEventTarget, udg_DamageBlockingAbility) > 0
      • Custom script: local real life = 0
      • Custom script: local real pain = 0
      • Custom script: if b then
      • Custom script: set life = GetWidgetLife(udg_DamageEventTarget)
      • Unit - Remove DamageBlockingAbility from DamageEventTarget
      • Custom script: call SetWidgetLife(udg_DamageEventTarget, life)
      • Custom script: set pain = GetWidgetLife(udg_DamageEventTarget)
      • Custom script: endif
      • Set DamageEventPrevAmt = DamageEventAmount
      • Set DamageEventExplodesUnit = False
      • Set DamageEventOverride = False
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventAmount Equal to 0.00
        • Then - Actions
          • Set DamageEvent = 2.00
        • Else - Actions
          • Set DamageModifierEvent = 1.00
          • Set DamageEvent = 1.00
      • Custom script: if b then
      • Unit - Add DamageBlockingAbility to DamageEventTarget
      • Custom script: call SetWidgetLife(udg_DamageEventTarget, life + GetWidgetLife(udg_DamageEventTarget) - pain)
      • Custom script: endif
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEventAmount Not equal to DamageEventPrevAmt
        • Then - Actions
          • Set DmgEvLife = ((Life of DamageEventTarget) + (DamageEventPrevAmt - DamageEventAmount))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DamageEventAmount Greater than DamageEventPrevAmt
            • Then - Actions
              • Unit - Set life of DamageEventTarget to (Max(0.41, DmgEvLife))
              • Custom script: if udg_DmgEvLife <= .405 then
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DamageEventExplodesUnit Equal to True
                • Then - Actions
                  • Unit - Make DamageEventTarget Explode on death
                • Else - Actions
              • Trigger - Turn off DamageEventTrigger
              • Custom script: call UnitDamageTarget(udg_DamageEventSource, udg_DamageEventTarget, 999, false, false, null, null, null)
              • Trigger - Turn on DamageEventTrigger
              • Custom script: endif
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Max life of DamageEventTarget) Less than DmgEvLife
                • Then - Actions
                  • Unit - Add DamageBlockingAbility to DamageEventTarget
                  • Set DmgEvStack[DmgEvN] = DamageEventTarget
                  • Set DmgEvN = (DmgEvN + 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DmgEvN Equal to 1
                    • Then - Actions
                      • Custom script: call TimerStart(udg_DmgEvTimer, 0, false, function DmgEvRemoveAbilities)
                    • Else - Actions
                • Else - Actions
              • Unit - Set life of DamageEventTarget to DmgEvLife
        • Else - Actions
      • Custom script: endfunction
      • Custom script:
      • Custom script: function FireRecursiveDmgEv takes nothing returns nothing
      • Custom script: local real d = udg_DamageEventAmount
      • Custom script: local unit s = udg_DamageEventSource
      • Custom script: local unit t = udg_DamageEventTarget
      • Custom script: local integer ptype = udg_DmgTypPrev
      • Custom script: local boolean explode = udg_DamageEventExplodesUnit
      • Custom script: local boolean override = udg_DamageEventOverride
      • Custom script: local real prev = udg_DamageEventPrevAmt
      • Custom script: call DmgEvSetVars()
      • Custom script: if udg_DamageEventTarget != t or udg_DamageEventSource != s or udg_DamageEventAmount != d or udg_DamageEventType != ptype then
      • Set DamageEvent = 0.00
      • Set DamageModifierEvent = 0.00
      • Custom script: call FireDmgEv()
      • -------- - --------
      • -------- Delete the next three lines to disable the in-game recursion crash warnings --------
      • -------- - --------
      • Custom script: else
      • Cinematic - Clear the screen of text messages for (All players)
      • Game - Display to (All players) for 999.00 seconds the text: WARNING: Recursion ...
      • -------- - --------
      • Custom script: endif
      • Custom script: set udg_DamageEventOverride = override
      • Custom script: set udg_DamageEventExplodesUnit = explode
      • Custom script: set udg_DamageEventPrevAmt = prev
      • Custom script: set udg_DmgTypPrev = ptype
      • Custom script: set udg_DamageEventAmount = d
      • Custom script: set udg_DamageEventSource = s
      • Custom script: set udg_DamageEventTarget = t
      • Custom script: set s = null
      • Custom script: set t = null
      • Custom script: endfunction
      • Custom script:
      • Custom script: function OnDmgEv takes nothing returns boolean
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DamageEvent Equal to 0.00
        • Then - Actions
          • Set DmgTypPrev = DamageEventType
          • Custom script: call DmgEvSetVars()
          • Custom script: call FireDmgEv()
          • Set DamageModifierEvent = 0.00
          • Set DamageEvent = 0.00
          • Set DamageEventType = 0
        • Else - Actions
          • Custom script: call FireRecursiveDmgEv()
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function CreateDmgEv takes nothing returns nothing
      • Custom script: set udg_DamageEventTrigger = CreateTrigger()
      • Custom script: call TriggerAddCondition(udg_DamageEventTrigger, Filter(function OnDmgEv))
      • Custom script: endfunction
      • Custom script:
      • Custom script: function SetupDmgEv takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitIndexEvent Equal to 1.00
        • Then - Actions
          • Set TempUnit = UDexUnits[UDex]
          • Custom script: if GetUnitAbilityLevel(udg_TempUnit, 'Aloc') == 0 and DmgEvFilter() then
          • Set UnitDamageRegistered[UDex] = True
          • Trigger - Add to DamageEventTrigger the event (Unit - TempUnit Takes damage)
          • Custom script: endif
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UnitDamageRegistered[UDex] Equal to True
            • Then - Actions
              • Set UnitDamageRegistered[UDex] = False
              • Set DamageEventsWasted = (DamageEventsWasted + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DamageEventsWasted Equal to 15
                • Then - Actions
                  • Set DamageEventsWasted = 0
                  • Custom script: call DestroyTrigger(udg_DamageEventTrigger)
                  • Custom script: call CreateDmgEv()
                  • 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
                      • UnitDamageRegistered[UDex] Equal to True
                    • Then - Actions
                      • Trigger - Add to DamageEventTrigger the event (Unit - UDexUnits[UDex] Takes damage)
                    • Else - Actions
                  • Set UDex = UDexNext[UDex]
                  • Custom script: endloop
                  • Custom script: set udg_UDex = pdex
                • Else - Actions
            • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function InitDamageEvent takes nothing returns nothing
      • Custom script: call CreateDmgEv()
      • Custom script: call TriggerAddCondition(GetTriggeringTrigger(), Filter(function SetupDmgEv))
      • Set UnitIndexerEnabled = False
      • Custom script: set udg_TempUnit = CreateUnit(Player(15), 'uloc', 0, 0, 0)
      • Set UnitIndexerEnabled = True
      • Unit - Add DamageBlockingAbility to TempUnit
      • Unit - Remove TempUnit from the game
      • Countdown Timer - Start DmgEvTimer as a One-shot timer that will expire in 0.00 seconds
      • Trigger - Run (This trigger) (checking conditions)
  • Unit Indexer
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: call ExecuteFunc("InitializeUnitIndexer")
      • Custom script: endfunction
      • Custom script:
      • Custom script: function ClearUnitIndex takes nothing returns nothing
      • 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
          • Set UnitIndexLock[UDex] = (UnitIndexLock[UDex] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UnitIndexLock[UDex] Equal to 0
            • Then - Actions
              • Set UDexNext[UDexPrev[UDex]] = UDexNext[UDex]
              • Set UDexPrev[UDexNext[UDex]] = UDexPrev[UDex]
              • Set UDexPrev[UDex] = 0
              • Set UnitIndexEvent = 0.00
              • Set UnitIndexEvent = 2.00
              • Set UnitIndexEvent = 0.00
              • Set UDexUnits[UDex] = No unit
              • Set UDexNext[UDex] = UDexRecycle
              • Set UDexRecycle = UDex
            • Else - Actions
        • Else - Actions
      • Custom script: endfunction
      • Custom script:
      • Custom script: function IndexUnit takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • Custom script: local integer ndex
      • -------- - --------
      • -------- You can customize the following block - if conditions are false the (Matching unit) won't be indexed. --------
      • -------- - --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitIndexerEnabled Equal to True
          • (Custom value of (Matching unit)) Equal to 0
        • Then - Actions
          • Set UDexWasted = (UDexWasted + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UDexWasted Equal to 15
            • Then - Actions
              • Set UDexWasted = 0
              • Set UDex = UDexNext[0]
              • Custom script: loop
              • Custom script: exitwhen udg_UDex == 0
              • Custom script: set ndex = udg_UDexNext[udg_UDex]
              • Custom script: call ClearUnitIndex()
              • Custom script: set udg_UDex = ndex
              • Custom script: endloop
            • Else - Actions
          • 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]
          • Set UDexUnits[UDex] = (Matching unit)
          • Unit - Set the custom value of UDexUnits[UDex] to UDex
          • Set UDexPrev[UDexNext[0]] = UDex
          • Set UDexNext[UDex] = UDexNext[0]
          • Set UDexNext[0] = UDex
          • Set UnitIndexLock[UDex] = 1
          • Set UnitIndexEvent = 0.00
          • Set UnitIndexEvent = 1.00
          • Set UnitIndexEvent = 0.00
          • Custom script: set udg_UDex = pdex
        • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function InitializeUnitIndexer takes nothing returns nothing
      • Custom script: local integer i = 16
      • Custom script: local boolexpr b = Filter(function IndexUnit)
      • Custom script: local region re = CreateRegion()
      • Custom script: local trigger t = GetTriggeringTrigger()
      • Custom script: local rect r = GetWorldBounds()
      • Custom script: call RegionAddRect(re, r)
      • Custom script: call TriggerRegisterEnterRegion(t, re, b)
      • Custom script: call TriggerClearActions(t)
      • Custom script: call TriggerAddAction(t, function ClearUnitIndex)
      • Set UnitIndexerEnabled = True
      • Custom script: loop
      • Custom script: set i = i - 1
      • Custom script: call GroupEnumUnitsOfPlayer(bj_lastCreatedGroup, Player(i), b)
      • Custom script: exitwhen i == 0
      • Custom script: endloop
      • Custom script: call RemoveRect(r)
      • Custom script: set re = null
      • Custom script: set r = null
      • Custom script: set t = null
      • Custom script: set b = null
      • Set UnitIndexEvent = 3.00
      • Set UnitIndexEvent = 0.00
  • Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set hash = (Last created hashtable)
  • Devotion Init
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Devotion
    • Actions
      • Set tempPoint = (Position of (Triggering unit))
      • Set tempPoint2 = (Position of (Target unit of ability being cast))
      • Set DevotionDuration = 25.00
      • Set DevotionTarget = (Target unit of ability being cast)
      • Special Effect - Create a special effect attached to the overhead of (Target unit of ability being cast) using Abilities\Spells\Items\StaffOfSanctuary\Staff_Sanctuary_Target.mdl
      • Set DevotionEffect = (Last created special effect)
      • Lightning - Create a Spirit Link lightning effect from source tempPoint to target tempPoint2
      • Set DevotionLightning = (Last created lightning effect)
      • Unit - Create 1 Dummy (1) for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Hashtable - Save Handle OfDevotionLightning as 0 of (Key (Triggering unit)) in hash
      • Hashtable - Save Handle OfDevotionTarget as 1 of (Key (Triggering unit)) in hash
      • Hashtable - Save Handle OfDevotionEffect as 2 of (Key (Triggering unit)) in hash
      • Hashtable - Save DevotionDuration as 3 of (Key (Triggering unit)) in hash
      • Unit Group - Add (Triggering unit) to DevotionGroup
      • Set DevotionCount = (DevotionCount + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Devotion Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Devotion Loop <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Devotion Link <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Devotion Link <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Devotion Stop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Devotion Stop <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_tempPoint)
      • Custom script: call RemoveLocation(udg_tempPoint2)
  • Devotion Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DevotionGroup and do (Actions)
        • Loop - Actions
          • Set DevotionLightning = (Load 0 of (Key (Picked unit)) in hash)
          • Set DevotionTarget = (Load 1 of (Key (Picked unit)) in hash)
          • Set DevotionEffect = (Load 2 of (Key (Picked unit)) in hash)
          • Set DevotionDuration = (DevotionDuration - 0.03)
          • Set DevotionCasterPoint = (Position of (Picked unit))
          • Set DevotionTargetPoint = (Position of DevotionTarget)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (DevotionTarget is dead) Equal to False
            • Then - Actions
              • Lightning - Move DevotionLightning to source DevotionCasterPoint and target DevotionTargetPoint
            • Else - Actions
              • Lightning - Destroy DevotionLightning
              • Special Effect - Destroy DevotionEffect
              • Set DevotionCount = (DevotionCount - 1)
              • Unit Group - Remove (Picked unit) from DevotionGroup
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in hash
              • Custom script: call RemoveLocation(udg_DevotionCasterPoint)
              • Custom script: call RemoveLocation(udg_DevotionTargetPoint)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to False
            • Then - Actions
              • Lightning - Move DevotionLightning to source DevotionCasterPoint and target DevotionTargetPoint
            • Else - Actions
              • Lightning - Destroy DevotionLightning
              • Special Effect - Destroy DevotionEffect
              • Set DevotionCount = (DevotionCount - 1)
              • Unit Group - Remove (Picked unit) from DevotionGroup
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in hash
              • Custom script: call RemoveLocation(udg_DevotionCasterPoint)
              • Custom script: call RemoveLocation(udg_DevotionTargetPoint)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DevotionDuration Less than or equal to 0.00
            • Then - Actions
              • Lightning - Destroy DevotionLightning
              • Special Effect - Destroy DevotionEffect
              • Set DevotionCount = (DevotionCount - 1)
              • Unit Group - Remove (Picked unit) from DevotionGroup
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in hash
              • Custom script: call RemoveLocation(udg_DevotionCasterPoint)
              • Custom script: call RemoveLocation(udg_DevotionTargetPoint)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DevotionCount Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Trigger - Turn off Devotion Link <gen>
          • Trigger - Turn off Devotion Stop <gen>
        • Else - Actions
  • Devotion Link
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DevotionGroup and do (Actions)
        • Loop - Actions
          • Set DevotionTarget = (Load 1 of (Key (Picked unit)) in hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DamageEventTarget Equal to DevotionTarget
            • Then - Actions
              • Unit - Cause DamageEventSource to damage (Picked unit), dealing DamageEventAmount damage of attack type Spells and damage type Normal
              • Set DamageEventAmount = 0.00
            • Else - Actions
  • Devotion Stop
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Devotion
    • Actions
      • Unit Group - Pick every unit in DevotionGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to (Picked unit)
            • Then - Actions
              • Set DevotionLightning = (Load 0 of (Key (Picked unit)) in hash)
              • Set DevotionEffect = (Load 2 of (Key (Picked unit)) in hash)
              • Special Effect - Destroy DevotionEffect
              • Lightning - Destroy DevotionLightning
              • Unit Group - Remove (Picked unit) from DevotionGroup
              • Set DevotionCount = (DevotionCount - 1)
              • Trigger - Turn off Devotion Loop <gen>
              • Trigger - Turn off Devotion Link <gen>
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in hash
              • Custom script: call RemoveLocation(udg_DevotionCasterPoint)
              • Custom script: call RemoveLocation(udg_DevotionTargetPoint)
            • Else - Actions


You can configure :
- DevotionEffect (it's special effect, currently i put sanctuary)
- DevotionLightning (it's lightning, currently i put Spirit Link)
- DevotionDuration (how long the Devotion will last)
- I don't know, there isn't anything else to configure

Drawbacks (or should i call it a feature ?) :
- If you move, attack, stop, patrol, etc. this ability will also stop.
- When you cast this to a unit, and then cast this to another unit. the previous unit will not affected by Devotion anymore.

Things you should remember :
- Damage Engine (you already have it, so no need to import it anymore.
- Unit Indexer (the same ^)
- Hashtable (if in your map had already have a hashtable, no need to create a new one, just use the existing one [you just need ONE Hashtable for every spell and system])
- I based the ability of Channel with Unit Target

sorry i can't make it configurable... i'm not a spell maker.

Test map :

actually its a new map that i'm making hahaha, thats why i ask for the heal count thingy you know what i mean sir, and i dont have the GDD and the unit indexer yet but ill just going to export it anyway, and thanks again sir, youre the one who helped me again... youre truly the man...
 
Level 4
Joined
May 18, 2011
Messages
67
did it work as you want ? or you want something to get changed ?

good luck
i'm looking forward for your project :)
happy mapping!

the only prob that i got is the motion problem, paladin/crusader can move even with devotion,... and the devotion will get cancelled if the link break allied who got devotion goes a certain distance
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
well, now you can :)

but a restriction that i must put is :
- The cooldown should be longer than the duration of Devotion :)

why i put a restriction ?
because if the cooldown is shorter than the duration, then you can cast the Devotion again, and thus it will create a snapped lightning and the previous unit will still affected by the Devotion. and i don't have any idea to solve this kind of problem. maybe someone might know something.

here it is :
 

Attachments

  • Devotion.w3x
    32.5 KB · Views: 71
Status
Not open for further replies.
Top