Xantan wrote:If the player sees the invisible unit EVER in the game with map hack, you will crash.
If the player does not see the unit you don't crash (IE if you map hack - and you don't normally see it, but with map hack you do, - it should crash) If you do see an invisible unit without map-hack, you must have some sort of detecting item or ability.
That's what you meant, right Xantan?
And, for Dekar's question: If the detecting/hacking unit has Gem of True Sight, this won't even bother checking the detecting unit because Warcraft III automatically classifies that the unit can see invisibility, meaning that the trigger wouldn't even check the unit because Warcraft III already classified the unit with the Gem of True Sight able to see invisibility. Or, that's how it should be, Xantan might've made it weird, so I'm not entirely sure.
globals trigger gg_trg_AntiMapHack = null unit udg_u real udg_t endglobals
constant function AntiHackDummy takes nothing returns integer return 'e000' endfunction
function SafeVision takes nothing returns nothing call SetUnitAnimationByIndex(udg_u,1) endfunction
function Anim takes nothing returns nothing set udg_t=udg_t+0.001 if udg_t==0.025 or (IsUnitVisible(udg_u,GetLocalPlayer()) and udg_t<0.025) then call SetUnitAnimationByIndex(udg_u,1) endif endfunction
function AntiMapHackTime takes timer t returns nothing set udg_t=0. call TimerStart(t,0.001,true,function Anim) call TriggerSleepAction(0.) call RemoveUnit(udg_u) call PauseTimer(t) call DestroyTimer(t) endfunction
function Trig_AntiMapHack_Actions takes nothing returns nothing set udg_u=CreateUnit(Player(13),AntiHackDummy(),GetCameraTargetPositionX(),GetCameraTargetPositionY(),0) if not(IsUnitVisible(udg_u,GetLocalPlayer())) then call SetUnitAnimationByIndex(udg_u,0) else call SetUnitAnimationByIndex(udg_u,1) endif call AntiMapHackTime(CreateTimer()) endfunction
//=========================================================================== function InitTrig_AntiMapHack takes nothing returns nothing set gg_trg_AntiMapHack = CreateTrigger() call TriggerRegisterTimerEventPeriodic( gg_trg_AntiMapHack, 2.00 ) call TriggerAddAction( gg_trg_AntiMapHack, function Trig_AntiMapHack_Actions ) endfunction
Pretty much the same, but fixed errors with jasscraft...