Elaborating on Anti harass system like dota's

RaiJin

New Member
Reaction score
40
JASS:
library AH initializer Anti_Init requires PUI

globals
    private boolean array IsActive
    public  real array  prevX
    public  real array  prevY
    private group array creeps
    private trigger     IssueOrderPoint = CreateTrigger()
    private trigger     IssueOrderTarg  = CreateTrigger()
    private trigger     IssueOrderCreep = CreateTrigger()
endglobals

//My Locals
globals
    private integer unitid
    private unit    first
endglobals

private function HeroFilter takes nothing returns boolean
    return IsUnitType(GetAttacker(),UNIT_TYPE_HERO) and IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO) and IsUnitEnemy(GetAttacker(),GetOwningPlayer(GetTriggerUnit()))
endfunction

private function CreepFilterTarget takes nothing returns boolean
    return IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO)==false and IsUnitType(GetAttacker(),UNIT_TYPE_HERO)==true
endfunction

private function CreepFilter takes nothing returns boolean
    local integer unitid = GetUnitTypeId(GetFilterUnit())
    if IsActive[GetUnitIndex(GetFilterUnit())] then
        return false
    endif
    return (unitid == 'h005' or unitid =='h008' or unitid =='h00A') and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(first))==true
endfunction

private function CreepAttack takes nothing returns nothing
    call IssueTargetOrder(GetEnumUnit(),"attack",first)
    set IsActive[GetUnitIndex(GetEnumUnit())]=true
endfunction

private function PointC takes nothing returns boolean
    return IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO)==true
endfunction

private function antiend takes nothing returns nothing
    set first=GetTriggerUnit()
    set unitid=GetUnitIndex(first)
    if creeps[unitid]==null then
        return
    endif
    loop
        set first=FirstOfGroup(creeps[unitid])
        exitwhen first==null
        call GroupRemoveUnit(creeps[unitid],first)
        call IssueImmediateOrder(first,"holdposition")
        call IssuePointOrder(first,"attack",prevX[GetUnitIndex(first)],prevY[GetUnitIndex(first)])
        set IsActive[GetUnitId(first)]=false
    endloop
endfunction

private function antiendCREEP takes nothing returns nothing
    set first=GetAttacker()
    set unitid=GetUnitIndex(first)
    if creeps[unitid]==null then
        return
    endif
    loop
        set first=FirstOfGroup(creeps[unitid])
        exitwhen first==null
        call GroupRemoveUnit(creeps[unitid],first)
        call IssueImmediateOrder(first,"holdposition")
        call IssuePointOrder(first,"attack",prevX[GetUnitIndex(first)],prevY[GetUnitIndex(first)])
        set IsActive[GetUnitId(first)]=false
    endloop
endfunction

private function antistart takes nothing returns nothing
    set first=GetAttacker()
    set unitid=GetUnitIndex(first)
    if creeps[unitid]==null then
        set creeps[unitid]=CreateGroup()
    endif
    call GroupEnumUnitsInRange(creeps[unitid],GetUnitX(first),GetUnitY(first),425,Condition(function CreepFilter))
    call ForGroup(creeps[unitid],function CreepAttack)
endfunction

private function Anti_Init takes nothing returns nothing
    local integer i  = 0
    loop
        call TriggerRegisterPlayerUnitEvent(IssueOrderTarg , Player(i),EVENT_PLAYER_UNIT_ATTACKED,           null)
        call TriggerRegisterPlayerUnitEvent(IssueOrderCreep ,Player(i),EVENT_PLAYER_UNIT_ATTACKED,           null)
        call TriggerRegisterPlayerUnitEvent(IssueOrderPoint, Player(i),EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, null)
        call TriggerRegisterPlayerUnitEvent(IssueOrderPoint, Player(i),EVENT_PLAYER_UNIT_ISSUED_UNIT_ORDER , null)
        set i=i+1
        exitwhen i==12
    endloop
    set i=0
    loop
        set IsActive<i>=false
        set i=i+1
        exitwhen i==100
    endloop
    call TriggerAddCondition(IssueOrderTarg, Condition(function HeroFilter       ))
    call TriggerAddCondition(IssueOrderCreep,Condition(function CreepFilterTarget))
    call TriggerAddCondition(IssueOrderPoint,Condition(function PointC           ))
    call TriggerAddAction   (IssueOrderTarg,           function antistart        )
    call TriggerAddAction   (IssueOrderCreep,          function antiendCREEP     )
    call TriggerAddAction   (IssueOrderPoint,          function antiend          )
endfunction

endlibrary</i>


so i thought that i might try to recreate dota's anti harass system, i thought it was first done by priorities, but i guess its not. Unless it is then this was a huge waste of time.

But anyhow this is how my idea goes, as soon as the creeps spawn for top, mid and bot, we store the value's of where they are going..inside the array prevX, prevY.., then when a unit attacks... and the other unit is a hero, we take all the units around the attacker and make them attack it thus, anti harass... we store all these units into a group. Then we check when the attacker stops harrasing the other hero, so then we order the units to attack the point it was going to..

though is there anyway to improve on this? and sometimes the creeps don't stop attacking even if the hero isn't harassing anymore

IsActive boolean is to check if the creeps are already attacking a harrasser
 

waaaks!

Zinctified
Reaction score
256
dota uses regions and dummy abilities
if a unit enters this region, give this ability, and in their creep agro trigger, when the units are enumerated and ordered to attack that target, after some timer, check if it has this ability, if it has this ability, then order the unit to that region

