• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] This trigger no more working and i haven't touched this trigger.

Status
Not open for further replies.
Level 17
Joined
Jun 2, 2009
Messages
1,139
Hello everyone. I don't know about Jass and this trigger made by my friend.
When you attack enemy hero and if there are any creeps (friendly units) around them, attack the attacker
Example: Blue Paladin attacks Green Paladin
Allied units around Green Paladin attacks Blue Paladin

I don't know about jass coding, i haven't touched this trigger and today i have realized it is not working.

Side note: This jass was a flaws. Blue Archmage have a friendly Red footmans around it.
Green Archmage have a friendly Purple footmans around it.
When Blue Archmage attacks Green Archmage, the Purple Footmans are attacking Blue Paladin BUT friends around Red Paladin wsas attacking Green Archmage as well. It was a bug

Do you have an idea what can cause break this code?

JASS:
library CreepSystem initializer Init
 
globals
    private constant real CREEP_ATTACK_FOG_REVEAL_TIME = 1.00
   
    private constant integer CREEP_ABILITY_ID = 'A0E6'
 

    public integer HeroIndex = 0
   
   
    private boolean OBS = false
    private constant integer ORDER_ID_MOVE = 851986
    //private constant integer STOP_ORDER_ID =
    private constant integer ORDER_ID_SMART = 851971
    private constant integer ORDER_ID_ATTACK = 851983
    private unit array HeroAttacker
endglobals
 
public function IsClanUnit takes unit u returns boolean
    return GetOwningPlayer(u) == udg_ClanDevilPlayer or GetOwningPlayer(u) == udg_ClanReaperPlayer
endfunction
 
public function IsRealHero takes unit u returns boolean
    return IsUnitType(u, UNIT_TYPE_HERO) == true and IsUnitIllusion(u) == false // and types
endfunction
 
public function CreepContinueSingle takes unit creep returns nothing
    if GetOwningPlayer(creep) == udg_ClanDevilPlayer then
        call IssuePointOrderLoc(creep, "attack", udg_DevilNextHedef[GetUnitAbilityLevel(creep, CREEP_ABILITY_ID)])
    elseif GetOwningPlayer(creep) == udg_ClanReaperPlayer then
        call IssuePointOrderLoc(creep, "attack", udg_ReaperNextHedef[GetUnitAbilityLevel(creep, CREEP_ABILITY_ID)])
    endif
endfunction
 
///////////////////////////////////////////////////////////////
 
private function RemoveCreepAttackReveal takes nothing returns nothing // function T2I
    local timer t = GetExpiredTimer()
    local fogmodifier f = LoadFogModifierHandle(udg_hash, GetHandleId(t), 0)
    call FogModifierStop(f)
    call DestroyFogModifier(f)
    call FlushChildHashtable(udg_hash, GetHandleId(t))
    call PauseTimer(t)
    call DestroyTimer(t)
    set t = null
    set f = null
endfunction
 
private function CreepAttackReveal takes player p, real time returns nothing // function T3I
    local timer t = CreateTimer()
    local fogmodifier f = CreateFogModifierRadius(p, FOG_OF_WAR_VISIBLE, GetUnitX(GetAttacker()), GetUnitY(GetAttacker()), 128.00, true, false)
    call FogModifierStart(f)
    call SaveFogModifierHandle(udg_hash, GetHandleId(t), 0, f)
    call TimerStart(t, time, false, function RemoveCreepAttackReveal)
    set t = null
    set f = null
endfunction
 
 
function CreepAttackVision takes nothing returns boolean // function NVO
    if GetOwningPlayer(GetTriggerUnit()) == udg_ClanDevilPlayer then
        if IsUnitFogged(GetAttacker(), udg_DevilPlayersArray[1]) or IsUnitFogged(GetAttacker(), udg_ReaperPlayersArray[1]) then
            call CreepAttackReveal(udg_DevilPlayersArray[1], CREEP_ATTACK_FOG_REVEAL_TIME)
        endif
    elseif GetOwningPlayer(GetTriggerUnit()) == udg_ClanReaperPlayer then
        if IsUnitFogged(GetAttacker(), udg_DevilPlayersArray[1]) or IsUnitFogged(GetAttacker(), udg_ReaperPlayersArray[1]) then
            call CreepAttackReveal(udg_ReaperPlayersArray[1],CREEP_ATTACK_FOG_REVEAL_TIME)
        endif
    endif
    return false
endfunction
 
