| 09-07-2008, 09:04 PM | #1 |
JASS:scope Martyr initializer Init globals private constant string EFFECT = "Abilities\\Spells\\Orc\\Voodoo\\VoodooAuraTarget.mdl" endglobals //------------------- private struct martyr effect e trigger t unit a //---------------------------------------------------------- static method create takes effect e, trigger t returns martyr local martyr dat = martyr.allocate() set dat.e = e set dat.t = t return dat endmethod //---------------------------------------------------------- method onDestroy takes nothing returns nothing call DestroyEffect(.e) call DestroyTrigger(.t) endmethod endstruct private struct second unit a real d real l static method create takes unit a, real l, real d returns second local second dat = second.allocate() set dat.a = a set dat.d = d set dat.l = l return dat endmethod endstruct //=========================================================================== private function Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A00D' endfunction //=========================================================================== private function Callback takes nothing returns boolean local martyr dat = ABCT_GetData() call dat.destroy() return true endfunction //=========================================================================== private function Stop takes nothing returns boolean local second dat = ABCT_GetData() if dat.l<dat.d then call SetWidgetLife(dat.a, 1.) endif call BJDebugMsg(R2S(GetWidgetLife(dat.a))) call dat.destroy() return true endfunction private function Block takes nothing returns boolean call ABCT_Zero(function Stop, second.create(GetTriggerUnit(), GetWidgetLife(GetTriggerUnit()), GetEventDamage())) return true endfunction //=========================================================================== private function Actions takes nothing returns nothing local unit a = GetTriggerUnit() local trigger t = CreateTrigger() call TriggerAddCondition(t, Condition(function Block)) call TriggerRegisterUnitEvent(t, a, EVENT_UNIT_DAMAGED) call ABCT_Start(function Callback, martyr.create(AddSpecialEffectTarget(EFFECT, a, "head"), t), 5.) set t = null set a = null endfunction //=========================================================================== private function Init takes nothing returns nothing local trigger t = CreateTrigger() local integer i = 0 loop call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, BOOLEXPR_TRUE ) set i=i+1 exitwhen i >= Eight endloop call TriggerAddCondition( t, Condition( function Conditions ) ) call TriggerAddAction( t, function Actions ) endfunction endscope |
| 09-07-2008, 10:45 PM | #2 |
What does the debug message tell you after the unit dies? I'll keep looking at the code. |
| 09-07-2008, 10:47 PM | #3 |
I don't think that blocking is good? You need to first increase the health of the guy to 100% and restore it to something correct after 0.0 seconds, if you wait 0.0 seconds to heal it, you are just wating for it to die. |
| 09-07-2008, 11:30 PM | #4 | |
Quote:
@Vex Blocking? Are you refering to the 0.0timer? I thought you had to use 0.0 timers else it would be slower or something of that sort |
| 09-08-2008, 12:03 AM | #5 |
He's right. He means that bringing the unit back to 1 health and "blocking" it all the time is waiting for the unit to die multiple times, try his method out. I think the zero timer is fine. |
