[vJass] Anti Backdoor

Post Reply
User avatar
Site Admin
Site Admin
Posts: 202
Joined: Sat Sep 15, 2018 1:57 pm
Location: Florida, U.S.A.
Website: http://chaosrealm.co/memberlist.php?mod ... rofile&u=2
Discord: https://discord.gg/BUEZkef
Twitch: https://www.twitch.tv/enalias
Contact:

[vJass] Anti Backdoor

#1

Post by Enalias »

Make buildings invulnerable if there's no a creep around
Useful for AoS maps

Created by: Fire_Arkangel

Code:
Spoiler
Show
//==========================================================
//ANTIBACKDOOR [DOTA REMAKE]
//VERSION: 1.0
//----------------------------------------------------------
//Make buildings invulnerable if there's no an creep around
//==========================================================
// CREATED BY: FIRE_ARKANGEL
//----------------------------------------------------------
//IF YOU FIND ANY BUG, SEND A E-MAIL TO:
//abner.math.c@gmail.com
//==========================================================
scope Antibackdoor

private struct System extends array

//CONFIGURATIONS:
private static constant real RADIUS_DETECTION = 800.0 //DETECTION OF CREEPS AROUND BUILDINGS
private static constant real PERIODIC_TIME = 0.1 //TIME TO CHECK IF THERE'S CREEPS AROUND
//------------------------------------------------------------------------------------------
private static method periodic takes nothing returns nothing
local group g
local unit u
local real x
local real y
local integer i
set bj_lastCreatedGroup = CreateGroup()
call GroupEnumUnitsInRect(bj_lastCreatedGroup, bj_mapInitialPlayableArea, null)
loop
set bj_lastCreatedUnit = FirstOfGroup(bj_lastCreatedGroup)
exitwhen bj_lastCreatedUnit == null
if IsUnitType(bj_lastCreatedUnit, UNIT_TYPE_STRUCTURE) then
set g = CreateGroup()
set x = GetUnitX(bj_lastCreatedUnit)
set y = GetUnitY(bj_lastCreatedUnit)
set i = 0
call GroupEnumUnitsInRange(g, x, y, RADIUS_DETECTION, null)
loop
set u = FirstOfGroup(g)
exitwhen u == null
if IsUnitAlly(u, GetOwningPlayer(bj_lastCreatedUnit)) and GetWidgetLife(u) > 0.405 and not IsUnitType(u, UNIT_TYPE_STRUCTURE) then
set i = i + 1
endif
call GroupRemoveUnit(g, u)
endloop
call DestroyGroup(g)
call SetUnitInvulnerable(bj_lastCreatedUnit, (i == 0))
endif
call GroupRemoveUnit(bj_lastCreatedGroup, bj_lastCreatedUnit)
endloop
call DestroyGroup(bj_lastCreatedGroup)
set g = null
set u = null
endmethod

private static method onInit takes nothing returns nothing
call TimerStart(CreateTimer(), PERIODIC_TIME, true, function thistype.periodic)
endmethod

endstruct

endscope
You do not have the required permissions to view the files attached to this post.
Post Reply

Return to “Systems”