private function RegisterClanUnits takes nothing returns nothing // function NEO
    local unit centerUnit = GetTriggerUnit()
    local unit attacker = HeroAttacker[GetUnitUserData(centerUnit)]
    call SetUnitPosition(centerUnit, GetUnitX(centerUnit), GetUnitY(centerUnit))
    if attacker != null and GetWidgetLife(attacker) > 0 and IsUnitVisible(attacker, GetOwningPlayer(attacker)) then
        call IssueTargetOrder(centerUnit, "attack", attacker)
    else
        call DisableTrigger(GetTriggeringTrigger())
        call CreepContinueSingle(centerUnit)
        //call IssuePointOrderLoc(centerUnit, "attack", udg_CreepHedefler[GetUnitAbilityLevel(centerUnit, CREEP_ABILITY_ID)])
        call EnableTrigger(GetTriggeringTrigger())
    endif
    set centerUnit = null
    set attacker = null
endfunction
 
private function CheckClanUnits takes nothing returns boolean // function NGO
    if IsClanUnit(GetTriggerUnit()) then
        call RegisterClanUnits()
    endif
    return false
endfunction
 
private function CreepHeroAttack takes nothing returns nothing // function NHO
    local unit mover = GetTriggerUnit()
    local unit heroAttacker = HeroAttacker[GetUnitUserData(mover)]
    call SetUnitPosition(mover, GetUnitX(mover), GetUnitY(mover))
    //call BJDebugMsg("B")
    if heroAttacker != null and GetWidgetLife(heroAttacker) > 0 and IsUnitVisible(heroAttacker, GetOwningPlayer(heroAttacker)) then
        call IssueTargetOrder(mover, "attack", heroAttacker)
    else
        call DisableTrigger(GetTriggeringTrigger())
        call CreepContinueSingle(mover)
        //call IssuePointOrderLoc(mover, "attack", udg_[GetUnitAbilityLevel(mover, CREEP_ABILITY_ID)])
        call EnableTrigger(GetTriggeringTrigger())
    endif
    set mover = null
    set heroAttacker = null
endfunction
 
private function CheckOrder takes nothing returns boolean // function NZO
    if GetIssuedOrderId() == ORDER_ID_MOVE then
        //call BJDebugMsg("C")
        call CreepHeroAttack()
    endif
    return false
endfunction
 
function Alliance takes nothing returns nothing
    local integer x = 0
    local integer y = 0
 
    call SetAllyColorFilterState(0)
   
    loop
        exitwhen x>5
        call SetPlayerAlliance(Player(0),udg_DevilPlayersArray[x],ALLIANCE_PASSIVE,true)
        call SetPlayerAlliance(Player(0),udg_DevilPlayersArray[x],ALLIANCE_SHARED_SPELLS,true)
        call SetPlayerAlliance(Player(0),udg_ReaperPlayersArray[x],ALLIANCE_PASSIVE,false)
        call SetPlayerAlliance(Player(0),udg_ReaperPlayersArray[x],ALLIANCE_SHARED_SPELLS,false)
        set x=x+1
    endloop
   
   
    set x=0
    set y=0
    loop
        exitwhen x>5
        loop
            exitwhen y>5
            if(x!=y)then
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_PASSIVE,true)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_HELP_REQUEST,true)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_HELP_RESPONSE,true)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_SHARED_XP,true)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_SHARED_SPELLS,true)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_SHARED_VISION,true)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_SHARED_CONTROL,false)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_SHARED_ADVANCED_CONTROL,false)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_PASSIVE,true)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_HELP_REQUEST,true)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_HELP_RESPONSE,true)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_SHARED_XP,true)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_SHARED_SPELLS,true)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_SHARED_VISION,true)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_SHARED_CONTROL,false)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_SHARED_ADVANCED_CONTROL,false)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_PASSIVE,false)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_HELP_REQUEST,false)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_HELP_RESPONSE,false)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_SHARED_XP,false)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_SHARED_SPELLS,false)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_SHARED_VISION,false)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_SHARED_CONTROL,false)
                call SetPlayerAlliance(udg_DevilPlayersArray[x],udg_ReaperPlayersArray[y],ALLIANCE_SHARED_ADVANCED_CONTROL,false)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_PASSIVE,false)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_HELP_REQUEST,false)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_HELP_RESPONSE,false)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_SHARED_XP,false)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_SHARED_SPELLS,false)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_SHARED_VISION,false)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_SHARED_CONTROL,false)
                call SetPlayerAlliance(udg_ReaperPlayersArray[x],udg_DevilPlayersArray[y],ALLIANCE_SHARED_ADVANCED_CONTROL,false)
            endif
            set y=y+1
        endloop
        set y=0
        set x=x+1
    endloop
