Why Does The Tower Attack me instead of my creeps?

Kelvin87

New Member
Reaction score
14
This sample you juz look for the trigger part will do. The rest no need to consider. The Trigger for the register attack (acquires a target)you keep it.
 

Kelvin87

New Member
Reaction score
14
No need. The conditions you can use "Or,Multiple Condition" to link all of them to the trigger.
 

bryanEX1993

New Member
Reaction score
0
wait. im confused. i have done the trigger u send me for only 1 tower. the other towers, how do i connect it?
 

Kelvin87

New Member
Reaction score
14
Err....ya you can delete it. But it is depended on your design. I think for your Triggering Level now you make it separately 1st, I mean for your Tower Trigger, each tower for each Trigger. The acquiring target trigger you need it to register the tower for it to find a target to attack. But the next trigger you can make it as below(i make it in custom code):

JASS:

if not IssueTargetOrder( GetTriggerUnit(), "attack", GetEventTargetUnit() ) then
    call IssueImmediateOrder( GetTriggerUnit(), "stop" )
endif
 

bryanEX1993

New Member
Reaction score
0
hey my tower still attacks my hero even after i followed ur way..why this is happening? i copied word for word.
 

Tukki

is Skeleton Pirate.
Reaction score
29
If you are using JNGP, then you can use:

JASS:
scope TowerManager initializer InitTrig

    globals
        private constant integer MAX_TOWER_TYPES = 2  // Number of towers in your map that you
                                                      // included in this system.
        //------------------------------------------------------------------------------------
        private integer array TOWER_ID[MAX_TOWER_TYPES]
        private group Towers = null
    endglobals
    
    private function setTowers takes nothing returns nothing
        set TOWER_ID[0] = 'H000' // Set this to rawcode of the tower
        set TOWER_ID[1] = 'H001' // and remember to increase [X] by 1 for every tower you add
    endfunction
    
    private function checkTowerId takes unit y returns boolean
     local integer i = 0
     local integer a = GetUnitTypeId(y)
        loop
            exitwhen i >= MAX_TOWER_TYPES
            if (a == TOWER_ID<i> and not IsUnitInGroup(y, Towers)) then
                return true
            endif
            set i = i + 1
        endloop
        return false
    endfunction
    
    private function check takes nothing returns boolean
     local unit u = GetAttacker()
     local unit a = GetTriggerUnit()
     
        if (IsUnitInGroup(a, Towers)) then
            call IssueTargetOrder(a, &quot;attack&quot;, u)
        endif
        set a = null
        set u = null
        return false
    endfunction
    
    private function add takes nothing returns boolean
        if checkTowerId(GetEnteringUnit()) and not IsUnitInGroup(GetEnteringUnit(), Towers) then
            call GroupAddUnit(Towers, GetEnteringUnit())
            return true
        endif
        return false
    endfunction
    
    private function bool takes nothing returns boolean
        return checkTowerId(GetFilterUnit())
    endfunction
    
    private function InitTrig takes nothing returns nothing
     local trigger t = CreateTrigger()
        
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED)
        call TriggerAddCondition(t, Condition(function check))
        
        set t = CreateTrigger()
        call TriggerRegisterEnterRectSimple(t, bj_mapInitialPlayableArea)
        call TriggerAddCondition(t, Condition(function add))
        
        set Towers = CreateGroup()
        call GroupEnumUnitsInRect(Towers, bj_mapInitialPlayableArea, Condition(function bool))
        call setTowers()
    endfunction

endscope</i>


Just modify the variables in "setTowers" to your needs.
To import: Just create a new trigger named TowerManager, convert it to custom text and then replace the script in that with this.
 

Kelvin87

New Member
Reaction score
14
The Map "Sample" i have not optimized it yet. For the Trigger 001(A unit is attacked one) i missed one condition(i thought). So you pls add on if you want to use it. [Level of Shadow Orb Ability of attacked unit equal to 0] ok i check for you
 

Kelvin87

New Member
Reaction score
14
Ya, I saw the problem...You didn't disable the attack initially, of course the tower will attack you
 

Kelvin87

New Member
Reaction score
14
This is I modified d map. please looks.
 

Attachments

  • HellFire Allstars.w3x
    224.5 KB · Views: 130

Kelvin87

New Member
Reaction score
14
I tell you the mistake:
1. Forgot to disable the attack.
2. Doesn't do the 2nd Combat attack
3. Don change the shadow orb ability attack enable index
 

Kelvin87

New Member
Reaction score
14
A very nice terrain design. but the game play i think you can make it more special. don copy dota, people who played dota will fell not much nice d. try to think others, make it not much same as dota ^^
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top