heres my version, much shorter than dota, but it causes bug when picking all units in the map, pausing them, and after some time, unpausing them (some sort of arena used by my friend) but there's no problem with this code in my map

when 1.24 was released, last order updated, and last order uses UIU, most people uses autoindex (like me), so we changed UIU with autoindex in the required library for last order, now it SOMETIMES causes bug (if u used lastorder with a required library autoindex)

if you want to use this library in your map, download lastorder and don't change the required field in it, and put this code into your map

no need to configure the codes, just configure the global variables
JASS:
library CreepAgro initializer init needs LastOrder, AutoIndex
//by: waaaks!
globals
    private constant real RADIUS = 450.0
    private constant real RETURN_TIME = 3.0

    private boolean array run
    private boolean array ordered
    private string array order
    private real array ox
    private real array oy
    private widget array ot
    private integer array otype
endglobals

private struct data
    group e
endstruct

private function tick takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local data d = GetTimerData(t)
    local unit u
    loop
        set u = FirstOfGroup(d.e)
        exitwhen u == null
        if otype[GetUnitId(u)] == ORDER_TYPE_TARGET then
            call IssueTargetOrder(u,order[GetUnitId(u)],ot[GetUnitId(u)])
        elseif otype[GetUnitId(u)] == ORDER_TYPE_POINT then
            call IssuePointOrder(u,order[GetUnitId(u)],ox[GetUnitId(u)],oy[GetUnitId(u)])
        elseif otype[GetUnitId(u)] == ORDER_TYPE_IMMEDIATE then
            call IssueImmediateOrder(u,order[GetUnitId(u)])
        endif
        set ordered[GetUnitId(u)] = false
        set run[GetUnitId(u)] = false
        call GroupRemoveUnit(d.e,u)
    endloop
    call ReleaseGroup(d.e)
    call ReleaseTimer(t)
    call d.destroy()
    set t = null
    set u = null
endfunction

private function con takes nothing returns boolean
    return IsUnitType(GetOrderTargetUnit(),UNIT_TYPE_HERO) and GetIssuedOrderId() == 851983 and IsUnitEnemy(GetOrderTargetUnit(),GetOwningPlayer(GetTriggerUnit()))
endfunction

private function filter takes nothing returns boolean
    return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(GetOrderTargetUnit())) and not IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO) and (GetOwningPlayer(GetFilterUnit()) == Player(0) or GetOwningPlayer(GetFilterUnit()) == Player(6))
endfunction

private function act takes nothing returns nothing
    local timer t = NewTimer()
    local data d = data.create()
    local unit trg = GetTriggerUnit()
    local group g = NewGroup()
    local unit u
    set d.e = NewGroup()
    call GroupEnumUnitsInRange(g,GetUnitX(trg),GetUnitY(trg),RADIUS,Condition(function filter))
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        if not run[GetUnitId(u)] then
            set run[GetUnitId(u)] = true
            set order[GetUnitId(u)] = GetLastOrderString(u)
            set otype[GetUnitId(u)] = GetLastOrderType(u)
            if otype[GetUnitId(u)] == ORDER_TYPE_POINT then
                set ox[GetUnitId(u)] = GetLastOrderX(u)
                set oy[GetUnitId(u)] = GetLastOrderY(u)
            elseif otype[GetUnitId(u)] == ORDER_TYPE_TARGET then
                set ot[GetUnitId(u)] = GetLastOrderTarget(u)
            endif
        endif
        if IsUnitVisible(GetTriggerUnit(),GetOwningPlayer(u)) and not ordered[GetUnitId(u)] then
            call DisableTrigger(GetTriggeringTrigger())
            call IssueTargetOrder(u,&quot;attack&quot;,trg)
            set ordered[GetUnitId(u)] = true
            call EnableTrigger(GetTriggeringTrigger())
        endif
        call GroupAddUnit(d.e,u)
        call GroupRemoveUnit(g,u)
    endloop
    call ReleaseGroup(g)
    call TimerStart(t,RETURN_TIME,false,function tick)
    call SetTimerData(t,d)
    set g = null
    set trg = null
    set t = null
    set u = null
endfunction

//===========================================================================
private function init takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
    call TriggerAddCondition(t,Condition(function con))
    call TriggerAddAction( t, function act )
endfunction

endlibrary
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
You can use LastOrder Library by Rising Dusk which you can find it in wc3c.net
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    Sticking with the desserts for now the latest recipe is Fried Apple Pies - https://www.thehelper.net/threads/recipe-fried-apple-pies.194297/
  • The Helper The Helper:
    Finally finding about some of the bots that are flooding the users online - bytespider apparently is a huge offender here - ignores robots.txt and comes in from a ton of different IPs
  • Monovertex Monovertex:
    @The Helper I'm really not seeing the "Signature" link in the sidebar on that page. Here's a screenshot:
  • The Helper The Helper:
    I have reported it - I was wondering why nobody I have given sigs to over the last few years have used them
  • The Helper The Helper:
    Ghan has said he has fixed this. Monovertex please confirm this fix. This was only a problem with people that had signatures in the upper levels like not the special members but the respected members.
  • The Helper The Helper:
    Here is a better place to manage this stuff https://www.thehelper.net/account/account-details which I think should be way more visible
  • The Helper The Helper:
    I am hoping that online user count drop is finally that TikTok bot banned
  • Ghan Ghan:
    I added the filter last night.
  • The Helper The Helper:
    They are still there

      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