endfunction
 
private function CreepsContinueWay takes nothing returns nothing //function MTO
    // set custom value to 0?
    call SetUnitUserData(GetEnumUnit(), 0)
    call CreepContinueSingle(GetEnumUnit())
    //call IssuePointOrderLoc(GetEnumUnit(), "attack", udg_CreepHedefler[GetUnitAbilityLevel(GetEnumUnit(), CREEP_ABILITY_ID)])
endfunction
 
private function CreepAttackTimerCallback takes nothing returns nothing // function MUO
    local integer id = GetHandleId(LoadUnitHandle(udg_hash, GetHandleId(GetExpiredTimer()), 2))
    local integer heroIndex = LoadInteger(udg_hash, id, 143)
    local group g = LoadGroupHandle(udg_hash, id, 144)
    set HeroAttacker[heroIndex] = null
    call ForGroup(g, function CreepsContinueWay)
    call GroupClear(g)
    set g = null
endfunction
 
private function FilterCreepAttack takes nothing returns boolean // function MPO
    local integer id = GetUnitTypeId(GetFilterUnit())
    if id == 0 then // other ids here
        return false
    endif
    if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_TempUnit)) and IsClanUnit(GetFilterUnit()) and GetUnitUserData(GetFilterUnit()) == 0 then // and custom value equal to 0
        return true
    endif
    return false
endfunction
 
private function CallbackCreepAttack takes nothing returns nothing //function MRO upper function's callback
    call IssueTargetOrder(GetEnumUnit(), "attack", udg_TempUnit)
    call GroupAddUnit(udg_TempGroup, GetEnumUnit())
    call SetUnitUserData(GetEnumUnit(), udg_TempInteger)
    // set custom value of picked unit to targetIndex
endfunction
 
private function CreepsContinueWay2 takes nothing returns nothing // function MQO
    if GetUnitCurrentOrder(GetEnumUnit()) == 0 and IsUnitInRange(GetEnumUnit(), udg_TempUnit, GetUnitAcquireRange(GetEnumUnit())) == false then
        call GroupRemoveUnit(udg_TempGroup, GetEnumUnit())
        // set custom value to 0?
        call SetUnitUserData(GetEnumUnit(), 0)
        call CreepContinueSingle(GetEnumUnit())
        //call IssuePointOrderLoc(GetEnumUnit(), "attack", udg_CreepHedefler[GetUnitAbilityLevel(GetEnumUnit(), CREEP_ABILITY_ID)])
    endif
endfunction
 
private function SetHeroAttacker takes unit target, unit starter returns nothing//function N1O
    local integer id = GetHandleId(target)
    local group g = LoadGroupHandle(udg_hash, id, 144)
    local integer targetIndex = LoadInteger(udg_hash, id, 143)
    local unit heroAttacker = HeroAttacker[targetIndex]
    local group g2 = CreateGroup()
   
    if heroAttacker != null and heroAttacker != starter then
        call ForGroup(g, function CreepsContinueWay)
        call GroupClear(g)
    endif
   
    set HeroAttacker[targetIndex] = starter
    set udg_TempGroup = g
    set udg_TempUnit = starter
    set udg_TempInteger = targetIndex
    call ForGroup(g, function CreepsContinueWay2)
    call GroupEnumUnitsInRange(g2, GetUnitX(target), GetUnitY(target), 500.00, Condition(function FilterCreepAttack))
    call ForGroup(g2, function CallbackCreepAttack)
    call TimerStart(LoadTimerHandle(udg_hash, GetHandleId(target), 141), 2.00, false, function CreepAttackTimerCallback)
   
    call DestroyGroup(g2)
    set g2 = null
    set g = null
    set heroAttacker = null
endfunction
 
function HeroOrderingTarget takes nothing returns boolean // function N2O
    local unit orderer = GetTriggerUnit()
    local unit orderTarget = GetOrderTargetUnit()
    local integer orderId = GetIssuedOrderId()
    local integer orderTargetIndex
    if IsRealHero(orderTarget) and (orderId != ORDER_ID_MOVE or orderId != ORDER_ID_SMART) and IsUnitEnemy(orderer, GetOwningPlayer(orderTarget)) and IsUnitVisible(orderer, GetOwningPlayer(orderTarget)) then
        set orderTargetIndex = LoadInteger(udg_hash, GetHandleId(orderTarget), 143)
        if HeroAttacker[orderTargetIndex] == null or HeroAttacker[orderTargetIndex] == orderTarget or GetWidgetLife(HeroAttacker[orderTargetIndex]) <= 0 then
            if orderTargetIndex != 0 then
                call SetHeroAttacker(orderTarget, orderer)
            endif
        endif
    endif
    return false
