Custom curse spell lasting longer than expected duration

jleips2600

New Member
Reaction score
4
I recently made a trigger spell in which if a certain unit gets attacked by a ranged attacker, there's a x% chance to have the attack dodged.

The custom Curse spell ('A00D') has a 100% miss chance and a 0.01 second duration with a 5 second cooldown. I've tried changing the duration to .05 second, but I don't want it to last much longer than that in case of Faster attacking units missing more than one shot.

Now it works pretty well in that it misses and what not but even setting the x% to 10, it makes the attacker miss Every shot. I'm not really sure where the problem is. Here is the trigger.


JASS:
function Trig_Skeletal_Dodge_Conditions takes nothing returns boolean
    if ( not ( UnitHasBuffBJ(GetTriggerUnit(), 'A00E') ) ) then
        return false
    endif
    return true
endfunction

function Trig_Skeletal_Dodge_Actions takes nothing returns nothing
    local integer x
    set x = GetRandomInt(1,100)
    if ( x >= 90 ) then
        if ( IsUnitType(GetAttacker(), UNIT_TYPE_RANGED_ATTACKER) ) then
            call BJDebugMsg("UNIT IS RANGED!")
            set bj_lastCreatedUnit = CreateUnitAtLoc(GetTriggerPlayer(), 'h004', GetUnitLoc(GetAttacker()), 1.00)
            call UnitAddAbility(GetLastCreatedUnit(), 'A00D')
            call IssueTargetOrder(GetLastCreatedUnit(), "curse", GetAttacker())
            call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
        else
            call BJDebugMsg("UNIT IS MELEE!")
        endif
    else
        call BJDebugMsg("CHANCE DIDN'T PROC")
    endif
endfunction

//===========================================================================
function InitTrig_Skeletal_Dodge takes nothing returns nothing
    set gg_trg_Skeletal_Dodge = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Skeletal_Dodge, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Skeletal_Dodge, Condition( function Trig_Skeletal_Dodge_Conditions ) )
    call TriggerAddAction( gg_trg_Skeletal_Dodge, function Trig_Skeletal_Dodge_Actions )
endfunction


Or perhaps there's a better way to go about this?

Edit: After further testing it seems that even Melee units are being cursed.. making the attacked unit with this buff unhittable. Any ideas guys?

EDIT 2:
OK I feel completely retarded now.. the skill i based the buff check on was evasion and I apparently typo'd the chance to 10.00.
*sigh* I feel like a noob. Sorry to waste a thread! ^^;;
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top