HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Can you make it so lightning shield doesn't hurt friendly units?

07-29-2006, 06:53 PM#1
Sardius
nt
07-29-2006, 07:25 PM#2
darkwulfv
There's probably some long JASS'ed up way to do it by checking for buffs and healing the unit for the amount of damage it would take per second. But I don't know if lightning shield gives buffs to units other than the shieled one. If so, then my method would probably work.
07-29-2006, 07:40 PM#3
Nasrudin
Uncheck "friends" on the target allowed.
07-29-2006, 07:45 PM#4
Sardius
That just makes you not able to target your friends with the spell itself... But I guess it ain't to bad... I thing maybe I'll need to reduce the range of the spell damage since one of my familiars has the spell and likes to follow a bit to close to the hero via triggers... Doesn't work out to well at times, but I think I have a good solution...
07-29-2006, 08:01 PM#5
darkwulfv
Good luck then. I wouldn't have been able to make the trigger I suggested anyways, so...
07-29-2006, 08:44 PM#6
Captain Griffen
Here you go, I wrote some JASS to do it using imolation (or some other AoE ability). Problems are that it will give XP as if the unit being cast on kills it (though it won't matter for allies). Put it into a disabled spellbook to stop it appearing on the UI. Just use the GUI generated events, and optimise the stupid condition it does (change it to return "GetSpellAbilityId() == //raw id code//").

Collapse JASS:
function FriendlyLightningShield takes nothing returns nothing
    local unit u = GetSpellTargetUnit()
    local integer id
    local timer t = CreateTimer()
    if IsPlayerAlly(GetOwningPlayer(u), GetOwningPlayer(GetTriggerUnit()) then
        set id = //Insert here raw ability code of hit enemy imo//
    else
        set id = //Insert here raw ability code of hit ally imo//
    endif
    call UnitAddAbility(u, id)

    call TimerStart(t, 30, false, null)
    loop
        exitwhen GetWidgetLife(u) < 0.405 or TimerGetRemaining(t) <= 0
        call TriggerSleepAction(0)
    endloop
    call UnitRemoveAbility(u, id)
    set u = null
    call DestroyTimer(t)
    set t = null //this is safe as we do not attach anything to the timer//
endfunction