endfunction
 
function HeroGettingAttacked takes nothing returns boolean // function N4O
    local unit attacker = GetAttacker()
    local unit attackedHero = GetTriggerUnit()
    local integer attackedIndex
    if IsClanUnit(attacker) == false then
        set attackedIndex = LoadInteger(udg_hash, GetHandleId(attackedHero), 143)
        if HeroAttacker[attackedIndex] == null or HeroAttacker[attackedIndex] == attackedHero or GetWidgetLife(HeroAttacker[attackedIndex]) <= 0 then
            if attackedIndex != 0 then
                call SetHeroAttacker(attackedHero, attacker)
            endif
        endif
    endif
    set attacker = null
    set attackedHero = null
    return false
endfunction
 
private function HeroEnteredGame takes unit hero returns nothing // function N5O
    local group g
    local trigger tr
    local timer t
    local integer id = GetHandleId(hero)
    set HeroIndex = HeroIndex + 1
    call SaveBoolean(udg_hash, id, 142, true)
    call SaveInteger(udg_hash, id, 143, HeroIndex)
    call SaveGroupHandle(udg_hash, id, 144, CreateGroup())
   
    set tr = CreateTrigger()
    call TriggerRegisterUnitEvent(tr, hero, EVENT_UNIT_ISSUED_TARGET_ORDER)
    call TriggerAddCondition(tr, Condition(function HeroOrderingTarget))
   
    set tr = CreateTrigger()
    call TriggerRegisterUnitEvent(tr, hero, EVENT_UNIT_ATTACKED)
    call TriggerAddCondition(tr, Condition(function HeroGettingAttacked))
   
    set t = CreateTimer()
    call SaveTimerHandle(udg_hash, id, 141, t)
    call SaveUnitHandle(udg_hash, GetHandleId(t), 2, hero)
   
    set g = null
    set t = null
    set tr = null
endfunction
 
private function HeroEntersGame takes nothing returns boolean // function N6O
    if IsRealHero(GetTriggerUnit()) and LoadBoolean(udg_hash, GetHandleId(GetTriggerUnit()), 142) == false then
        call HeroEnteredGame(GetTriggerUnit())
    endif
    return false
endfunction
 
private function RemoveCreepGuardPos takes nothing returns boolean
    if IsClanUnit(GetTriggerUnit()) and GetUnitAbilityLevel(GetTriggerUnit(), CREEP_ABILITY_ID) > 0 then
        if GetOwningPlayer(GetTriggerUnit()) == udg_ClanDevilPlayer then
           // call BJDebugMsg("A")
            call SetUnitOwner(GetTriggerUnit(), Player(1), false)
            call SetUnitCreepGuard(GetTriggerUnit(), false)
            call RemoveGuardPosition(GetTriggerUnit())
            call SetUnitOwner(GetTriggerUnit(), udg_ClanDevilPlayer, false)
        else
            call SetUnitOwner(GetTriggerUnit(), Player(7), false)
            call SetUnitCreepGuard(GetTriggerUnit(), false)
            call RemoveGuardPosition(GetTriggerUnit())
            call SetUnitOwner(GetTriggerUnit(), udg_ClanReaperPlayer, false)
        endif
    endif
   
    return false
endfunction
 
