![]() |
#1 | |
Panda > You
|
![]() NOTE: You have been redirected in order for our attachments to be made available to you. This will only last two minutes; these measures where taken to avoid hotlinking and bandwidth theft. To avoid these restrictions Log in or Register AMHS (Anti Map Hack System) created by PandaMine
Current Version: 5.2 IT IS HIGHLY RECOMMENDED THAT YOU READ THROUGH EVERY README/MANUAL IN THE AMHS v5.x - THE WHOLE SYSTEM HAS CHANGED Many thanks to Strilanc who's suggestions greatly increased the speed and efficiency of the system Advantages - First AMH system that works with replays, fully (thanks to my replay detect function, credits to Toadcop and Captain Griffein) - Counters all the major features of ALL and I mean ALL public map hacks (there isnt much I can do for private ones). Check the MH List trigger in the map for more info - Prevents any MH from revealing units on the screen - Prevents any MH from revealing units on the minimap - Prevents any MH from revealing special effects on the screen Disadvantages - The replay detect function (used to disable the system when viewing replays) uses up one pause and makes a noticable message. - With the new AMHS v5.x, you need to input the data for every unit that the map uses into the engine since there unfortunately isn't any known method for WE/JASS to read/write data to the Object Editor - JassNewGen (vJASS) is mandatory, there is not going to be any non JassNewGen releases How does the system work? The current version of the system works by hiding units/minimap icons/destructables/effects if they are not visible by a player so any MH will not reveal them Fog Protect and Shadow Engine This a huge engine that fully replaces the default Blizzard engine for managing shadows and UnitVertexColor/UnitScale. The system works by completely and graphically hiding a unit if it is not visible (determined by IsUnitVisible) to a player. It also adds many more options, too many to go through in this post (read the Readme). This also works with Invisible Units ![]() library FogProtectShadowEngine needs ReplayDetectEngine, AMHSCache //************************************************************************* //* * * //* FOG PROTECT & SHADOW ENGINE v1.20 * //* CONFIGURATION SETTINGS START HERE * * //* * * //************************************************************************* globals // This is the default alpha value used for shadows. From visual experimentation the alpha // value of Blizzards shadows appear to be 180. If desire you can change the value // NOTE: If you wish you can change the alpha value of a shadow using the SetShadowAlpha // method at any time, this is just the default value when the shadow is created private constant integer shadowalpha_default = 180 // This is the interval period used by the system. 0.025 should be the LOWEST value, anything // lower is pointless since 0.025 matches Wc3's maximum FPS (60 fp/s). If the system is // causing lag then you should increase it to a value between 0.025 and 0.05. Anything higher // then 0.05 is seriously not recommended since it will look visually choppy. // NOTE: The system is INCREDIBLY efficient and it uses the struct-loop system (no H2I/attach // methods are used for the timer interval) so in 99% of cases you should never have to increase // the period private constant real period = 0.025 // By default Blizzard shadows are disabled when a unit dies (note when a unit dies, this doesn't // necessarily mean when its removed from the game. If a unit is removed from the by killunit // or removeunit the shadow is destroyed, however should a hero die then the shadow will not // be removed, instead it will be disabled. A units death is evaluated by the // GetUnitState(u,UNIT_STATE_MAX_LIFE) <= 0.405. Should the unit be revived by a spell such // as reincarnation then its shadow will return back to what it was before it died // Setting this to false will mean the shadow will still remain even if the unit dies. NOTE: If // hideshadowondeath is enabled it can be detect with the GetShadowVisibility method, so this // means you would need to take care of when a unit dies when dealing with showing/hiding shadows private constant boolean hideshadowondeath = true endglobals //************************************************************************* //* * * //* FOG PROTECT & SHADOW ENGINE v1.20 * * //* CONFIGURATION SETTINGS END HERE * * //* * * //************************************************************************* // Create has used to store buffs globals private gamecache fp_datacache private boolean cachefirst = true private trigger RegisterUnit = CreateTrigger() private group g = CreateGroup() //Stack for shadow struct private integer array s_StructStack private integer array s_StructFreeStack private integer s_StructNumber = 0 private integer s_StructFreeNumber = -1 //Stack for unit/graphic struct private integer array gp_StructStack private integer array gp_StructFreeStack private integer gp_StructNumber = 0 private integer gp_StructFreeNumber = -1 endglobals private function H2I takes handle h returns integer return h return 0 endfunction private function InitializeDataCache takes nothing returns nothing call FlushGameCache(InitGameCache("fp_datacache")) set fp_datacache=InitGameCache("fp_datacache") endfunction //! runtextmacro AMHS_HandleInit() //Shadow Struct -> Public Use struct shadow readonly real x readonly real y readonly real centrex readonly real centrey readonly real width readonly real height readonly integer r readonly integer g readonly integer b readonly integer a readonly unit u readonly string path readonly image i readonly boolean enabled = true readonly boolean deadunit = false readonly integer position //position in relation to struct stack static method Create takes unit u, real centrex, real centrey, real width, real height, integer alpha, string path returns shadow local shadow s = shadow.create() local real x = GetUnitX(u) local real y = GetUnitY(u) set s.x = x set s.y = y set s.width = width set s.height = height set s.a = alpha set s.u = u set s.centrex = centrex set s.centrey = centrey set s.path = path if path == "normal" or path == "Normal" or path == "NORMAL" or path == "Shadow" or path == "shadow" or path == "SHADOW" then set s.path = "ReplaceableTextures\\Shadows\\Shadow.blp" elseif path == "flyer" or path == "Flyer" or path == "FLYER" or path == "ShadowFlyer" or path == "shadowflyer" or path == "SHADOWFLYER" then set s.path = "Textures\\Shadow.blp" elseif path == "none" or path == "None" or path == "NONE" then set s.path = "" endif set s.i = CreateImage(s.path, width, height, 0, x - (width / 2), y - (height / 2), 0, centrex, centrey, 0, 2) // image type indicator call SetImageRenderAlways(s.i, true) call ShowImage(s.i, true) call SetImageColor(s.i,255,255,255,alpha) set s.r = 255 set s.g = 255 set s.b = 255 set s.a = 180 //Update Struct Stack if s_StructFreeNumber<0 then set s.position = s_StructNumber set s_StructStack[s_StructNumber] = s set s_StructNumber = s_StructNumber+1 else set s.position = s_StructFreeStack[s_StructFreeNumber] set s_StructStack[s.position] = s set s_StructFreeStack[s_StructFreeNumber] = -1 set s_StructFreeNumber = s_StructFreeNumber-1 endif //! runtextmacro AMHS_StoreStructShadow("s.u","s") return s endmethod public method ChangeDeadUnit takes boolean flag returns nothing set this.deadunit = flag endmethod method GetShadowPath takes nothing returns string return this.path endmethod method GetShadowAlpha takes nothing returns integer return this.a endmethod method GetShadowRed takes nothing returns integer return this.r endmethod method GetShadowGreen takes nothing returns integer return this.g endmethod method GetShadowBlue takes nothing returns integer return this.b endmethod method GetShadowCentreX takes nothing returns real return this.centrex endmethod method GetShadowCentreY takes nothing returns real return this.centrey endmethod method GetShadowHeight takes nothing returns real return this.height endmethod method GetShadowWidth takes nothing returns real return this.width endmethod method GetShadowUnit takes nothing returns unit return this.u endmethod method GetDefaultShadowCentreX takes nothing returns real local string s = UnitId2String(GetUnitTypeId(this.u)) if GetStoredBoolean(fp_datacache,s,"exist") == true then return GetStoredReal(fp_datacache,s,"centrex") else return I2R(0) endif endmethod method GetDefaultShadowCentreY takes nothing returns real local string s = UnitId2String(GetUnitTypeId(this.u)) if GetStoredBoolean(fp_datacache,s,"exist") == true then return GetStoredReal(fp_datacache,s,"centrey") else return I2R(0) endif endmethod method GetDefaultShadowHeight takes nothing returns real local string s = UnitId2String(GetUnitTypeId(this.u)) if GetStoredBoolean(fp_datacache,s,"exist") == true then return GetStoredReal(fp_datacache,s,"height") else return I2R(0) endif endmethod method GetDefaultShadowWidth takes nothing returns real local string s = UnitId2String(GetUnitTypeId(this.u)) if GetStoredBoolean(fp_datacache,s,"exist") == true then return GetStoredReal(fp_datacache,s,"width") else return I2R(0) endif endmethod method GetDefaultShadowPath takes nothing returns string local string s = UnitId2String(GetUnitTypeId(this.u)) if GetStoredBoolean(fp_datacache,s,"exist") == true then return GetStoredString(fp_datacache,s,"path") else return "" endif endmethod method SetShadowColor takes integer red, integer green, integer blue, integer alpha returns nothing call SetImageColor(this.i,red,green,blue,alpha) set this.r = red set this.g = green set this.b = blue set this.a = alpha endmethod method SetShadowAlpha takes integer alpha returns nothing call SetImageColor(this.i,this.r,this.g,this.b,alpha) set this.a = alpha endmethod method SetShadowVisibility takes boolean visibility returns nothing call ShowImage(this.i,visibility) set this.enabled = visibility endmethod method SetShadowImage takes string path returns nothing local string truepath = path call DestroyImage(this.i) set this.i = null if path == "normal" or path == "Normal" or path == "NORMAL" then set truepath = "ReplaceableTextures\\Shadows\\Shadow.blp" elseif path == "flyer" or path == "Flyer" or path == "FLYER" then set truepath = "Textures\\Shadow.blp" elseif path == "none" or path == "None" or path == "NONE" then set truepath = "" endif set this.i = CreateImage(truepath, this.width, this.height, 0, this.x - (this.width / 2), this.y - (this.height / 2), 0, this.centrex, this.centrey, 0, 2) // image type indicator set this.path = truepath call SetImageRenderAlways(this.i, true) call ShowImage(this.i, true) call SetImageColor(this.i,this.r,this.g,this.b,this.a) endmethod method SetShadowImageEx takes string path, real centrex, real centrey, real width, real height returns nothing local string truepath = path call DestroyImage(this.i) set this.i = null if path == "normal" or path == "Normal" or path == "NORMAL" then set truepath = "ReplaceableTextures\\Shadows\\Shadow.blp" elseif path == "flyer" or path == "Flyer" or path == "FLYER" then set truepath = "Textures\\Shadow.blp" elseif path == "none" or path == "None" or path == "NONE" then set truepath = "" endif set this.i = CreateImage(truepath, width, height, 0, this.x - (width / 2), this.y - (height / 2), 0, centrex, centrey, 0, 2) // image type indicator set this.path = truepath set this.centrex = centrex set this.centrey = centrey set this.width = width set this.height = height call SetImageRenderAlways(this.i, true) call ShowImage(this.i, true) call SetImageColor(this.i,this.r,this.g,this.b,this.a) endmethod method SetShadowDimeansions takes real centrex, real centrey, real width, real height returns nothing call DestroyImage(this.i) set this.i = null set this.i = CreateImage(this.path, width, height, 0, this.x - (width / 2), this.y - (height / 2), 0, centrex, centrey, 0, 2) // image type indicator set this.centrex = centrex set this.centrey = centrey set this.width = width set this.height = height call SetImageRenderAlways(this.i, true) call ShowImage(this.i, true) call SetImageColor(this.i,this.r,this.g,this.b,this.a) endmethod method onDestroy takes nothing returns nothing call DestroyImage(this.i) set this.i = null set s_StructStack[this.position] = -1 if (this.position>=(s_StructNumber-1)) then set s_StructNumber = s_StructNumber-1 else set s_StructFreeNumber = s_StructFreeNumber+1 set s_StructFreeStack[s_StructFreeNumber] = this.position endif //! runtextmacro AMHS_DestroyStructShadow("this.u") set this.u = null set this.position = -1 endmethod endstruct //Struct for managing SetUnitVertexColor/SetUnitScale struct unitgraphic readonly unit u readonly integer r readonly integer g readonly integer b readonly integer a readonly real x readonly real y readonly real z readonly boolean enabled readonly integer position //position in relation to struct stack static method Create takes unit u, integer red, integer green, integer blue, integer alpha, real x, real y, real z returns unitgraphic local unitgraphic gp = unitgraphic.create() set gp.r = red set gp.g = green set gp.b = blue set gp.a = alpha set gp.x = x set gp.y = y set gp.z = z set gp.u = u set gp.enabled = true //Update Struct Stack if gp_StructFreeNumber<0 then set gp.position = gp_StructNumber set gp_StructStack[gp_StructNumber] = gp set gp_StructNumber = gp_StructNumber+1 else set gp.position = gp_StructFreeStack[gp_StructFreeNumber] set gp_StructStack[gp.position] = gp set gp_StructFreeStack[gp_StructFreeNumber] = -1 set gp_StructFreeNumber = gp_StructFreeNumber-1 endif //! runtextmacro AMHS_StoreStructUnitGraphic("gp.u","gp") set u = null return gp endmethod method SetVertexColor takes integer red, integer green, integer blue, integer alpha returns nothing set this.r = red set this.g = green set this.b = blue set this.a = alpha endmethod method SetVertexColorBJ takes real red, real green, real blue, real transparency returns nothing call this.SetVertexColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100.0-transparency)) endmethod method SetScale takes real scaleX, real scaleY, real scaleZ returns nothing set this.x = scaleX set this.y = scaleY set this.z = scaleZ endmethod method SetScalePercent takes real percentScaleX, real percentScaleY, real percentScaleZ returns nothing call this.SetScale(percentScaleX * 0.01, percentScaleY * 0.01, percentScaleZ * 0.01) endmethod method SetGraphicVisibility takes boolean visibility returns nothing set this.enabled = visibility endmethod method GetScaleX takes nothing returns real return this.x endmethod method GetScaleY takes nothing returns real return this.y endmethod method GetScaleZ takes nothing returns real return this.z endmethod method GetVertexColorRed takes nothing returns integer return this.r endmethod method GetVertexColorGreen takes nothing returns integer return this.g endmethod method GetVertexColorBlue takes nothing returns integer return this.b endmethod method GetVertexColorAlpha takes nothing returns integer return this.a endmethod method GetGraphicVisibility takes nothing returns boolean return this.enabled endmethod method onDestroy takes nothing returns nothing set gp_StructStack[this.position] = -1 if (this.position>=(gp_StructNumber-1)) then set gp_StructNumber = gp_StructNumber-1 else set gp_StructFreeNumber = gp_StructFreeNumber+1 set gp_StructFreeStack[gp_StructFreeNumber] = this.position endif set this.position = -1 //! runtextmacro AMHS_DestroyStructUnitGraphic("this.u") set this.u = null endmethod endstruct //Public Functions function RegisterUnitShadow takes integer UnitID, real centrex, real centrey, real height, real width, string ShadowType returns nothing local string s if cachefirst then call InitializeDataCache() set cachefirst = false endif set s = UnitId2String(UnitID) call StoreBoolean(fp_datacache,s,"exist",true) call StoreReal(fp_datacache,s,"height",height) call StoreReal(fp_datacache,s,"width",width) call StoreReal(fp_datacache,s,"centrex",centrex) call StoreReal(fp_datacache,s,"centrey",centrey) call StoreString(fp_datacache,s,"path",ShadowType) endfunction function RegisterUnitTintEx takes integer UnitID, integer red, integer green, integer blue, integer alpha returns nothing local string s if cachefirst then call InitializeDataCache() set cachefirst = false endif set s = UnitId2String(UnitID) call StoreBoolean(fp_datacache,s,"customtint",true) call StoreInteger(fp_datacache,s,"tintred",red) call StoreInteger(fp_datacache,s,"tintgreen",green) call StoreInteger(fp_datacache,s,"tintblue",blue) call StoreInteger(fp_datacache,s,"tintalpha",alpha) endfunction function RegisterUnitTint takes integer UnitID, integer red, integer green, integer blue returns nothing call RegisterUnitTintEx(UnitID,red,green,blue,255) endfunction function RegisterUnitScaleEx takes integer UnitID, real scaleX, real scaleY, real scaleZ returns nothing local string s if cachefirst then call InitializeDataCache() set cachefirst = false endif set s = UnitId2String(UnitID) call StoreBoolean(fp_datacache,s,"customscale",true) call StoreReal(fp_datacache,s,"scalex",scaleX) call StoreReal(fp_datacache,s,"scaley",scaleY) call StoreReal(fp_datacache,s,"scalez",scaleZ) endfunction function RegisterUnitScale takes integer UnitID, real scale returns nothing call RegisterUnitScaleEx(UnitID,scale,scale,scale) endfunction globals private integer array bs_StructStack private integer array bs_StructFreeStack private integer bs_StructNumber = 0 private integer bs_StructFreeNumber = -1 endglobals private struct buffstruct integer BuffID real x = 0 real y = 0 real z = 0 real increasex real increasey real increasez integer increasecount real SizeDurationIncrease = 0 integer position real Duration integer Level = 0 static method Create takes integer BuffID, real x, real y, real z, real SizeDurationIncrease, real Duration, integer Level returns buffstruct local buffstruct bs = buffstruct.create() set bs.x = x set bs.y = y set bs.z = z set bs.SizeDurationIncrease = SizeDurationIncrease set bs.BuffID = BuffID set bs.Duration = Duration set bs.Level = Level if SizeDurationIncrease > 0 then set bs.increasecount = R2I(SizeDurationIncrease/period) set bs.increasex = bs.x/bs.increasecount set bs.increasey = bs.y/bs.increasecount set bs.increasez = bs.z/bs.increasecount endif //Update Struct Stack if bs_StructFreeNumber<0 then set bs.position = bs_StructNumber set bs_StructStack[bs_StructNumber] = bs set bs_StructNumber = bs_StructNumber+1 else set bs.position = bs_StructFreeStack[bs_StructFreeNumber] set bs_StructStack[bs.position] = bs set bs_StructFreeStack[bs_StructFreeNumber] = -1 set bs_StructFreeNumber = bs_StructFreeNumber-1 endif return bs endmethod endstruct function RegisterBuffScaleEx takes integer BuffID, real scaleX, real scaleY, real scaleZ, real SizeDurationIncrease, real Duration, integer Level returns nothing local buffstruct bs set bs = buffstruct.Create(BuffID,scaleX,scaleY,scaleZ,SizeDurationIncrease,Duration,Level) endfunction function RegisterBuffScale takes integer BuffID, real scale,real SizeDurationIncrease, real Duration, integer Level returns nothing call RegisterBuffScaleEx(BuffID,scale,scale,scale,SizeDurationIncrease,Duration,Level) endfunction function SetUnitVertexColorAMHS takes unit whichUnit, integer red, integer green, integer blue, integer alpha returns nothing local unitgraphic gp if whichUnit != null then //! runtextmacro AMHS_GetStructUnitGraphic("whichUnit","gp") call gp.SetVertexColor(red,green,blue,alpha) endif endfunction function SetUnitVertexColorBJAMHS takes unit whichUnit, real red, real green, real blue, real transparency returns nothing call SetUnitVertexColorAMHS(whichUnit, PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100.0-transparency)) endfunction function SetUnitScaleAMHS takes unit whichUnit, real scaleX, real scaleY, real scaleZ returns nothing local unitgraphic gp if whichUnit != null then //! runtextmacro AMHS_GetStructUnitGraphic("whichUnit","gp") call gp.SetScale(scaleX,scaleY,scaleZ) endif endfunction function SetUnitScalePercentAMHS takes unit whichUnit, real percentScaleX, real percentScaleY, real percentScaleZ returns nothing call SetUnitScaleAMHS(whichUnit, percentScaleX * 0.01, percentScaleY * 0.01, percentScaleZ * 0.01) endfunction function GetUnitShadow takes unit u returns integer local shadow sh if u == null then return 0 endif //! runtextmacro AMHS_GetStructShadow("u","sh") return sh endfunction function GetUnitGraphic takes unit u returns integer local unitgraphic gp if u == null then return 0 endif //! runtextmacro AMHS_GetStructUnitGraphic("u","gp") return gp endfunction //End Public Functions private function AddUnits takes unit u returns nothing local string s local string path local real centrex local real centrey local real height local real width local integer red = 255 local integer green = 255 local integer blue = 255 local integer alpha = 255 local real x = 1 local real y = 1 local real z = 1 local shadow sh local unitgraphic gp set s = UnitId2String(GetUnitTypeId(u)) if GetStoredBoolean(fp_datacache,s,"exist") == true then set path = GetStoredString(fp_datacache,s,"path") set centrex = GetStoredReal(fp_datacache,s,"centrex") set centrey = GetStoredReal(fp_datacache,s,"centrey") set height = GetStoredReal(fp_datacache,s,"height") set width = GetStoredReal(fp_datacache,s,"width") set sh = shadow.Create(u,centrex,centrey,width,height,shadowalpha_default,path) else call BJDebugMsg("|cFFFF0000AMHS ERROR: Unable to create shadow for unit with UnitType ID " + s) endif if GetStoredBoolean(fp_datacache,s,"customtint") then set red = GetStoredInteger(fp_datacache,s,"tintred") set green = GetStoredInteger(fp_datacache,s,"tintgreen") set blue = GetStoredInteger(fp_datacache,s,"tintblue") set alpha = GetStoredInteger(fp_datacache,s,"tintalpha") endif if GetStoredBoolean(fp_datacache,s,"customscale") then set x = GetStoredReal(fp_datacache,s,"scalex") set y = GetStoredReal(fp_datacache,s,"scaley") set z = GetStoredReal(fp_datacache,s,"scalez") endif set gp = unitgraphic.Create(u,red,green,blue,alpha,x,y,z) set u = null endfunction private function ShadowGraphicManager takes nothing returns nothing local unitgraphic gp local shadow s local integer counter = 0 local real l1 = GetRandomReal(1000,10000000000) local real l2 = GetRandomReal(1000,10000000000) local real l3 = GetRandomReal(1000,10000000000) local player p = GetLocalPlayer() loop set gp = gp_StructStack[counter] if integer(gp) > -1 then if GetUnitTypeId(gp.u) == 0 then call gp.destroy() else if IsUnitVisible(gp.u, p) then if gp.enabled then call SetUnitVertexColor(gp.u,gp.r,gp.g,gp.b,gp.a) call SetUnitScale(gp.u,gp.x,gp.y,gp.z) else call SetUnitVertexColor(gp.u,0,0,0,0) call SetUnitScale(gp.u,-l1,-l2,-l3) endif elseif InGame and GetLocalPlayer() == p then call SetUnitVertexColor(gp.u,0,0,0,0) call SetUnitScale(gp.u,-l1,-l2,-l3) endif endif endif set counter = counter + 1 exitwhen counter >= gp_StructNumber endloop set counter = 0 loop set s = s_StructStack[counter] if integer(s) > -1 then if GetUnitTypeId(s.u) == 0 then call s.destroy() else if GetUnitState(s.u,UNIT_STATE_MAX_LIFE) > 0.405 and s.deadunit then call s.ChangeDeadUnit(false) call s.SetShadowVisibility(true) endif if IsUnitVisible(s.u, p) then if s.enabled then call ShowImage(s.i,true) else call ShowImage(s.i,false) endif elseif InGame and GetLocalPlayer() == p then call ShowImage(s.i,false) endif call SetImagePosition(s.i,GetUnitX(s.u),GetUnitY(s.u),0) endif endif set counter = counter + 1 exitwhen counter >= s_StructNumber endloop endfunction private function GroupAdder takes nothing returns nothing call AddUnits(GetEnumUnit()) endfunction private function TriggerAdder takes nothing returns boolean call AddUnits(GetTriggerUnit()) return true endfunction private function AntiLeak takes nothing returns boolean return true endfunction private function FinalGroup takes nothing returns nothing call GroupAddUnit(g,GetEnumUnit()) endfunction globals private integer array bc_StructStack private integer array bc_StructFreeStack private integer bc_StructNumber = 0 private integer bc_StructFreeNumber = -1 endglobals private struct buffcheck unit u integer position integer buffstructid integer unitgraphicid integer counter boolean increasing boolean decreasing real timeelapsed static method Create takes unit u, integer buffstructid, integer unitgraphicid returns buffcheck local buffcheck bc = buffcheck.create() local buffstruct bs = buffstructid set bc.u = u set bc.buffstructid = buffstructid set bc.unitgraphicid = unitgraphicid set bc.counter = 0 set bc.timeelapsed = 0 if bs.SizeDurationIncrease > 0 then set bc.increasing = true else set bc.increasing = false endif //Update Struct Stack if bc_StructFreeNumber<0 then set bc.position = bc_StructNumber set bc_StructStack[bc_StructNumber] = bc set bc_StructNumber = bc_StructNumber+1 else set bc.position = bs_StructFreeStack[bc_StructFreeNumber] set bc_StructStack[bc.position] = bc set bc_StructFreeStack[bc_StructFreeNumber] = -1 set bc_StructFreeNumber = bc_StructFreeNumber-1 endif return bc endmethod method onDestroy takes nothing returns nothing set bc_StructStack[this.position] = -1 if (this.position>=(bc_StructNumber-1)) then set bc_StructNumber = bc_StructNumber-1 else set bc_StructFreeNumber = bc_StructFreeNumber+1 set bc_StructFreeStack[bc_StructFreeNumber] = this.position endif //! runtextmacro AMHS_DestroyStructShadow("this.u") set this.u = null set this.position = -1 endmethod endstruct private function BuffManager takes nothing returns nothing local unit u = GetEnumUnit() local integer counter = 0 local integer lastbuffid = 0 local buffstruct bs local buffcheck bc local unitgraphic gp loop if (bs_StructStack[counter]) > -1 then set bs = bs_StructStack[counter] if GetUnitAbilityLevel(u, bs.BuffID) == bs.Level and bs.BuffID != lastbuffid then set lastbuffid = bs.BuffID //! runtextmacro AMHS_GetStructBuff("u", "bc") if bc <= 0 then //! runtextmacro AMHS_GetStructUnitGraphic("u","gp") if bs.SizeDurationIncrease == 0 then call gp.SetScale(gp.x + bs.x,gp.y + bs.y,gp.z + bs.z) endif set bc = buffcheck.Create(u,bs,gp) //! runtextmacro AMHS_StoreStructBuff("u", "bc") endif endif endif set counter = counter + 1 exitwhen counter >= bs_StructNumber endloop endfunction private function BuffEnumerator takes nothing returns nothing local group g = CreateGroup() local integer counter = 0 local buffcheck bc local buffstruct bs local unitgraphic gp call GroupEnumUnitsInRect(g,bj_mapInitialPlayableArea,Condition(function AntiLeak)) call ForGroup(g,function BuffManager) call DestroyGroup(g) set g = null loop if (bc_StructStack[counter]) > -1 then set bc = bc_StructStack[counter] set bs = bc.buffstructid set gp = bc.unitgraphicid set bc.timeelapsed = bc.timeelapsed + period if GetUnitAbilityLevel(bc.u, bs.BuffID) == bs.Level then if bs.Duration - bc.timeelapsed <= bs.SizeDurationIncrease then set bc.decreasing = true endif if bc.increasing == true then if (bc.counter != bs.increasecount) then call gp.SetScale(gp.x + bs.increasex,gp.y + bs.increasey,gp.z + bs.increasez) set bc.counter = bc.counter + 1 else set bc.increasing = false set bc.counter = 0 endif endif elseif (bc.decreasing == true) then if (bc.counter != bs.increasecount) then call gp.SetScale(gp.x - bs.increasex,gp.y - bs.increasey,gp.z - bs.increasez) set bc.counter = bc.counter + 1 else set bc.decreasing = false endif else call bc.destroy() endif endif set counter = counter + 1 exitwhen counter >= bc_StructNumber endloop endfunction private function HideUnitOnDeath takes nothing returns nothing local shadow sh //! runtextmacro AMHS_GetStructShadow("GetTriggerUnit()","sh") call sh.SetShadowVisibility(false) call sh.ChangeDeadUnit(true) endfunction function Trig_Shadow_Engine_Actions takes nothing returns nothing local timer t = CreateTimer() local timer t2 = CreateTimer() local integer i = 0 local group tempgroup local trigger hideondeath //! runtextmacro AMHS_StructInitializeLine() if cachefirst then call InitializeDataCache() set cachefirst = false endif loop exitwhen i > 15 set tempgroup = CreateGroup() call GroupEnumUnitsOfPlayer(tempgroup, Player(i), Filter( function AntiLeak)) call ForGroup(tempgroup, function FinalGroup) call DestroyGroup(tempgroup) set tempgroup = null set i = i + 1 endloop call ForGroup(g,function GroupAdder) call DestroyGroup(g) call TriggerRegisterEnterRectSimple(RegisterUnit, bj_mapInitialPlayableArea) call TriggerAddCondition(RegisterUnit, Condition (function TriggerAdder)) call TimerStart(t,period,true,function ShadowGraphicManager) call TimerStart(t2,period,true, function BuffEnumerator) if hideshadowondeath then set hideondeath = CreateTrigger() call TriggerAddAction(hideondeath, function HideUnitOnDeath) call TriggerRegisterAnyUnitEventBJ(hideondeath, EVENT_PLAYER_UNIT_DEATH ) endif set t = null set tempgroup = null set hideondeath = null endfunction //=========================================================================== function InitTrig_Fog_Protect_and_Shadow_Engine takes nothing returns nothing set gg_trg_Fog_Protect_and_Shadow_Engine = CreateTrigger( ) call TriggerRegisterTimerEventSingle(gg_trg_Fog_Protect_and_Shadow_Engine, 0.00) call TriggerAddAction( gg_trg_Fog_Protect_and_Shadow_Engine, function Trig_Shadow_Engine_Actions ) endfunction endlibrary MiniMap Protect Unlike the other systems the MiniMap protect does not crash wc3, instead it prevents MH's from revealing unseen units on the MiniMap (the fog will be lifted but beneath the fog there wont be any units seen, only the terrain). This works by setting an alternate MiniMap Icon which is blank/invisible and then using local code the system cycles through each player and for every unit that player cannot see it applies this MiniMap icon so it cannot be seen on the MiniMap ![]() library MiniMapProtectEngine needs ReplayDetectEngine //************************************************************************* //* * * //* MINIMAP PROTECT ENGINE v3.10 * //* CONFIGURATION SETTINGS START HERE * * //* * * //************************************************************************* globals // The MiniMap engine requires you to provide the path to the MiniMMap - Blank.blp file. This // shouldn't change in between maps if you use the default string, remember use '//' instead of // '/' (double dash instead of single dash). // As noted in the readme, its a very good idea to randomize the filename and the location // to the file. private constant string MiniMapPath = "HGVGWEO4NV\\435983460.blp" // This is the interval period used by the system. 0.025 should be the LOWEST value, anything // lower is pointless since 0.025 matches Wc3's maximum FPS (60 fp/s). If the system is // causing lag then you should increase it to a value between 0.025 and 0.05. Anything higher // then 0.05 is seriously not recommended since it will look visually choppy. // NOTE: The system is INCREDIBLY efficient and it uses the struct-loop system (no H2I/attach // methods are used for the timer interval) so in 99% of cases you should never have to increase // the period private constant real period = 0.025 //************************************************************************* //* * * //* MINIMAP PROTECT ENGINE v3.10 * //* CONFIGURATION SETTINGS END HERE * * //* * * //************************************************************************* endglobals globals private trigger RegisterUnit = CreateTrigger() private gamecache mm_datacache private gamecache mm_handlecache private boolean cachefirst = true real test = 0 private group g = CreateGroup() //Stack for minimaphandler struct private integer array StructStack private integer array StructFreeStack private integer StructNumber = 0 private integer StructFreeNumber = -1 endglobals private function H2I takes handle h returns integer return h return 0 endfunction private function InitializeHandleCache takes nothing returns nothing call FlushGameCache(InitGameCache("mm_handlecache")) set mm_handlecache=InitGameCache("mm_handlecache") endfunction private function InitializeDataCache takes nothing returns nothing call FlushGameCache(InitGameCache("mm_datacache")) set mm_datacache=InitGameCache("mm_datacache") endfunction //Public Functions function GetUnitMiniMapIcon takes unit u returns integer if u == null then return 0 else return GetStoredInteger(mm_handlecache,I2S(H2I(u)),"0") endif endfunction struct minimapicon readonly boolean enabled = true readonly unit u readonly integer position //position in relation to struct stack static method Create takes unit u returns minimapicon local minimapicon mm = minimapicon.create() set mm.u = u if StructFreeNumber<0 then set mm.position = StructNumber set StructStack[StructNumber] = mm set StructNumber = StructNumber+1 else set mm.position = StructFreeStack[StructFreeNumber] set StructStack[mm.position] = mm set StructFreeStack[StructFreeNumber] = -1 set StructFreeNumber = StructFreeNumber-1 endif call StoreInteger(mm_handlecache,I2S(H2I(mm.u)),"0",mm) return mm endmethod method SetMiniMapIconDisplay takes boolean enabled returns nothing set this.enabled = enabled endmethod method GetMiniMapIconDisplay takes nothing returns boolean return this.enabled endmethod method onDestroy takes nothing returns nothing set StructStack[this.position] = -1 if (this.position>=(StructNumber-1)) then set StructNumber = StructNumber-1 else set StructFreeNumber = StructFreeNumber+1 set StructFreeStack[StructFreeNumber] = this.position endif set this.position = -1 call StoreInteger(mm_handlecache,I2S(H2I(this.u)),"0",0) set this.u = null endmethod endstruct //Public Functions function RegisterMiniMapIconDisplay takes integer UnitID, boolean enabled returns nothing local string s if cachefirst then call InitializeDataCache() set cachefirst = false endif set s = UnitId2String(UnitID) call StoreBoolean(mm_datacache,s,"exist",true) call StoreBoolean(mm_datacache,s,"enabled",enabled) endfunction private function MiniMapManager takes nothing returns nothing local integer i = 0 local minimapicon mm local player p = GetLocalPlayer() loop set mm = StructStack[i] if integer(mm) > -1 then if GetUnitTypeId(mm.u) == 0 then call mm.destroy() else if IsUnitVisible(mm.u, p) then if mm.enabled then call UnitSetUsesAltIcon(mm.u,false) else call UnitSetUsesAltIcon(mm.u,true) endif elseif InGame and GetLocalPlayer() == p then call UnitSetUsesAltIcon(mm.u,true) endif endif endif set i = i + 1 exitwhen i >= StructNumber endloop endfunction private function AddUnits takes unit u returns nothing local boolean enabled = true local minimapicon mm local string s set s = UnitId2String(GetUnitTypeId(u)) if GetStoredBoolean(mm_datacache,s,"exist") == true then set enabled = GetStoredBoolean(mm_datacache,s,"enabled") endif set mm = minimapicon.Create(u) endfunction private function TriggerAdder takes nothing returns boolean call AddUnits(GetTriggerUnit()) return true endfunction private function GroupAdder takes nothing returns nothing call AddUnits(GetEnumUnit()) endfunction private function AntiLeak takes nothing returns boolean return true endfunction private function FinalGroup takes nothing returns nothing call GroupAddUnit(g,GetEnumUnit()) endfunction private function Trig_MiniMap_Protect_Engine_Actions takes nothing returns nothing local timer t = CreateTimer() local integer i = 0 local group tempgroup local trigger enginestart = GetTriggeringTrigger() call DestroyTrigger(enginestart) set enginestart=null call SetAltMinimapIcon(MiniMapPath) call InitializeHandleCache() if cachefirst then call InitializeDataCache() set cachefirst = false endif loop exitwhen i > 15 set tempgroup = CreateGroup() call GroupEnumUnitsOfPlayer(tempgroup, Player(i), Filter( function AntiLeak)) call ForGroup(tempgroup, function FinalGroup) call DestroyGroup(tempgroup) set tempgroup = null set i = i + 1 endloop call ForGroup(g,function GroupAdder) call DestroyGroup(g) call TriggerRegisterEnterRectSimple(RegisterUnit, bj_mapInitialPlayableArea) call TriggerAddCondition(RegisterUnit, Condition (function TriggerAdder)) call TimerStart(t,period,true,function MiniMapManager) set t = null set tempgroup = null endfunction public function StartPreload takes nothing returns nothing call Preload(MiniMapPath) endfunction //=========================================================================== function InitTrig_MiniMap_Protect_Engine takes nothing returns nothing set gg_trg_MiniMap_Protect_Engine = CreateTrigger( ) call TriggerRegisterTimerEventSingle( gg_trg_MiniMap_Protect_Engine, 0.00) call TriggerAddAction( gg_trg_MiniMap_Protect_Engine, function Trig_MiniMap_Protect_Engine_Actions ) endfunction endlibrary AddSpecialEffect Emulator This is an emulator designed to replace AddSpecialEffect so that the FogProtect and Shadow Engine has the ability to pick up effects and hide them if they are not visible to a player (done by using AddSpecialEffectTarget on an invisible dummy unit) ![]() library AddSpecialEffectEx //************************************************************************* //* * * //* AddSpecialEffect EMULATOR v1.10 * //* CONFIGURATION SETTINGS START HERE * * //* * * //************************************************************************* globals //This is the rawcode for the dummy unit, make sure you update it as it changes between //maps. Also make sure that the model file for the AMHS (Dummy Unit) is the dummy.mdx //file which you should have also imported into your map private integer Dummy_UnitId = 'h000' // This is the Maximum time of any spell effect. You must designate a default time, so the // system at one point can clean up the dummy units used. 15 seconds is a good amount //(I seriously doubt any spell effect will last longer then 10 seconds) private real MaxSpellEffectTime = 15 // This is the interval period used by the system. 0.025 should be the LOWEST value, anything // lower is pointless since 0.025 matches Wc3's maximum FPS (60 fp/s). If the system is // causing lag then you should increase it to a value between 0.025 and 0.05. Anything higher // then 0.05 is seriously not recommended since it will look visually choppy. // NOTE: The system is INCREDIBLY efficient and it uses the struct-loop system (no H2I/attach // methods are used for the timer interval) so in 99% of cases you should never have to increase // the period private real period = 0.25 //************************************************************************* //* * * //* AddSpecialEffect EMULATOR v1.10 * //* CONFIGURATION SETTINGS END HERE * * //* * * //************************************************************************* endglobals globals private timer t private integer array StructStack private integer array StructFreeStack private integer StructNumber = 0 private integer StructFreeNumber = -1 endglobals struct specialeffectex string effectpath real timeout real x real y effect e unit u real customdeathtime = 0 integer position static method Create takes string modelname, real x , real y, boolean showdeath, real customdeathtime returns specialeffectex local specialeffectex se = specialeffectex.create() set se.x = x set se.y = y set se.u = CreateUnit(Player(15),Dummy_UnitId,x,y,0) call SetUnitX(se.u,x) call SetUnitY(se.u,y) set se.effectpath = modelname if showdeath then call DestroyEffect(AddSpecialEffectTarget(modelname,se.u,"origin")) else set se.e = AddSpecialEffectTarget(modelname,se.u,"origin") endif set se.customdeathtime = customdeathtime set se.timeout = TimerGetElapsed(t) if StructFreeNumber<0 then set se.position = StructNumber set StructStack[StructNumber] = se set StructNumber = StructNumber+1 else set se.position = StructFreeStack[StructFreeNumber] set StructStack[se.position] = se set StructFreeStack[StructFreeNumber] = -1 set StructFreeNumber = StructFreeNumber-1 endif return se endmethod method GetSpecialEffectExPath takes nothing returns string return this.effectpath endmethod method GetSpecialEffectExX takes nothing returns real return this.x endmethod method GetSpecialEffectExY takes nothing returns real return this.y endmethod method onDestroy takes nothing returns nothing set StructStack[this.position] = -1 if (this.position>=(StructNumber-1)) then set StructNumber = StructNumber-1 else set StructFreeNumber = StructFreeNumber+1 set StructFreeStack[StructFreeNumber] = this.position endif set this.position = -1 call ShowUnit(this.u,false) call SetUnitExploded(this.u, true) call KillUnit(this.u) set this.u = null if this.e != null then call DestroyEffect(this.e) endif set this.e = null endmethod endstruct function AddSpecialEffectEx takes string modelName, real x, real y returns integer local specialeffectex sf = specialeffectex.Create(modelName,x,y,false,0) return sf endfunction function AddSpecialEffectAdvancedEx takes string modelName, real x, real y, boolean ShowDestroy, real CustomDeathTime returns integer local specialeffectex sf = specialeffectex.Create(modelName,x,y,ShowDestroy,CustomDeathTime) return sf endfunction private function SpecialEffectExManager takes nothing returns nothing local specialeffectex se local integer counter = 0 local timer t = GetExpiredTimer() loop if (StructStack[counter]) > -1 then set se = StructStack[counter] if se.customdeathtime != 0 then if (TimerGetElapsed(t) - se.timeout) >= MaxSpellEffectTime then call se.destroy() endif else if (TimerGetElapsed(t) - se.timeout) >= se.customdeathtime then call se.destroy() endif endif endif set counter = counter + 1 exitwhen counter >= StructNumber endloop endfunction function Trig_AddSpecialEffect_Emulator_Actions takes nothing returns nothing set t = CreateTimer() call TimerStart(t,period,true,function SpecialEffectExManager) endfunction //=========================================================================== function InitTrig_AddSpecialEffect_Emulator takes nothing returns nothing set gg_trg_AddSpecialEffect_Emulator = CreateTrigger( ) call TriggerRegisterTimerEventSingle( gg_trg_AddSpecialEffect_Emulator, 0.00 ) call TriggerAddAction( gg_trg_AddSpecialEffect_Emulator, function Trig_AddSpecialEffect_Emulator_Actions ) endfunction endlibrary Changelog
Last edited by PandaMine : 04-13-2008 at 12:59 AM. Reason: Major Update |
|
![]() |
![]() |
Sponsored Links - Login to hide this ad! |
|
![]() |
#2 |
I blink, therefore I am.
Join Date: Sep 2006
Posts: 1,812
![]() ![]() ![]() ![]() |
![]() Selecting Fog Detect, in your demo map, causes the map to instantly crash (not using mh).
__________________It also seems like the demo map must be used in multi-player to see how it works. Would be better if there were invisible computer units or normal computer units so it is easy to test the different features. Last edited by Ammorth : 11-20-2007 at 02:00 AM. |
![]() |
![]() |
![]() |
#3 | |
Lackadaisically Absent.
Respected User
|
![]() Quote:
What if, uhhh, you have a unit with True Sight at that point which would reveal the unit? Did I miss something vitally important? |
|
![]() |
![]() |
![]() |
#4 |
User
Join Date: Oct 2006
Posts: 133
![]() |
![]() Nice that you keep on working on the system!
I will post it in DotA betaforums, maybe Ice can be convinced to test it... |
![]() |
![]() |
![]() |
#5 | |
Panda > You
|
![]() Quote:
If the original point does not specify the criteria (i.e. is not visible or reveals invisible units) then the system will search for a point that is visible but will not reveal invisible units |
|
![]() |
![]() |
![]() |
#6 |
Lackadaisically Absent.
Respected User
|
![]() How does the system...
__________________
Edit: You spelled "Griffen" wrong. Last edited by Pyrogasm : 11-20-2007 at 11:04 AM. |
![]() |
![]() |
![]() |
#7 |
Panda > You
|
![]() There has been an issue in multiplayer where the values have not been synced properly and therefore caused the systems not to work for other players, this has been fixed in v4.10
__________________@pyrogasm it uses the simple IsUnitVisible and IsVisibleToPlayer natives, im not sure what exactly you mean. It places an invisibly dummy unit in the specified point, it then uses IsVisibleToPlayer to check if the point is visible in the first place and then uses IsUnitVisible to check that the unit created at that point is not visible Thats what this is if IsVisibleToPlayer(x,y,Player(counter - 1)) and IsUnitVisible(udg_AMHS_InvisDummy,Player(counter - 1)) == false then Last edited by PandaMine : 11-20-2007 at 11:30 AM. |
![]() |
![]() |
![]() |
#8 |
master of fugue
Join Date: Jun 2007
Posts: 2,453
![]() ![]() ![]() ![]() ![]() |
![]() PandaMine will eventually piss PipeDream in making a maphack that fucks this
__________________![]() |
![]() |
![]() |
![]() |
#9 |
Lackadaisically Absent.
Respected User
|
![]() Well there ya go. I didn't even know either of those two natives existed, PandaMine.
__________________ |
![]() |
![]() |
![]() |
#10 | |
Panda > You
|
![]() Quote:
Something with your computer, I just tested it on 3 computers and there is no problem, you sure you dont have any injected dll's?. For multiplayer testing the demo map will create a hero for every player (computer or real) and that hero can summon invisible units as well as other abilities (like sentry ward and far sight) |
|
![]() |
![]() |
![]() |
#12 |
User
Join Date: Feb 2007
Posts: 5
![]() |
![]() the MiniMap Protect Engine rather amuzed me(seems to be almost best method I even known).But the function In the demo map(I download the 4.1 version) had a mistake that the a unit would not shows its icon any longer if
it had been hiden once(an else..endif seems to be put the wrong place). what could be improved is that the engine has not tell the structs and neutral buildings that should have an icon in the fog. |
![]() |
![]() |
![]() |
#13 |
Panda > You
|
![]() I will have a look into that
__________________EDIT: Thanks for your help, it was a misplaced if -then-else Last edited by PandaMine : 12-08-2007 at 01:00 AM. |
![]() |
![]() |
![]() |
#14 |
Panda > You
|
![]() There has been a huge update to AMHS v4.30, please refer to the changelog for more information
__________________ |
![]() |
![]() |
![]() |
#15 |
Panda > You
|
![]() There has been was an issue with the MH in v4.30 that randomly crashed the map, it has been fixed in v4.40 (only the dummy unit has changed)
__________________ |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
|