• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Lightning Shield Spell

Status
Not open for further replies.
Level 6
Joined
May 11, 2010
Messages
237
Hey all, i'm trying to create a spell based off lightning shield. A debuff that's placed on enemies and damages the enemy it's on as well as those around it. It damages those around it by default but not the enemy it is on. Any suggestions?
 
I think the reason why this happens, is to disable the unit that bears the main buff from moving around, due to the Stats - Can Flee = True, which causes the unit to go towards various directions, in order to avoid the damage. That would cause imbalance in the game though, having a unit running around, bearing the lightning shield buff and constantly having to control it.

You can use this, if you want:
  • Hash
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Player - Disable Hidden Ability for (Player((Integer A)))
JASS:
function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A001'
endfunction

function Timer takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit u = LoadUnitHandle (udg_Hash, GetHandleId (t), StringHash("unit"))
    call UnitRemoveAbility (u, 'A002')
    call FlushChildHashtable (udg_Hash, GetHandleId(u))
    set t = null
    set u = null
endfunction

function Actions takes nothing returns nothing
    local unit u = GetSpellTargetUnit()
    local timer t = CreateTimer()
    local timer t1 = LoadTimerHandle (udg_Hash, GetHandleId(u), StringHash("timer"))
    if GetUnitAbilityLevel (u, 'A002') < 1 then
        call UnitAddAbility (u, 'A002')
    else
        call UnitRemoveAbility (u, 'A002')
        call PauseTimer(t1)
        call FlushChildHashtable (udg_Hash, GetHandleId(t1))
        call DestroyTimer (t1)
        call UnitAddAbility (u, 'A002')
    endif
    call SaveUnitHandle (udg_Hash, GetHandleId(t), StringHash("unit"), u)
    call SaveTimerHandle (udg_Hash, GetHandleId(u), StringHash("timer"), t)
    call TimerStart (t, 20, false, function Timer)
    set u = null
    set t = null
    set t1 = null
endfunction

//===========================================================================
function InitTrig_Lightning_Shield takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ (t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition (t, Condition( function Conditions))
    call TriggerAddAction (t, function Actions)
endfunction

Test Map:
View attachment Custom Lightning Shield.w3x
 
I don't actually have Jass, so I don't think I can edit the trigger in order to make it work for the custom spell, or am I wrong?
 
Okay my bad, must be something else i'm doing wrong then. i'll look into it, thanks for your help! + rep
 
Last edited:
Status
Not open for further replies.
Back
Top