private function Register takes nothing returns boolean // function NWO and BO1
    local trigger t
    local group g
    local unit u
    local region re
    set OBS = GetPlayerController(Player(0)) == MAP_CONTROL_USER or GetPlayerController(Player(6)) == MAP_CONTROL_USER
    if OBS then
        call SetAllyColorFilterState(0)
        call Alliance()
   
        set t = CreateTrigger()
        call TriggerRegisterPlayerUnitEvent(t, udg_ClanDevilPlayer, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, null)
        call TriggerRegisterPlayerUnitEvent(t, udg_ClanReaperPlayer, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, null)
        call TriggerAddCondition(t, Condition(function CheckOrder))
        //call BJDebugMsg("D")
       
        set t = CreateTrigger()
        set g = CreateGroup()
        call GroupEnumUnitsOfPlayer(g, udg_ClanDevilPlayer, null)
        loop
            set u = FirstOfGroup(g)
            exitwhen u == null
            call GroupRemoveUnit(g, u)
            if GetUnitAcquireRange(u) != 0 then
                call TriggerRegisterUnitInRange(t, u, 600.00, null)
            endif
        endloop
        call GroupClear(g)
       
        call GroupEnumUnitsOfPlayer(g, udg_ClanReaperPlayer, null)
        loop
            set u = FirstOfGroup(g)
            exitwhen u == null
            call GroupRemoveUnit(g, u)
            // WHY THIS IF STATEMENT HAS STRUCTURE PART???
            if GetUnitAcquireRange(u) != 0 and IsUnitType(u, UNIT_TYPE_STRUCTURE) then
                call TriggerRegisterUnitInRange(t, u, 600.00, null)
            endif
        endloop
        call GroupClear(g)
        call DestroyGroup(g)
        call TriggerAddCondition(t, Condition(function CheckClanUnits))
       
        set t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED)
        call TriggerAddCondition(t, Condition(function CreepAttackVision))
       
       
       
    endif
   
    set t = CreateTrigger()
    set re = CreateRegion()
    call RegionAddRect(re, GetWorldBounds())
    call TriggerRegisterEnterRegion(t, re, null)
    call TriggerAddCondition(t, Condition(function HeroEntersGame))
   
    //set t = CreateTrigger()
    //set re = CreateRegion()
    //call RegionAddRect(re, GetWorldBounds())
    //call TriggerRegisterEnterRegion(t, re, null)
    //call TriggerAddCondition(t, Condition(function RemoveCreepGuardPos))
    
    set udg_ClanDevilPlayers = GetPlayersAllies(udg_ClanDevilPlayer)
    call ForceRemovePlayer(udg_ClanDevilPlayers, udg_ClanDevilPlayer)
    set udg_ClanDevilPlayerCount = CountPlayersInForceBJ(udg_ClanDevilPlayers)
    
    set udg_ClanReaperPlayers = GetPlayersAllies(udg_ClanReaperPlayer)
    call ForceRemovePlayer(udg_ClanReaperPlayers, udg_ClanReaperPlayer)
    set udg_ClanReaperPlayerCount = CountPlayersInForceBJ(udg_ClanReaperPlayers)
   
    call DisableTrigger(GetTriggeringTrigger())
   
    set t = null
    set g = null
    set u = null
    set re = null
   
    return false
endfunction
 
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterTimerEvent(t, 0.50, false)
    call TriggerAddCondition(t, Condition(function Register))
endfunction
 
endlibrary
 
Level 20
Joined
Feb 27, 2019
Messages
592
It seems you recently added a unit indexer.

Youll need to replace anything that uses call SetUnitUserData(unit, integer) and GetUnitUserData(u) which would be equal to setting and getting the custom value of unit.

Id think you could replace the custom value of unit with a global integer array that you create.

Instead of SetUnitUserData(unit, integer), do Set udg_CreepIndex(GetUnitUserData(u)) = integer
Instead of GetUnitUserData(u), do udg_CreepIndex(GetUnitUserData(u))

You can pick a better name for the new variable since it seems it will be used to determine if the unit is attacking something or attack moving along the lane.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,139
It seems you recently added a unit indexer.

Youll need to replace anything that uses call SetUnitUserData(unit, integer) and GetUnitUserData(u) which would be equal to setting and getting the custom value of unit.

Id think you could replace the custom value of unit with a global integer array that you create.

Instead of SetUnitUserData(unit, integer), do Set udg_CreepIndex(GetUnitUserData(u)) = integer
Instead of GetUnitUserData(u), do udg_CreepIndex(GetUnitUserData(u))

You can pick a better name for the new variable since it seems it will be used to determine if the unit is attacking something or attack moving along the lane.
Yes. Yesterday i was realized i was forgot the turn off unit indexer and released my version. But i haven't marked it as solved because of this.
Side note: This jass was a flaws. Blue Archmage have a friendly Red footmans around it.
Green Archmage have a friendly Purple footmans around it.
When Blue Archmage attacks Green Archmage, the Purple Footmans are attacking Blue Paladin BUT friends around Red Paladin wsas attacking Green Archmage as well. It was a bug
I will find someone who can read this code or i will create it as gui. But of course i prefer the first one.
When you attack the enemy hero, nearby friendly units will attack you. It is working
BUT your friendly units nearby of your hero as attacking the hero you are attacking...
 
Status
Not open for further replies.
Top