function hermit takes nothing returns nothing local integer l=udg_HermitCount+1 local integer p =1 local player Pl local integer k=120 local real x local real y local real q local real w local unit u=GetSpellAbilityUnit() local integer r=60 set Pl=GetOwningPlayer(u) set x=GetLocationX(GetUnitLoc(u)) set y=GetLocationY(GetUnitLoc(u)) loop exitwhen p>12 if Pl == Player(p) then set udg_HermitPlayer[p]=udg_HermitPlayer[p]+1 else endif endloop if udg_HermitPlayer[p]<4 then set p=1 loop exitwhen p > k call PolledWait(1.5) set q=GetLocationX(GetUnitLoc(u)) set w=GetLocationY(GetUnitLoc(u)) if GetAttackedUnitBJ()==u then set p=k+1 else if GetBooleanAnd(x <> q,y <> w) then set p=k+1 else call SetUnitState(u,UNIT_STATE_MANA,GetUnitStateSwap(UNIT_STATE_MANA,u))+100 endif endif endloop set p=1 loop exitwhen p>r call PolledWait(1) if GetUnitStateSwap(UNIT_STATE_MANA,u) > 20 then set x=GetLocationX(GetUnitLoc(u)) set y=GetLocationY(GetUnitLoc(u)) if GetBooleanAnd(x <> q,y <> w) then call SetUnitState(u,UNIT_STATE_MANA,GetUnitStateSwap(UNIT_STATE_MANA,u))-10 endif set q=GetLocationX(GetUnitLoc(u)) set w=GetLocationY(GetUnitLoc(u)) else set p=r+1 endif endloop else
endif endfunction function InitTrig_Cast takes nothing returns nothing set gg_trg_Cast=CreateTrigger() call TriggerAddAction(gg_trg_Cast,function hermit) call TriggerRegisterAnyUnitEventBJ(gg_trg_Cast,EVENT_PLAYER_UNIT_SPELL_CAST) endfunction